Rev 5191 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5191 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* bfdlink.h -- header file for BFD link routines |
1 | /* bfdlink.h -- header file for BFD link routines |
2 | Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
- | |
3 | 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
- | |
4 | Free Software Foundation, Inc. |
2 | Copyright (C) 1993-2015 Free Software Foundation, Inc. |
5 | Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support. |
3 | Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support. |
Line 6... | Line 4... | ||
6 | 4 | ||
Line 7... | Line 5... | ||
7 | This file is part of BFD, the Binary File Descriptor library. |
5 | This file is part of BFD, the Binary File Descriptor library. |
Line 91... | Line 89... | ||
91 | struct bfd_hash_entry root; |
89 | struct bfd_hash_entry root; |
Line 92... | Line 90... | ||
92 | 90 | ||
93 | /* Type of this entry. */ |
91 | /* Type of this entry. */ |
Line -... | Line 92... | ||
- | 92 | ENUM_BITFIELD (bfd_link_hash_type) type : 8; |
|
- | 93 | ||
94 | ENUM_BITFIELD (bfd_link_hash_type) type : 8; |
94 | /* Symbol is referenced in a normal object file, as distict from a LTO |
Line -... | Line 95... | ||
- | 95 | IR object file. */ |
|
- | 96 | unsigned int non_ir_ref : 1; |
|
- | 97 | ||
- | 98 | /* Symbol is a built-in define. These will be overridden by PROVIDE |
|
95 | 99 | in a linker script. */ |
|
96 | unsigned int non_ir_ref : 1; |
100 | unsigned int linker_def : 1; |
97 | 101 | ||
98 | /* A union of information depending upon the type. */ |
102 | /* A union of information depending upon the type. */ |
99 | union |
103 | union |
Line 167... | Line 171... | ||
167 | /* A linked list of undefined and common symbols, linked through the |
171 | /* A linked list of undefined and common symbols, linked through the |
168 | next field in the bfd_link_hash_entry structure. */ |
172 | next field in the bfd_link_hash_entry structure. */ |
169 | struct bfd_link_hash_entry *undefs; |
173 | struct bfd_link_hash_entry *undefs; |
170 | /* Entries are added to the tail of the undefs list. */ |
174 | /* Entries are added to the tail of the undefs list. */ |
171 | struct bfd_link_hash_entry *undefs_tail; |
175 | struct bfd_link_hash_entry *undefs_tail; |
- | 176 | /* Function to free the hash table on closing BFD. */ |
|
- | 177 | void (*hash_table_free) (bfd *); |
|
172 | /* The type of the link hash table. */ |
178 | /* The type of the link hash table. */ |
173 | enum bfd_link_hash_table_type type; |
179 | enum bfd_link_hash_table_type type; |
174 | }; |
180 | }; |
Line 175... | Line 181... | ||
175 | 181 | ||
Line 186... | Line 192... | ||
186 | 192 | ||
187 | extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup |
193 | extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup |
188 | (bfd *, struct bfd_link_info *, const char *, bfd_boolean, |
194 | (bfd *, struct bfd_link_info *, const char *, bfd_boolean, |
Line -... | Line 195... | ||
- | 195 | bfd_boolean, bfd_boolean); |
|
- | 196 | ||
- | 197 | /* If H is a wrapped symbol, ie. the symbol name starts with "__wrap_" |
|
- | 198 | and the remainder is found in wrap_hash, return the real symbol. */ |
|
- | 199 | ||
- | 200 | extern struct bfd_link_hash_entry *unwrap_hash_lookup |
|
189 | bfd_boolean, bfd_boolean); |
201 | (struct bfd_link_info *, bfd *, struct bfd_link_hash_entry *); |
190 | 202 | ||
191 | /* Traverse a link hash table. */ |
203 | /* Traverse a link hash table. */ |
192 | extern void bfd_link_hash_traverse |
204 | extern void bfd_link_hash_traverse |
193 | (struct bfd_link_hash_table *, |
205 | (struct bfd_link_hash_table *, |
Line 245... | Line 257... | ||
245 | }; |
257 | }; |
Line 246... | Line 258... | ||
246 | 258 | ||
247 | struct bfd_elf_dynamic_list; |
259 | struct bfd_elf_dynamic_list; |
Line -... | Line 260... | ||
- | 260 | struct bfd_elf_version_tree; |
|
- | 261 | ||
- | 262 | /* Types of output. */ |
|
- | 263 | ||
- | 264 | enum output_type |
|
- | 265 | { |
|
- | 266 | type_pde, |
|
- | 267 | type_pie, |
|
- | 268 | type_relocatable, |
|
- | 269 | type_dll, |
|
- | 270 | }; |
|
- | 271 | ||
- | 272 | #define bfd_link_pde(info) ((info)->type == type_pde) |
|
- | 273 | #define bfd_link_dll(info) ((info)->type == type_dll) |
|
- | 274 | #define bfd_link_relocatable(info) ((info)->type == type_relocatable) |
|
- | 275 | #define bfd_link_pie(info) ((info)->type == type_pie) |
|
- | 276 | #define bfd_link_executable(info) (bfd_link_pde (info) || bfd_link_pie (info)) |
|
248 | struct bfd_elf_version_tree; |
277 | #define bfd_link_pic(info) (bfd_link_dll (info) || bfd_link_pie (info)) |
249 | 278 | ||
Line 250... | Line 279... | ||
250 | /* This structure holds all the information needed to communicate |
279 | /* This structure holds all the information needed to communicate |
251 | between BFD and the linker when doing a link. */ |
280 | between BFD and the linker when doing a link. */ |
252 | - | ||
253 | struct bfd_link_info |
281 | |
254 | { |
- | |
255 | /* TRUE if BFD should generate a shared object (or a pie). */ |
- | |
256 | unsigned int shared: 1; |
282 | struct bfd_link_info |
257 | - | ||
258 | /* TRUE if generating an executable, position independent or not. */ |
- | |
259 | unsigned int executable : 1; |
- | |
260 | - | ||
261 | /* TRUE if generating a position independent executable. */ |
- | |
262 | unsigned int pie: 1; |
- | |
Line 263... | Line 283... | ||
263 | 283 | { |
|
264 | /* TRUE if BFD should generate a relocatable object file. */ |
284 | /* Output type. */ |
Line 265... | Line 285... | ||
265 | unsigned int relocatable: 1; |
285 | ENUM_BITFIELD (output_type) type : 2; |
Line 284... | Line 304... | ||
284 | 304 | ||
285 | /* TRUE if every symbol should be reported back via the notice |
305 | /* TRUE if every symbol should be reported back via the notice |
286 | callback. */ |
306 | callback. */ |
Line 287... | Line 307... | ||
287 | unsigned int notice_all: 1; |
307 | unsigned int notice_all: 1; |
288 | 308 | ||
Line 289... | Line 309... | ||
289 | /* TRUE if we are loading LTO outputs. */ |
309 | /* TRUE if the LTO plugin is active. */ |
290 | unsigned int loading_lto_outputs: 1; |
310 | unsigned int lto_plugin_active: 1; |
Line 291... | Line 311... | ||
291 | 311 | ||
Line 328... | Line 348... | ||
328 | unsigned int emitrelocations: 1; |
348 | unsigned int emitrelocations: 1; |
Line 329... | Line 349... | ||
329 | 349 | ||
330 | /* TRUE if PT_GNU_RELRO segment should be created. */ |
350 | /* TRUE if PT_GNU_RELRO segment should be created. */ |
Line 331... | Line 351... | ||
331 | unsigned int relro: 1; |
351 | unsigned int relro: 1; |
332 | 352 | ||
333 | /* TRUE if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment |
353 | /* Nonzero if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment |
Line 334... | Line 354... | ||
334 | should be created. */ |
354 | should be created. 1 for DWARF2 tables, 2 for compact tables. */ |
335 | unsigned int eh_frame_hdr: 1; |
355 | unsigned int eh_frame_hdr_type: 2; |
Line 336... | Line 356... | ||
336 | 356 | ||
Line 406... | Line 426... | ||
406 | unsigned int warn_alternate_em: 1; |
426 | unsigned int warn_alternate_em: 1; |
Line 407... | Line 427... | ||
407 | 427 | ||
408 | /* TRUE if the linker script contained an explicit PHDRS command. */ |
428 | /* TRUE if the linker script contained an explicit PHDRS command. */ |
Line -... | Line 429... | ||
- | 429 | unsigned int user_phdrs: 1; |
|
- | 430 | ||
- | 431 | /* TRUE if BND prefix in PLT entries is always generated. */ |
|
- | 432 | unsigned int bndplt: 1; |
|
- | 433 | ||
- | 434 | /* TRUE if generation of .interp/PT_INTERP should be suppressed. */ |
|
- | 435 | unsigned int nointerp: 1; |
|
- | 436 | ||
- | 437 | /* TRUE if generate a 1-byte NOP as suffix for x86 call instruction. */ |
|
- | 438 | unsigned int call_nop_as_suffix : 1; |
|
- | 439 | ||
- | 440 | /* The 1-byte NOP for x86 call instruction. */ |
|
409 | unsigned int user_phdrs: 1; |
441 | char call_nop_byte; |
410 | 442 | ||
411 | /* Char that may appear as the first char of a symbol, but should be |
443 | /* Char that may appear as the first char of a symbol, but should be |
412 | skipped (like symbol_leading_char) when looking up symbols in |
444 | skipped (like symbol_leading_char) when looking up symbols in |
Line 413... | Line 445... | ||
413 | wrap_hash. Used by PowerPC Linux for 'dot' symbols. */ |
445 | wrap_hash. Used by PowerPC Linux for 'dot' symbols. */ |
414 | char wrap_char; |
446 | char wrap_char; |
Line -... | Line 447... | ||
- | 447 | ||
- | 448 | /* Separator between archive and filename in linker script filespecs. */ |
|
- | 449 | char path_separator; |
|
415 | 450 | ||
416 | /* Separator between archive and filename in linker script filespecs. */ |
451 | /* Compress DWARF debug sections. */ |
417 | char path_separator; |
452 | enum compressed_debug_section_type compress_debug; |
Line 418... | Line 453... | ||
418 | 453 | ||
Line 463... | Line 498... | ||
463 | 498 | ||
464 | /* The output BFD. */ |
499 | /* The output BFD. */ |
Line 465... | Line 500... | ||
465 | bfd *output_bfd; |
500 | bfd *output_bfd; |
466 | 501 | ||
467 | /* The list of input BFD's involved in the link. These are chained |
502 | /* The list of input BFD's involved in the link. These are chained |
468 | together via the link_next field. */ |
503 | together via the link.next field. */ |
Line 469... | Line 504... | ||
469 | bfd *input_bfds; |
504 | bfd *input_bfds; |
470 | bfd **input_bfds_tail; |
505 | bfd **input_bfds_tail; |
Line 500... | Line 535... | ||
500 | /* Number of relaxation trips. This number is incremented every |
535 | /* Number of relaxation trips. This number is incremented every |
501 | time the relaxation pass is restarted due to a previous |
536 | time the relaxation pass is restarted due to a previous |
502 | relaxation returning true in *AGAIN. */ |
537 | relaxation returning true in *AGAIN. */ |
503 | int relax_trip; |
538 | int relax_trip; |
Line -... | Line 539... | ||
- | 539 | ||
- | 540 | /* > 0 to treat protected data defined in the shared library as |
|
- | 541 | reference external. 0 to treat it as internal. -1 to let |
|
- | 542 | backend to decide. */ |
|
- | 543 | int extern_protected_data; |
|
504 | 544 | ||
505 | /* Non-zero if auto-import thunks for DATA items in pei386 DLLs |
545 | /* Non-zero if auto-import thunks for DATA items in pei386 DLLs |
506 | should be generated/linked against. Set to 1 if this feature |
546 | should be generated/linked against. Set to 1 if this feature |
507 | is explicitly requested by the user, -1 if enabled by default. */ |
547 | is explicitly requested by the user, -1 if enabled by default. */ |
Line 629... | Line 669... | ||
629 | ABFD will be NULL. */ |
669 | ABFD will be NULL. */ |
630 | bfd_boolean (*unattached_reloc) |
670 | bfd_boolean (*unattached_reloc) |
631 | (struct bfd_link_info *, const char *name, |
671 | (struct bfd_link_info *, const char *name, |
632 | bfd *abfd, asection *section, bfd_vma address); |
672 | bfd *abfd, asection *section, bfd_vma address); |
633 | /* A function which is called when a symbol in notice_hash is |
673 | /* A function which is called when a symbol in notice_hash is |
634 | defined or referenced. H is the symbol. ABFD, SECTION and |
674 | defined or referenced. H is the symbol, INH the indirect symbol |
635 | ADDRESS are the (new) value of the symbol. If SECTION is |
- | |
636 | bfd_und_section, this is a reference. FLAGS are the symbol |
675 | if applicable. ABFD, SECTION and ADDRESS are the (new) value of |
637 | BSF_* flags. STRING is the name of the symbol to indirect to if |
676 | the symbol. If SECTION is bfd_und_section, this is a reference. |
638 | the sym is indirect, or the warning string if a warning sym. */ |
677 | FLAGS are the symbol BSF_* flags. */ |
639 | bfd_boolean (*notice) |
678 | bfd_boolean (*notice) |
640 | (struct bfd_link_info *, struct bfd_link_hash_entry *h, |
679 | (struct bfd_link_info *, struct bfd_link_hash_entry *h, |
- | 680 | struct bfd_link_hash_entry *inh, |
|
641 | bfd *abfd, asection *section, bfd_vma address, flagword flags, |
681 | bfd *abfd, asection *section, bfd_vma address, flagword flags); |
642 | const char *string); |
- | |
643 | /* Error or warning link info message. */ |
682 | /* Error or warning link info message. */ |
644 | void (*einfo) |
683 | void (*einfo) |
645 | (const char *fmt, ...); |
684 | (const char *fmt, ...); |
646 | /* General link info message. */ |
685 | /* General link info message. */ |
647 | void (*info) |
686 | void (*info) |