Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Main header file for the bfd library -- portable access to object files. |
c2852e88 | 2 | |
2571583a | 3 | Copyright (C) 1990-2017 Free Software Foundation, Inc. |
c2852e88 | 4 | |
252b5132 RH |
5 | Contributed by Cygnus Support. |
6 | ||
8afb0e02 | 7 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 8 | |
8afb0e02 NC |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | |
cd123cb7 | 11 | the Free Software Foundation; either version 3 of the License, or |
8afb0e02 | 12 | (at your option) any later version. |
252b5132 | 13 | |
8afb0e02 NC |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
252b5132 | 18 | |
8afb0e02 NC |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software | |
3e110533 | 21 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
252b5132 | 22 | |
252b5132 RH |
23 | #ifndef __BFD_H_SEEN__ |
24 | #define __BFD_H_SEEN__ | |
25 | ||
0bee45d9 NC |
26 | /* PR 14072: Ensure that config.h is included first. */ |
27 | #if !defined PACKAGE && !defined PACKAGE_VERSION | |
df7b86aa NC |
28 | #error config.h must be included before this header |
29 | #endif | |
30 | ||
252b5132 RH |
31 | #ifdef __cplusplus |
32 | extern "C" { | |
33 | #endif | |
34 | ||
35 | #include "ansidecl.h" | |
e43d48cc | 36 | #include "symcat.h" |
52d45da3 | 37 | #include <stdarg.h> |
f1163205 NC |
38 | #include <sys/stat.h> |
39 | ||
e43d48cc AM |
40 | #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) |
41 | #ifndef SABER | |
42 | /* This hack is to avoid a problem with some strict ANSI C preprocessors. | |
43 | The problem is, "32_" is not a valid preprocessing token, and we don't | |
44 | want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will | |
45 | cause the inner CONCAT2 macros to be evaluated first, producing | |
46 | still-valid pp-tokens. Then the final concatenation can be done. */ | |
47 | #undef CONCAT4 | |
48 | #define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) | |
49 | #endif | |
50 | #endif | |
252b5132 | 51 | |
0112cd26 NC |
52 | /* This is a utility macro to handle the situation where the code |
53 | wants to place a constant string into the code, followed by a | |
54 | comma and then the length of the string. Doing this by hand | |
db86b2dc PA |
55 | is error prone, so using this macro is safer. */ |
56 | #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) | |
0112cd26 NC |
57 | /* Unfortunately it is not possible to use the STRING_COMMA_LEN macro |
58 | to create the arguments to another macro, since the preprocessor | |
59 | will mis-count the number of arguments to the outer macro (by not | |
60 | evaluating STRING_COMMA_LEN and so missing the comma). This is a | |
61 | problem for example when trying to use STRING_COMMA_LEN to build | |
62 | the arguments to the strncmp() macro. Hence this alternative | |
63 | definition of strncmp is provided here. | |
68ffbac6 | 64 | |
0112cd26 NC |
65 | Note - these macros do NOT work if STR2 is not a constant string. */ |
66 | #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) | |
ea9986ff NC |
67 | /* strcpy() can have a similar problem, but since we know we are |
68 | copying a constant string, we can use memcpy which will be faster | |
69 | since there is no need to check for a NUL byte inside STR. We | |
70 | can also save time if we do not need to copy the terminating NUL. */ | |
71 | #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) | |
72 | #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) | |
0112cd26 NC |
73 | |
74 | ||
ce3c775b NC |
75 | #define BFD_SUPPORTS_PLUGINS @supports_plugins@ |
76 | ||
69263e90 AM |
77 | /* The word size used by BFD on the host. This may be 64 with a 32 |
78 | bit target if the host is 64 bit, or if other 64 bit targets have | |
79 | been selected with --enable-targets, or if --enable-64-bit-bfd. */ | |
252b5132 | 80 | #define BFD_ARCH_SIZE @wordsize@ |
69263e90 AM |
81 | |
82 | /* The word size of the default bfd target. */ | |
83 | #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@ | |
84 | ||
252b5132 | 85 | #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ |
d2df793a | 86 | #define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@ |
252b5132 RH |
87 | #if @BFD_HOST_64_BIT_DEFINED@ |
88 | #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ | |
89 | #define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ | |
8ce8c090 AM |
90 | typedef BFD_HOST_64_BIT bfd_int64_t; |
91 | typedef BFD_HOST_U_64_BIT bfd_uint64_t; | |
252b5132 RH |
92 | #endif |
93 | ||
94 | #if BFD_ARCH_SIZE >= 64 | |
95 | #define BFD64 | |
96 | #endif | |
97 | ||
98 | #ifndef INLINE | |
99 | #if __GNUC__ >= 2 | |
100 | #define INLINE __inline__ | |
101 | #else | |
102 | #define INLINE | |
103 | #endif | |
104 | #endif | |
105 | ||
d2df793a NC |
106 | /* Declaring a type wide enough to hold a host long and a host pointer. */ |
107 | #define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ | |
108 | typedef BFD_HOSTPTR_T bfd_hostptr_t; | |
109 | ||
b5f79c76 | 110 | /* Forward declaration. */ |
c2852e88 | 111 | typedef struct bfd bfd; |
252b5132 | 112 | |
b34976b6 AM |
113 | /* Boolean type used in bfd. Too many systems define their own |
114 | versions of "boolean" for us to safely typedef a "boolean" of | |
cf3d882d | 115 | our own. Using an enum for "bfd_boolean" has its own set of |
b34976b6 AM |
116 | problems, with strange looking casts required to avoid warnings |
117 | on some older compilers. Thus we just use an int. | |
118 | ||
cf3d882d | 119 | General rule: Functions which are bfd_boolean return TRUE on |
b34976b6 AM |
120 | success and FALSE on failure (unless they're a predicate). */ |
121 | ||
122 | typedef int bfd_boolean; | |
123 | #undef FALSE | |
124 | #undef TRUE | |
125 | #define FALSE 0 | |
126 | #define TRUE 1 | |
127 | ||
252b5132 RH |
128 | #ifdef BFD64 |
129 | ||
130 | #ifndef BFD_HOST_64_BIT | |
131 | #error No 64 bit integer type available | |
132 | #endif /* ! defined (BFD_HOST_64_BIT) */ | |
133 | ||
134 | typedef BFD_HOST_U_64_BIT bfd_vma; | |
135 | typedef BFD_HOST_64_BIT bfd_signed_vma; | |
136 | typedef BFD_HOST_U_64_BIT bfd_size_type; | |
137 | typedef BFD_HOST_U_64_BIT symvalue; | |
138 | ||
252b5132 | 139 | #if BFD_HOST_64BIT_LONG |
14a91970 AM |
140 | #define BFD_VMA_FMT "l" |
141 | #elif defined (__MSVCRT__) | |
142 | #define BFD_VMA_FMT "I64" | |
6e3d6dc1 | 143 | #else |
14a91970 | 144 | #define BFD_VMA_FMT "ll" |
252b5132 | 145 | #endif |
14a91970 AM |
146 | |
147 | #ifndef fprintf_vma | |
148 | #define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x) | |
149 | #define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x) | |
252b5132 RH |
150 | #endif |
151 | ||
152 | #else /* not BFD64 */ | |
153 | ||
154 | /* Represent a target address. Also used as a generic unsigned type | |
155 | which is guaranteed to be big enough to hold any arithmetic types | |
156 | we need to deal with. */ | |
157 | typedef unsigned long bfd_vma; | |
158 | ||
159 | /* A generic signed type which is guaranteed to be big enough to hold any | |
160 | arithmetic types we need to deal with. Can be assumed to be compatible | |
161 | with bfd_vma in the same way that signed and unsigned ints are compatible | |
162 | (as parameters, in assignment, etc). */ | |
163 | typedef long bfd_signed_vma; | |
164 | ||
165 | typedef unsigned long symvalue; | |
166 | typedef unsigned long bfd_size_type; | |
167 | ||
168 | /* Print a bfd_vma x on stream s. */ | |
14a91970 AM |
169 | #define BFD_VMA_FMT "l" |
170 | #define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x) | |
171 | #define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x) | |
252b5132 RH |
172 | |
173 | #endif /* not BFD64 */ | |
174 | ||
d0fb9a8d JJ |
175 | #define HALF_BFD_SIZE_TYPE \ |
176 | (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) | |
177 | ||
8ce8c090 AM |
178 | #ifndef BFD_HOST_64_BIT |
179 | /* Fall back on a 32 bit type. The idea is to make these types always | |
180 | available for function return types, but in the case that | |
181 | BFD_HOST_64_BIT is undefined such a function should abort or | |
182 | otherwise signal an error. */ | |
183 | typedef bfd_signed_vma bfd_int64_t; | |
184 | typedef bfd_vma bfd_uint64_t; | |
185 | #endif | |
186 | ||
d7ce59e3 AC |
187 | /* An offset into a file. BFD always uses the largest possible offset |
188 | based on the build time availability of fseek, fseeko, or fseeko64. */ | |
189 | typedef @bfd_file_ptr@ file_ptr; | |
190 | typedef unsigned @bfd_file_ptr@ ufile_ptr; | |
dc810e39 | 191 | |
c58b9523 AM |
192 | extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); |
193 | extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); | |
ae4221d7 | 194 | |
252b5132 | 195 | #define printf_vma(x) fprintf_vma(stdout,x) |
ae4221d7 | 196 | #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) |
252b5132 RH |
197 | |
198 | typedef unsigned int flagword; /* 32 bits of flags */ | |
199 | typedef unsigned char bfd_byte; | |
200 | \f | |
b5f79c76 | 201 | /* File formats. */ |
252b5132 | 202 | |
b5f79c76 NC |
203 | typedef enum bfd_format |
204 | { | |
205 | bfd_unknown = 0, /* File format is unknown. */ | |
5c4491d3 | 206 | bfd_object, /* Linker/assembler/compiler output. */ |
b5f79c76 NC |
207 | bfd_archive, /* Object archive file. */ |
208 | bfd_core, /* Core dump. */ | |
209 | bfd_type_end /* Marks the end; don't use it! */ | |
210 | } | |
211 | bfd_format; | |
252b5132 | 212 | \f |
b5f79c76 | 213 | /* Symbols and relocation. */ |
252b5132 RH |
214 | |
215 | /* A count of carsyms (canonical archive symbols). */ | |
216 | typedef unsigned long symindex; | |
217 | ||
218 | /* How to perform a relocation. */ | |
219 | typedef const struct reloc_howto_struct reloc_howto_type; | |
220 | ||
221 | #define BFD_NO_MORE_SYMBOLS ((symindex) ~0) | |
222 | ||
223 | /* General purpose part of a symbol X; | |
224 | target specific parts are in libcoff.h, libaout.h, etc. */ | |
225 | ||
226 | #define bfd_get_section(x) ((x)->section) | |
227 | #define bfd_get_output_section(x) ((x)->section->output_section) | |
228 | #define bfd_set_section(x,y) ((x)->section) = (y) | |
229 | #define bfd_asymbol_base(x) ((x)->section->vma) | |
230 | #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) | |
231 | #define bfd_asymbol_name(x) ((x)->name) | |
232 | /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ | |
233 | #define bfd_asymbol_bfd(x) ((x)->the_bfd) | |
6ba2a415 RS |
234 | #define bfd_asymbol_flavour(x) \ |
235 | (((x)->flags & BSF_SYNTHETIC) != 0 \ | |
236 | ? bfd_target_unknown_flavour \ | |
237 | : bfd_asymbol_bfd (x)->xvec->flavour) | |
252b5132 RH |
238 | |
239 | /* A canonical archive symbol. */ | |
b5f79c76 NC |
240 | /* This is a type pun with struct ranlib on purpose! */ |
241 | typedef struct carsym | |
242 | { | |
252b5132 | 243 | char *name; |
b5f79c76 NC |
244 | file_ptr file_offset; /* Look here to find the file. */ |
245 | } | |
246 | carsym; /* To make these you call a carsymogen. */ | |
252b5132 | 247 | |
252b5132 | 248 | /* Used in generating armaps (archive tables of contents). |
b5f79c76 NC |
249 | Perhaps just a forward definition would do? */ |
250 | struct orl /* Output ranlib. */ | |
251 | { | |
252 | char **name; /* Symbol name. */ | |
253 | union | |
254 | { | |
dc810e39 AM |
255 | file_ptr pos; |
256 | bfd *abfd; | |
b5f79c76 NC |
257 | } u; /* bfd* or file position. */ |
258 | int namidx; /* Index into string table. */ | |
252b5132 | 259 | }; |
76e7a751 | 260 | |
b5f79c76 NC |
261 | /* Linenumber stuff. */ |
262 | typedef struct lineno_cache_entry | |
263 | { | |
264 | unsigned int line_number; /* Linenumber from start of function. */ | |
265 | union | |
266 | { | |
fc0a2244 | 267 | struct bfd_symbol *sym; /* Function name. */ |
b5f79c76 | 268 | bfd_vma offset; /* Offset into section. */ |
252b5132 | 269 | } u; |
b5f79c76 NC |
270 | } |
271 | alent; | |
252b5132 | 272 | \f |
b5f79c76 | 273 | /* Object and core file sections. */ |
76e7a751 | 274 | typedef struct bfd_section *sec_ptr; |
252b5132 RH |
275 | |
276 | #define align_power(addr, align) \ | |
29f628db | 277 | (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) |
252b5132 | 278 | |
76e7a751 AM |
279 | /* Align an address upward to a boundary, expressed as a number of bytes. |
280 | E.g. align to an 8-byte boundary with argument of 8. Take care never | |
281 | to wrap around if the address is within boundary-1 of the end of the | |
282 | address space. */ | |
283 | #define BFD_ALIGN(this, boundary) \ | |
284 | ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ | |
285 | ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ | |
286 | : ~ (bfd_vma) 0) | |
252b5132 | 287 | |
a0f49396 NC |
288 | #define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) |
289 | #define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) | |
290 | #define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) | |
291 | #define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ | |
292 | (ptr)->alignment_power) | |
252b5132 | 293 | #define bfd_section_name(bfd, ptr) ((ptr)->name) |
eea6121a AM |
294 | #define bfd_section_size(bfd, ptr) ((ptr)->size) |
295 | #define bfd_get_section_size(ptr) ((ptr)->size) | |
252b5132 RH |
296 | #define bfd_section_vma(bfd, ptr) ((ptr)->vma) |
297 | #define bfd_section_lma(bfd, ptr) ((ptr)->lma) | |
298 | #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) | |
a0f49396 NC |
299 | #define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) |
300 | #define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) | |
252b5132 RH |
301 | |
302 | #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) | |
303 | ||
6346d5ca AM |
304 | #define bfd_get_section_limit_octets(bfd, sec) \ |
305 | ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ | |
306 | ? (sec)->rawsize : (sec)->size) | |
307 | ||
07515404 AM |
308 | /* Find the address one past the end of SEC. */ |
309 | #define bfd_get_section_limit(bfd, sec) \ | |
6346d5ca | 310 | (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) |
252b5132 | 311 | |
ddfd6795 | 312 | /* Return TRUE if input section SEC has been discarded. */ |
dbaa2011 | 313 | #define discarded_section(sec) \ |
ab96bf03 AM |
314 | (!bfd_is_abs_section (sec) \ |
315 | && bfd_is_abs_section ((sec)->output_section) \ | |
dbaa2011 AM |
316 | && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \ |
317 | && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS) | |
252b5132 RH |
318 | \f |
319 | typedef enum bfd_print_symbol | |
60bcf0fa | 320 | { |
252b5132 RH |
321 | bfd_print_symbol_name, |
322 | bfd_print_symbol_more, | |
323 | bfd_print_symbol_all | |
324 | } bfd_print_symbol_type; | |
60bcf0fa | 325 | |
252b5132 RH |
326 | /* Information about a symbol that nm needs. */ |
327 | ||
328 | typedef struct _symbol_info | |
329 | { | |
330 | symvalue value; | |
331 | char type; | |
dc810e39 | 332 | const char *name; /* Symbol name. */ |
252b5132 | 333 | unsigned char stab_type; /* Stab type. */ |
8546af74 | 334 | char stab_other; /* Stab other. */ |
252b5132 | 335 | short stab_desc; /* Stab desc. */ |
dc810e39 | 336 | const char *stab_name; /* String for stab type. */ |
252b5132 RH |
337 | } symbol_info; |
338 | ||
339 | /* Get the name of a stabs type code. */ | |
340 | ||
c58b9523 | 341 | extern const char *bfd_get_stab_name (int); |
252b5132 RH |
342 | \f |
343 | /* Hash table routines. There is no way to free up a hash table. */ | |
344 | ||
345 | /* An element in the hash table. Most uses will actually use a larger | |
346 | structure, and an instance of this will be the first field. */ | |
347 | ||
348 | struct bfd_hash_entry | |
349 | { | |
350 | /* Next entry for this hash code. */ | |
351 | struct bfd_hash_entry *next; | |
352 | /* String being hashed. */ | |
353 | const char *string; | |
354 | /* Hash code. This is the full hash code, not the index into the | |
355 | table. */ | |
356 | unsigned long hash; | |
357 | }; | |
358 | ||
359 | /* A hash table. */ | |
360 | ||
361 | struct bfd_hash_table | |
362 | { | |
363 | /* The hash array. */ | |
364 | struct bfd_hash_entry **table; | |
252b5132 RH |
365 | /* A function used to create new elements in the hash table. The |
366 | first entry is itself a pointer to an element. When this | |
367 | function is first invoked, this pointer will be NULL. However, | |
368 | having the pointer permits a hierarchy of method functions to be | |
369 | built each of which calls the function in the superclass. Thus | |
370 | each function should be written to allocate a new block of memory | |
371 | only if the argument is NULL. */ | |
b34976b6 | 372 | struct bfd_hash_entry *(*newfunc) |
c58b9523 | 373 | (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
252b5132 | 374 | /* An objalloc for this hash table. This is a struct objalloc *, |
c58b9523 AM |
375 | but we use void * to avoid requiring the inclusion of objalloc.h. */ |
376 | void *memory; | |
98f0b6ab AM |
377 | /* The number of slots in the hash table. */ |
378 | unsigned int size; | |
379 | /* The number of entries in the hash table. */ | |
380 | unsigned int count; | |
381 | /* The size of elements. */ | |
382 | unsigned int entsize; | |
383 | /* If non-zero, don't grow the hash table. */ | |
384 | unsigned int frozen:1; | |
252b5132 RH |
385 | }; |
386 | ||
387 | /* Initialize a hash table. */ | |
b34976b6 | 388 | extern bfd_boolean bfd_hash_table_init |
c58b9523 AM |
389 | (struct bfd_hash_table *, |
390 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
391 | struct bfd_hash_table *, | |
66eb6687 AM |
392 | const char *), |
393 | unsigned int); | |
252b5132 RH |
394 | |
395 | /* Initialize a hash table specifying a size. */ | |
b34976b6 | 396 | extern bfd_boolean bfd_hash_table_init_n |
c58b9523 AM |
397 | (struct bfd_hash_table *, |
398 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
399 | struct bfd_hash_table *, | |
400 | const char *), | |
66eb6687 | 401 | unsigned int, unsigned int); |
252b5132 RH |
402 | |
403 | /* Free up a hash table. */ | |
b34976b6 | 404 | extern void bfd_hash_table_free |
c58b9523 | 405 | (struct bfd_hash_table *); |
252b5132 | 406 | |
b34976b6 | 407 | /* Look up a string in a hash table. If CREATE is TRUE, a new entry |
252b5132 | 408 | will be created for this string if one does not already exist. The |
b34976b6 | 409 | COPY argument must be TRUE if this routine should copy the string |
252b5132 RH |
410 | into newly allocated memory when adding an entry. */ |
411 | extern struct bfd_hash_entry *bfd_hash_lookup | |
c58b9523 AM |
412 | (struct bfd_hash_table *, const char *, bfd_boolean create, |
413 | bfd_boolean copy); | |
252b5132 | 414 | |
a69898aa AM |
415 | /* Insert an entry in a hash table. */ |
416 | extern struct bfd_hash_entry *bfd_hash_insert | |
417 | (struct bfd_hash_table *, const char *, unsigned long); | |
418 | ||
4e011fb5 AM |
419 | /* Rename an entry in a hash table. */ |
420 | extern void bfd_hash_rename | |
421 | (struct bfd_hash_table *, const char *, struct bfd_hash_entry *); | |
422 | ||
252b5132 RH |
423 | /* Replace an entry in a hash table. */ |
424 | extern void bfd_hash_replace | |
c58b9523 AM |
425 | (struct bfd_hash_table *, struct bfd_hash_entry *old, |
426 | struct bfd_hash_entry *nw); | |
252b5132 RH |
427 | |
428 | /* Base method for creating a hash table entry. */ | |
429 | extern struct bfd_hash_entry *bfd_hash_newfunc | |
c58b9523 | 430 | (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
252b5132 RH |
431 | |
432 | /* Grab some space for a hash table entry. */ | |
c58b9523 AM |
433 | extern void *bfd_hash_allocate |
434 | (struct bfd_hash_table *, unsigned int); | |
252b5132 RH |
435 | |
436 | /* Traverse a hash table in a random order, calling a function on each | |
b34976b6 | 437 | element. If the function returns FALSE, the traversal stops. The |
252b5132 | 438 | INFO argument is passed to the function. */ |
b34976b6 | 439 | extern void bfd_hash_traverse |
c58b9523 AM |
440 | (struct bfd_hash_table *, |
441 | bfd_boolean (*) (struct bfd_hash_entry *, void *), | |
442 | void *info); | |
252b5132 | 443 | |
2d643429 NC |
444 | /* Allows the default size of a hash table to be configured. New hash |
445 | tables allocated using bfd_hash_table_init will be created with | |
446 | this size. */ | |
8ad17b3a | 447 | extern unsigned long bfd_hash_set_default_size (unsigned long); |
2d643429 | 448 | |
0ce398f1 L |
449 | /* Types of compressed DWARF debug sections. We currently support |
450 | zlib. */ | |
451 | enum compressed_debug_section_type | |
452 | { | |
453 | COMPRESS_DEBUG_NONE = 0, | |
454 | COMPRESS_DEBUG = 1 << 0, | |
ee0c0c50 L |
455 | COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, |
456 | COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 | |
0ce398f1 L |
457 | }; |
458 | ||
3722b82f AM |
459 | /* This structure is used to keep track of stabs in sections |
460 | information while linking. */ | |
461 | ||
462 | struct stab_info | |
463 | { | |
464 | /* A hash table used to hold stabs strings. */ | |
465 | struct bfd_strtab_hash *strings; | |
466 | /* The header file hash table. */ | |
467 | struct bfd_hash_table includes; | |
468 | /* The first .stabstr section. */ | |
469 | struct bfd_section *stabstr; | |
470 | }; | |
471 | ||
c58b9523 | 472 | #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table |
e43d48cc | 473 | |
b5f79c76 | 474 | /* User program access to BFD facilities. */ |
252b5132 RH |
475 | |
476 | /* Direct I/O routines, for programs which know more about the object | |
477 | file than BFD does. Use higher level routines if possible. */ | |
478 | ||
c58b9523 AM |
479 | extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); |
480 | extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); | |
481 | extern int bfd_seek (bfd *, file_ptr, int); | |
7c192733 | 482 | extern file_ptr bfd_tell (bfd *); |
c58b9523 AM |
483 | extern int bfd_flush (bfd *); |
484 | extern int bfd_stat (bfd *, struct stat *); | |
dc810e39 AM |
485 | |
486 | /* Deprecated old routines. */ | |
487 | #if __GNUC__ | |
488 | #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ | |
8c8402cc | 489 | (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ |
dc810e39 AM |
490 | bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
491 | #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ | |
8c8402cc | 492 | (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ |
dc810e39 AM |
493 | bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
494 | #else | |
495 | #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ | |
8c8402cc | 496 | (_bfd_warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ |
dc810e39 AM |
497 | bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
498 | #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ | |
8c8402cc | 499 | (_bfd_warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ |
dc810e39 AM |
500 | bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
501 | #endif | |
8c8402cc | 502 | extern void _bfd_warn_deprecated (const char *, const char *, int, const char *); |
252b5132 | 503 | |
252b5132 RH |
504 | /* Cast from const char * to char * so that caller can assign to |
505 | a char * without a warning. */ | |
506 | #define bfd_get_filename(abfd) ((char *) (abfd)->filename) | |
507 | #define bfd_get_cacheable(abfd) ((abfd)->cacheable) | |
508 | #define bfd_get_format(abfd) ((abfd)->format) | |
509 | #define bfd_get_target(abfd) ((abfd)->xvec->name) | |
510 | #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) | |
9bd09e22 ND |
511 | #define bfd_family_coff(abfd) \ |
512 | (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ | |
513 | bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) | |
252b5132 RH |
514 | #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) |
515 | #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) | |
516 | #define bfd_header_big_endian(abfd) \ | |
517 | ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) | |
518 | #define bfd_header_little_endian(abfd) \ | |
519 | ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) | |
520 | #define bfd_get_file_flags(abfd) ((abfd)->flags) | |
521 | #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) | |
522 | #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) | |
252b5132 | 523 | #define bfd_has_map(abfd) ((abfd)->has_armap) |
a8da6403 | 524 | #define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive) |
252b5132 RH |
525 | |
526 | #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) | |
527 | #define bfd_usrdata(abfd) ((abfd)->usrdata) | |
528 | ||
529 | #define bfd_get_start_address(abfd) ((abfd)->start_address) | |
530 | #define bfd_get_symcount(abfd) ((abfd)->symcount) | |
531 | #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) | |
532 | #define bfd_count_sections(abfd) ((abfd)->section_count) | |
533 | ||
1f70368c DJ |
534 | #define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) |
535 | ||
252b5132 RH |
536 | #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
537 | ||
b34976b6 | 538 | extern bfd_boolean bfd_cache_close |
c58b9523 | 539 | (bfd *abfd); |
d436a9b3 FCE |
540 | /* NB: This declaration should match the autogenerated one in libbfd.h. */ |
541 | ||
02d5a37b JG |
542 | extern bfd_boolean bfd_cache_close_all (void); |
543 | ||
b34976b6 | 544 | extern bfd_boolean bfd_record_phdr |
c58b9523 | 545 | (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, |
198beae2 | 546 | bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); |
252b5132 RH |
547 | |
548 | /* Byte swapping routines. */ | |
549 | ||
8ce8c090 AM |
550 | bfd_uint64_t bfd_getb64 (const void *); |
551 | bfd_uint64_t bfd_getl64 (const void *); | |
552 | bfd_int64_t bfd_getb_signed_64 (const void *); | |
553 | bfd_int64_t bfd_getl_signed_64 (const void *); | |
edeb6e24 AM |
554 | bfd_vma bfd_getb32 (const void *); |
555 | bfd_vma bfd_getl32 (const void *); | |
556 | bfd_signed_vma bfd_getb_signed_32 (const void *); | |
557 | bfd_signed_vma bfd_getl_signed_32 (const void *); | |
558 | bfd_vma bfd_getb16 (const void *); | |
559 | bfd_vma bfd_getl16 (const void *); | |
560 | bfd_signed_vma bfd_getb_signed_16 (const void *); | |
561 | bfd_signed_vma bfd_getl_signed_16 (const void *); | |
8ce8c090 AM |
562 | void bfd_putb64 (bfd_uint64_t, void *); |
563 | void bfd_putl64 (bfd_uint64_t, void *); | |
edeb6e24 AM |
564 | void bfd_putb32 (bfd_vma, void *); |
565 | void bfd_putl32 (bfd_vma, void *); | |
566 | void bfd_putb16 (bfd_vma, void *); | |
567 | void bfd_putl16 (bfd_vma, void *); | |
8c603c85 NC |
568 | |
569 | /* Byte swapping routines which take size and endiannes as arguments. */ | |
570 | ||
8ce8c090 AM |
571 | bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); |
572 | void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); | |
082b7297 | 573 | |
252b5132 RH |
574 | #if defined(__STDC__) || defined(ALMOST_STDC) |
575 | struct ecoff_debug_info; | |
576 | struct ecoff_debug_swap; | |
577 | struct ecoff_extr; | |
fc0a2244 | 578 | struct bfd_symbol; |
252b5132 RH |
579 | struct bfd_link_info; |
580 | struct bfd_link_hash_entry; | |
c77ec726 | 581 | struct bfd_section_already_linked; |
252b5132 RH |
582 | struct bfd_elf_version_tree; |
583 | #endif | |
c77ec726 AM |
584 | |
585 | extern bfd_boolean bfd_section_already_linked_table_init (void); | |
586 | extern void bfd_section_already_linked_table_free (void); | |
587 | extern bfd_boolean _bfd_handle_already_linked | |
588 | (struct bfd_section *, struct bfd_section_already_linked *, | |
589 | struct bfd_link_info *); | |
590 | \f | |
591 | /* Externally visible ECOFF routines. */ | |
592 | ||
b34976b6 | 593 | extern bfd_vma bfd_ecoff_get_gp_value |
c58b9523 | 594 | (bfd * abfd); |
b34976b6 | 595 | extern bfd_boolean bfd_ecoff_set_gp_value |
c58b9523 | 596 | (bfd *abfd, bfd_vma gp_value); |
b34976b6 | 597 | extern bfd_boolean bfd_ecoff_set_regmasks |
c58b9523 AM |
598 | (bfd *abfd, unsigned long gprmask, unsigned long fprmask, |
599 | unsigned long *cprmask); | |
600 | extern void *bfd_ecoff_debug_init | |
601 | (bfd *output_bfd, struct ecoff_debug_info *output_debug, | |
602 | const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); | |
252b5132 | 603 | extern void bfd_ecoff_debug_free |
c58b9523 AM |
604 | (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
605 | const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); | |
b34976b6 | 606 | extern bfd_boolean bfd_ecoff_debug_accumulate |
c58b9523 AM |
607 | (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
608 | const struct ecoff_debug_swap *output_swap, bfd *input_bfd, | |
609 | struct ecoff_debug_info *input_debug, | |
610 | const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); | |
b34976b6 | 611 | extern bfd_boolean bfd_ecoff_debug_accumulate_other |
c58b9523 AM |
612 | (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
613 | const struct ecoff_debug_swap *output_swap, bfd *input_bfd, | |
614 | struct bfd_link_info *); | |
b34976b6 | 615 | extern bfd_boolean bfd_ecoff_debug_externals |
c58b9523 AM |
616 | (bfd *abfd, struct ecoff_debug_info *debug, |
617 | const struct ecoff_debug_swap *swap, bfd_boolean relocatable, | |
fc0a2244 AC |
618 | bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), |
619 | void (*set_index) (struct bfd_symbol *, bfd_size_type)); | |
b34976b6 | 620 | extern bfd_boolean bfd_ecoff_debug_one_external |
c58b9523 AM |
621 | (bfd *abfd, struct ecoff_debug_info *debug, |
622 | const struct ecoff_debug_swap *swap, const char *name, | |
623 | struct ecoff_extr *esym); | |
252b5132 | 624 | extern bfd_size_type bfd_ecoff_debug_size |
c58b9523 AM |
625 | (bfd *abfd, struct ecoff_debug_info *debug, |
626 | const struct ecoff_debug_swap *swap); | |
b34976b6 | 627 | extern bfd_boolean bfd_ecoff_write_debug |
c58b9523 AM |
628 | (bfd *abfd, struct ecoff_debug_info *debug, |
629 | const struct ecoff_debug_swap *swap, file_ptr where); | |
b34976b6 | 630 | extern bfd_boolean bfd_ecoff_write_accumulated_debug |
c58b9523 AM |
631 | (void *handle, bfd *abfd, struct ecoff_debug_info *debug, |
632 | const struct ecoff_debug_swap *swap, | |
633 | struct bfd_link_info *info, file_ptr where); | |
252b5132 RH |
634 | |
635 | /* Externally visible ELF routines. */ | |
636 | ||
637 | struct bfd_link_needed_list | |
638 | { | |
639 | struct bfd_link_needed_list *next; | |
640 | bfd *by; | |
641 | const char *name; | |
642 | }; | |
643 | ||
4a43e768 AM |
644 | enum dynamic_lib_link_class { |
645 | DYN_NORMAL = 0, | |
646 | DYN_AS_NEEDED = 1, | |
e56f61be L |
647 | DYN_DT_NEEDED = 2, |
648 | DYN_NO_ADD_NEEDED = 4, | |
649 | DYN_NO_NEEDED = 8 | |
4a43e768 AM |
650 | }; |
651 | ||
5061a885 AM |
652 | enum notice_asneeded_action { |
653 | notice_as_needed, | |
654 | notice_not_needed, | |
655 | notice_needed | |
656 | }; | |
657 | ||
45d6a902 | 658 | extern bfd_boolean bfd_elf_record_link_assignment |
fe21a8fc L |
659 | (bfd *, struct bfd_link_info *, const char *, bfd_boolean, |
660 | bfd_boolean); | |
252b5132 | 661 | extern struct bfd_link_needed_list *bfd_elf_get_needed_list |
c58b9523 | 662 | (bfd *, struct bfd_link_info *); |
b34976b6 | 663 | extern bfd_boolean bfd_elf_get_bfd_needed_list |
c58b9523 | 664 | (bfd *, struct bfd_link_needed_list **); |
04c3a755 NS |
665 | extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, |
666 | const char *, bfd_vma); | |
11c251f4 | 667 | extern bfd_boolean bfd_elf_size_dynamic_sections |
7ee314fa | 668 | (bfd *, const char *, const char *, const char *, const char *, const char *, |
fd91d419 | 669 | const char * const *, struct bfd_link_info *, struct bfd_section **); |
8423293d AM |
670 | extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr |
671 | (bfd *, struct bfd_link_info *); | |
b34976b6 | 672 | extern void bfd_elf_set_dt_needed_name |
c58b9523 | 673 | (bfd *, const char *); |
b34976b6 | 674 | extern const char *bfd_elf_get_dt_soname |
c58b9523 | 675 | (bfd *); |
4a43e768 | 676 | extern void bfd_elf_set_dyn_lib_class |
23fe9577 | 677 | (bfd *, enum dynamic_lib_link_class); |
e56f61be L |
678 | extern int bfd_elf_get_dyn_lib_class |
679 | (bfd *); | |
a963dc6a | 680 | extern struct bfd_link_needed_list *bfd_elf_get_runpath_list |
c58b9523 | 681 | (bfd *, struct bfd_link_info *); |
75938853 | 682 | extern int bfd_elf_discard_info |
c58b9523 | 683 | (bfd *, struct bfd_link_info *); |
8a696751 AM |
684 | extern unsigned int _bfd_elf_default_action_discarded |
685 | (struct bfd_section *); | |
252b5132 | 686 | |
7f8d5fc9 ILT |
687 | /* Return an upper bound on the number of bytes required to store a |
688 | copy of ABFD's program header table entries. Return -1 if an error | |
689 | occurs; bfd_get_error will return an appropriate code. */ | |
b34976b6 | 690 | extern long bfd_get_elf_phdr_upper_bound |
c58b9523 | 691 | (bfd *abfd); |
7f8d5fc9 ILT |
692 | |
693 | /* Copy ABFD's program header table entries to *PHDRS. The entries | |
694 | will be stored as an array of Elf_Internal_Phdr structures, as | |
695 | defined in include/elf/internal.h. To find out how large the | |
696 | buffer needs to be, call bfd_get_elf_phdr_upper_bound. | |
697 | ||
698 | Return the number of program header table entries read, or -1 if an | |
699 | error occurs; bfd_get_error will return an appropriate code. */ | |
b34976b6 | 700 | extern int bfd_get_elf_phdrs |
c58b9523 | 701 | (bfd *abfd, void *phdrs); |
7f8d5fc9 | 702 | |
8d6337fe | 703 | /* Create a new BFD as if by bfd_openr. Rather than opening a file, |
5979d6b6 AM |
704 | reconstruct an ELF file by reading the segments out of remote |
705 | memory based on the ELF file header at EHDR_VMA and the ELF program | |
706 | headers it points to. If non-zero, SIZE is the known extent of the | |
707 | object. If not null, *LOADBASEP is filled in with the difference | |
708 | between the VMAs from which the segments were read, and the VMAs | |
709 | the file headers (and hence BFD's idea of each section's VMA) put | |
710 | them at. | |
711 | ||
712 | The function TARGET_READ_MEMORY is called to copy LEN bytes from | |
713 | the remote memory at target address VMA into the local buffer at | |
714 | MYADDR; it should return zero on success or an `errno' code on | |
715 | failure. TEMPL must be a BFD for a target with the word size and | |
716 | byte order found in the remote memory. */ | |
8d6337fe | 717 | extern bfd *bfd_elf_bfd_from_remote_memory |
2493504a | 718 | (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
fe78531d JK |
719 | int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
720 | bfd_size_type len)); | |
8d6337fe | 721 | |
e1918d23 AM |
722 | extern struct bfd_section *_bfd_elf_tls_setup |
723 | (bfd *, struct bfd_link_info *); | |
724 | ||
051d833a AM |
725 | extern struct bfd_section * |
726 | _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma); | |
727 | ||
1e035701 | 728 | extern void _bfd_fix_excluded_sec_syms |
a3c2b96a | 729 | (bfd *, struct bfd_link_info *); |
f652615e | 730 | |
266abb8f NS |
731 | extern unsigned bfd_m68k_mach_to_features (int); |
732 | ||
733 | extern int bfd_m68k_features_to_mach (unsigned); | |
734 | ||
b34976b6 | 735 | extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs |
a3c2b96a AM |
736 | (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
737 | char **); | |
0752970e | 738 | |
7fb9f789 NC |
739 | extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int); |
740 | ||
0f64bb02 CM |
741 | extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs |
742 | (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, | |
743 | char **); | |
744 | ||
99706f30 SR |
745 | extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs |
746 | (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, | |
747 | char **); | |
748 | ||
252b5132 RH |
749 | /* SunOS shared library support routines for the linker. */ |
750 | ||
751 | extern struct bfd_link_needed_list *bfd_sunos_get_needed_list | |
c58b9523 | 752 | (bfd *, struct bfd_link_info *); |
b34976b6 | 753 | extern bfd_boolean bfd_sunos_record_link_assignment |
c58b9523 | 754 | (bfd *, struct bfd_link_info *, const char *); |
b34976b6 | 755 | extern bfd_boolean bfd_sunos_size_dynamic_sections |
a3c2b96a AM |
756 | (bfd *, struct bfd_link_info *, struct bfd_section **, |
757 | struct bfd_section **, struct bfd_section **); | |
252b5132 RH |
758 | |
759 | /* Linux shared library support routines for the linker. */ | |
760 | ||
b34976b6 | 761 | extern bfd_boolean bfd_i386linux_size_dynamic_sections |
c58b9523 | 762 | (bfd *, struct bfd_link_info *); |
b34976b6 | 763 | extern bfd_boolean bfd_m68klinux_size_dynamic_sections |
c58b9523 | 764 | (bfd *, struct bfd_link_info *); |
b34976b6 | 765 | extern bfd_boolean bfd_sparclinux_size_dynamic_sections |
c58b9523 | 766 | (bfd *, struct bfd_link_info *); |
252b5132 RH |
767 | |
768 | /* mmap hacks */ | |
769 | ||
770 | struct _bfd_window_internal; | |
771 | typedef struct _bfd_window_internal bfd_window_internal; | |
772 | ||
b5f79c76 NC |
773 | typedef struct _bfd_window |
774 | { | |
252b5132 | 775 | /* What the user asked for. */ |
c58b9523 | 776 | void *data; |
252b5132 RH |
777 | bfd_size_type size; |
778 | /* The actual window used by BFD. Small user-requested read-only | |
779 | regions sharing a page may share a single window into the object | |
780 | file. Read-write versions shouldn't until I've fixed things to | |
781 | keep track of which portions have been claimed by the | |
782 | application; don't want to give the same region back when the | |
783 | application wants two writable copies! */ | |
784 | struct _bfd_window_internal *i; | |
b5f79c76 NC |
785 | } |
786 | bfd_window; | |
252b5132 | 787 | |
b34976b6 | 788 | extern void bfd_init_window |
c58b9523 | 789 | (bfd_window *); |
b34976b6 | 790 | extern void bfd_free_window |
c58b9523 | 791 | (bfd_window *); |
b34976b6 | 792 | extern bfd_boolean bfd_get_file_window |
c58b9523 | 793 | (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); |
252b5132 RH |
794 | |
795 | /* XCOFF support routines for the linker. */ | |
796 | ||
24c611d1 RS |
797 | extern bfd_boolean bfd_xcoff_split_import_path |
798 | (bfd *, const char *, const char **, const char **); | |
799 | extern bfd_boolean bfd_xcoff_set_archive_import_path | |
800 | (struct bfd_link_info *, bfd *, const char *); | |
b34976b6 | 801 | extern bfd_boolean bfd_xcoff_link_record_set |
c58b9523 | 802 | (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); |
b34976b6 | 803 | extern bfd_boolean bfd_xcoff_import_symbol |
c58b9523 AM |
804 | (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, |
805 | const char *, const char *, const char *, unsigned int); | |
b34976b6 | 806 | extern bfd_boolean bfd_xcoff_export_symbol |
c58b9523 | 807 | (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); |
b34976b6 | 808 | extern bfd_boolean bfd_xcoff_link_count_reloc |
c58b9523 | 809 | (bfd *, struct bfd_link_info *, const char *); |
b34976b6 | 810 | extern bfd_boolean bfd_xcoff_record_link_assignment |
c58b9523 | 811 | (bfd *, struct bfd_link_info *, const char *); |
b34976b6 | 812 | extern bfd_boolean bfd_xcoff_size_dynamic_sections |
c58b9523 AM |
813 | (bfd *, struct bfd_link_info *, const char *, const char *, |
814 | unsigned long, unsigned long, unsigned long, bfd_boolean, | |
b64232cc | 815 | int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean); |
b34976b6 | 816 | extern bfd_boolean bfd_xcoff_link_generate_rtinit |
c58b9523 | 817 | (bfd *, const char *, const char *, bfd_boolean); |
252b5132 | 818 | |
eb1e0e80 | 819 | /* XCOFF support routines for ar. */ |
b34976b6 | 820 | extern bfd_boolean bfd_xcoff_ar_archive_set_magic |
c58b9523 | 821 | (bfd *, char *); |
eb1e0e80 | 822 | |
252b5132 RH |
823 | /* Externally visible COFF routines. */ |
824 | ||
825 | #if defined(__STDC__) || defined(ALMOST_STDC) | |
826 | struct internal_syment; | |
827 | union internal_auxent; | |
828 | #endif | |
829 | ||
b34976b6 | 830 | extern bfd_boolean bfd_coff_set_symbol_class |
fc0a2244 | 831 | (bfd *, struct bfd_symbol *, unsigned int); |
252b5132 | 832 | |
b34976b6 | 833 | extern bfd_boolean bfd_m68k_coff_create_embedded_relocs |
198beae2 | 834 | (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); |
e702a51c | 835 | |
c7b8f16e JB |
836 | /* ARM VFP11 erratum workaround support. */ |
837 | typedef enum | |
838 | { | |
839 | BFD_ARM_VFP11_FIX_DEFAULT, | |
840 | BFD_ARM_VFP11_FIX_NONE, | |
841 | BFD_ARM_VFP11_FIX_SCALAR, | |
842 | BFD_ARM_VFP11_FIX_VECTOR | |
843 | } bfd_arm_vfp11_fix; | |
844 | ||
845 | extern void bfd_elf32_arm_init_maps | |
846 | (bfd *); | |
847 | ||
848 | extern void bfd_elf32_arm_set_vfp11_fix | |
849 | (bfd *, struct bfd_link_info *); | |
850 | ||
48229727 JB |
851 | extern void bfd_elf32_arm_set_cortex_a8_fix |
852 | (bfd *, struct bfd_link_info *); | |
853 | ||
c7b8f16e JB |
854 | extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan |
855 | (bfd *, struct bfd_link_info *); | |
856 | ||
857 | extern void bfd_elf32_arm_vfp11_fix_veneer_locations | |
858 | (bfd *, struct bfd_link_info *); | |
859 | ||
a504d23a LA |
860 | /* ARM STM STM32L4XX erratum workaround support. */ |
861 | typedef enum | |
862 | { | |
863 | BFD_ARM_STM32L4XX_FIX_NONE, | |
864 | BFD_ARM_STM32L4XX_FIX_DEFAULT, | |
865 | BFD_ARM_STM32L4XX_FIX_ALL | |
866 | } bfd_arm_stm32l4xx_fix; | |
867 | ||
868 | extern void bfd_elf32_arm_set_stm32l4xx_fix | |
869 | (bfd *, struct bfd_link_info *); | |
870 | ||
871 | extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan | |
872 | (bfd *, struct bfd_link_info *); | |
873 | ||
874 | extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations | |
875 | (bfd *, struct bfd_link_info *); | |
876 | ||
252b5132 | 877 | /* ARM Interworking support. Called from linker. */ |
b34976b6 | 878 | extern bfd_boolean bfd_arm_allocate_interworking_sections |
c58b9523 | 879 | (struct bfd_link_info *); |
252b5132 | 880 | |
b34976b6 | 881 | extern bfd_boolean bfd_arm_process_before_allocation |
c58b9523 | 882 | (bfd *, struct bfd_link_info *, int); |
252b5132 | 883 | |
b34976b6 | 884 | extern bfd_boolean bfd_arm_get_bfd_for_interworking |
c58b9523 | 885 | (bfd *, struct bfd_link_info *); |
252b5132 | 886 | |
86033394 | 887 | /* PE ARM Interworking support. Called from linker. */ |
b34976b6 | 888 | extern bfd_boolean bfd_arm_pe_allocate_interworking_sections |
c58b9523 | 889 | (struct bfd_link_info *); |
86033394 | 890 | |
b34976b6 | 891 | extern bfd_boolean bfd_arm_pe_process_before_allocation |
c58b9523 | 892 | (bfd *, struct bfd_link_info *, int); |
86033394 | 893 | |
b34976b6 | 894 | extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking |
c58b9523 | 895 | (bfd *, struct bfd_link_info *); |
86033394 | 896 | |
252b5132 | 897 | /* ELF ARM Interworking support. Called from linker. */ |
b34976b6 | 898 | extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections |
c58b9523 | 899 | (struct bfd_link_info *); |
67e5d3d6 | 900 | |
b34976b6 | 901 | extern bfd_boolean bfd_elf32_arm_process_before_allocation |
d504ffc8 | 902 | (bfd *, struct bfd_link_info *); |
eb043451 | 903 | |
68c39892 TP |
904 | struct elf32_arm_params { |
905 | char *thumb_entry_symbol; | |
906 | int byteswap_code; | |
907 | int target1_is_rel; | |
908 | char * target2_type; | |
909 | int fix_v4bx; | |
910 | int use_blx; | |
911 | bfd_arm_vfp11_fix vfp11_denorm_fix; | |
912 | bfd_arm_stm32l4xx_fix stm32l4xx_fix; | |
913 | int no_enum_size_warning; | |
914 | int no_wchar_size_warning; | |
915 | int pic_veneer; | |
916 | int fix_cortex_a8; | |
917 | int fix_arm1176; | |
918 | int merge_exidx_entries; | |
919 | int cmse_implib; | |
920 | bfd *in_implib_bfd; | |
921 | }; | |
922 | ||
923 | void bfd_elf32_arm_set_target_params | |
924 | (bfd *, struct bfd_link_info *, struct elf32_arm_params *); | |
67e5d3d6 | 925 | |
b34976b6 | 926 | extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking |
c58b9523 | 927 | (bfd *, struct bfd_link_info *); |
252b5132 | 928 | |
b34976b6 | 929 | extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd |
c58b9523 | 930 | (bfd *, struct bfd_link_info *); |
daa4adae TP |
931 | |
932 | extern void bfd_elf32_arm_keep_private_stub_output_sections | |
933 | (struct bfd_link_info *); | |
8afb0e02 | 934 | |
1db37fe6 | 935 | /* ELF ARM mapping symbol support. */ |
b0796911 PB |
936 | #define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) |
937 | #define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) | |
938 | #define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) | |
939 | #define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) | |
1db37fe6 | 940 | |
b0796911 | 941 | extern bfd_boolean bfd_is_arm_special_symbol_name |
1db37fe6 YG |
942 | (const char *, int); |
943 | ||
944 | extern void bfd_elf32_arm_set_byteswap_code | |
945 | (struct bfd_link_info *, int); | |
9d2da7ca | 946 | |
1db37fe6 | 947 | extern void bfd_elf32_arm_use_long_plt (void); |
d504ffc8 | 948 | |
5a6c6817 NC |
949 | /* ARM Note section processing. */ |
950 | extern bfd_boolean bfd_arm_merge_machines | |
c58b9523 | 951 | (bfd *, bfd *); |
5a6c6817 NC |
952 | |
953 | extern bfd_boolean bfd_arm_update_notes | |
c58b9523 | 954 | (bfd *, const char *); |
5a6c6817 NC |
955 | |
956 | extern unsigned int bfd_arm_get_mach_from_notes | |
c58b9523 | 957 | (bfd *, const char *); |
5a6c6817 | 958 | |
906e58ca NC |
959 | /* ARM stub generation support. Called from the linker. */ |
960 | extern int elf32_arm_setup_section_lists | |
961 | (bfd *, struct bfd_link_info *); | |
962 | extern void elf32_arm_next_input_section | |
963 | (struct bfd_link_info *, struct bfd_section *); | |
964 | extern bfd_boolean elf32_arm_size_stubs | |
965 | (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
6bde4c52 TP |
966 | struct bfd_section * (*) (const char *, struct bfd_section *, |
967 | struct bfd_section *, unsigned int), | |
7a89b94e | 968 | void (*) (void)); |
906e58ca NC |
969 | extern bfd_boolean elf32_arm_build_stubs |
970 | (struct bfd_link_info *); | |
2468f9c9 PB |
971 | |
972 | /* ARM unwind section editing support. */ | |
973 | extern bfd_boolean elf32_arm_fix_exidx_coverage | |
85fdf906 | 974 | (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
2468f9c9 | 975 | |
fbd9ad90 PB |
976 | /* C6x unwind section editing support. */ |
977 | extern bfd_boolean elf32_tic6x_fix_exidx_coverage | |
978 | (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); | |
979 | ||
a06ea964 NC |
980 | extern void bfd_elf64_aarch64_init_maps |
981 | (bfd *); | |
982 | ||
cec5225b YZ |
983 | extern void bfd_elf32_aarch64_init_maps |
984 | (bfd *); | |
985 | ||
b9eead84 | 986 | extern void bfd_elf64_aarch64_set_options |
1f56df9d | 987 | (bfd *, struct bfd_link_info *, int, int, int, int, int, int); |
a06ea964 | 988 | |
cec5225b | 989 | extern void bfd_elf32_aarch64_set_options |
1f56df9d | 990 | (bfd *, struct bfd_link_info *, int, int, int, int, int, int); |
cec5225b | 991 | |
a06ea964 NC |
992 | /* ELF AArch64 mapping symbol support. */ |
993 | #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) | |
994 | #define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) | |
995 | #define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) | |
996 | #define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) | |
997 | extern bfd_boolean bfd_is_aarch64_special_symbol_name | |
998 | (const char * name, int type); | |
999 | ||
cec5225b | 1000 | /* AArch64 stub generation support for ELF64. Called from the linker. */ |
a06ea964 NC |
1001 | extern int elf64_aarch64_setup_section_lists |
1002 | (bfd *, struct bfd_link_info *); | |
1003 | extern void elf64_aarch64_next_input_section | |
1004 | (struct bfd_link_info *, struct bfd_section *); | |
1005 | extern bfd_boolean elf64_aarch64_size_stubs | |
1006 | (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
1007 | struct bfd_section * (*) (const char *, struct bfd_section *), | |
1008 | void (*) (void)); | |
1009 | extern bfd_boolean elf64_aarch64_build_stubs | |
1010 | (struct bfd_link_info *); | |
cec5225b YZ |
1011 | /* AArch64 stub generation support for ELF32. Called from the linker. */ |
1012 | extern int elf32_aarch64_setup_section_lists | |
1013 | (bfd *, struct bfd_link_info *); | |
1014 | extern void elf32_aarch64_next_input_section | |
1015 | (struct bfd_link_info *, struct bfd_section *); | |
1016 | extern bfd_boolean elf32_aarch64_size_stubs | |
1017 | (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, | |
1018 | struct bfd_section * (*) (const char *, struct bfd_section *), | |
1019 | void (*) (void)); | |
1020 | extern bfd_boolean elf32_aarch64_build_stubs | |
1021 | (struct bfd_link_info *); | |
1022 | ||
68ffbac6 | 1023 | |
8546af74 | 1024 | /* TI COFF load page support. */ |
b9af77f5 | 1025 | extern void bfd_ticoff_set_section_load_page |
198beae2 | 1026 | (struct bfd_section *, int); |
b9af77f5 TW |
1027 | |
1028 | extern int bfd_ticoff_get_section_load_page | |
198beae2 | 1029 | (struct bfd_section *); |
a05758dd | 1030 | |
7a9823f1 RS |
1031 | /* H8/300 functions. */ |
1032 | extern bfd_vma bfd_h8300_pad_address | |
1033 | (bfd *, bfd_vma); | |
1034 | ||
3f7deb8a L |
1035 | /* IA64 Itanium code generation. Called from linker. */ |
1036 | extern void bfd_elf32_ia64_after_parse | |
1037 | (int); | |
1038 | ||
1039 | extern void bfd_elf64_ia64_after_parse | |
1040 | (int); | |
685080f2 NC |
1041 | |
1042 | /* V850 Note manipulation routines. */ | |
1043 | extern bfd_boolean v850_elf_create_sections | |
1044 | (struct bfd_link_info *); | |
1045 | ||
1046 | extern bfd_boolean v850_elf_set_note | |
1047 | (bfd *, unsigned int, unsigned int); | |
5e7fc731 MR |
1048 | |
1049 | /* MIPS ABI flags data access. For the disassembler. */ | |
1050 | struct elf_internal_abiflags_v0; | |
1051 | extern struct elf_internal_abiflags_v0 *bfd_mips_elf_get_abiflags (bfd *); |