Changeset 609 for branches/GNU/src/binutils/include/bfdlink.h
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/include/bfdlink.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* bfdlink.h -- header file for BFD link routines 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 3 3 Free Software Foundation, Inc. 4 4 Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support. 5 5 6 This file is part of BFD, the Binary File Descriptor library.7 8 This program is free software; you can redistribute it and/or modify9 it under the terms of the GNU General Public License as published by10 the Free Software Foundation; either version 2 of the License, or11 (at your option) any later version.12 13 This program is distributed in the hope that it will be useful,14 but WITHOUT ANY WARRANTY; without even the implied warranty of15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 GNU General Public License for more details.17 18 You should have received a copy of the GNU General Public License19 along with this program; if not, write to the Free Software20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */6 This file is part of BFD, the Binary File Descriptor library. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 21 21 22 22 #ifndef BFDLINK_H … … 36 36 enum bfd_link_discard 37 37 { 38 discard_sec_merge, /* Discard local temporary symbols in SEC_MERGE 39 sections. */ 38 40 discard_none, /* Don't discard any locals. */ 39 41 discard_l, /* Discard local temporary symbols. */ 40 42 discard_all /* Discard all locals. */ 41 43 }; 44 45 /* Describes the type of hash table entry structure being used. 46 Different hash table structure have different fields and so 47 support different linking features. */ 48 enum bfd_link_hash_table_type 49 { 50 bfd_link_generic_hash_table, 51 bfd_link_elf_hash_table 52 }; 42 53 43 54 … … 55 66 bfd_link_hash_indirect, /* Symbol is an indirect link. */ 56 67 bfd_link_hash_warning /* Like indirect, but warn if referenced. */ 68 }; 69 70 enum bfd_link_common_skip_ar_aymbols 71 { 72 bfd_link_common_skip_none, 73 bfd_link_common_skip_text, 74 bfd_link_common_skip_data, 75 bfd_link_common_skip_all 57 76 }; 58 77 … … 111 130 { 112 131 /* The linker needs to know three things about common 113 114 115 116 117 118 119 120 132 symbols: the size, the alignment, and the section in 133 which the symbol should be placed. We store the size 134 here, and we allocate a small structure to hold the 135 section and the alignment. The alignment is stored as a 136 power of two. We don't store all the information 137 directly because we don't want to increase the size of 138 the union; this structure is a major space user in the 139 linker. */ 121 140 bfd_size_type size; /* Common symbol size. */ 122 141 struct bfd_link_hash_common_entry … … 146 165 /* Entries are added to the tail of the undefs list. */ 147 166 struct bfd_link_hash_entry *undefs_tail; 148 }; 149 150 /* Look up an entry in a link hash table. If FOLLOW is true, this 167 /* The type of the link hash table. */ 168 enum bfd_link_hash_table_type type; 169 }; 170 171 /* Look up an entry in a link hash table. If FOLLOW is TRUE, this 151 172 follows bfd_link_hash_indirect and bfd_link_hash_warning links to 152 173 the real symbol. */ 153 174 extern struct bfd_link_hash_entry *bfd_link_hash_lookup 154 PARAMS ((struct bfd_link_hash_table *, const char *, b oolean create,155 b oolean copy,boolean follow));175 PARAMS ((struct bfd_link_hash_table *, const char *, bfd_boolean create, 176 bfd_boolean copy, bfd_boolean follow)); 156 177 157 178 /* Look up an entry in the main linker hash table if the symbol might … … 160 181 161 182 extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup 162 PARAMS ((bfd *, struct bfd_link_info *, const char *, b oolean,boolean,163 b oolean));183 PARAMS ((bfd *, struct bfd_link_info *, const char *, bfd_boolean, 184 bfd_boolean, bfd_boolean)); 164 185 165 186 /* Traverse a link hash table. */ 166 187 extern void bfd_link_hash_traverse 167 188 PARAMS ((struct bfd_link_hash_table *, 168 b oolean (*) (struct bfd_link_hash_entry *, PTR),189 bfd_boolean (*) (struct bfd_link_hash_entry *, PTR), 169 190 PTR)); 170 191 … … 173 194 PARAMS ((struct bfd_link_hash_table *, struct bfd_link_hash_entry *)); 174 195 196 struct bfd_sym_chain 197 { 198 struct bfd_sym_chain *next; 199 const char *name; 200 }; 201 175 202 176 203 /* This structure holds all the information needed to communicate … … 179 206 struct bfd_link_info 180 207 { 181 /* Function callbacks. */ 182 const struct bfd_link_callbacks *callbacks; 183 /* true if BFD should generate a relocateable object file. */ 184 boolean relocateable; 185 /* true if BFD should generate relocation information in the final executable. */ 186 boolean emitrelocations; 187 /* true if BFD should generate a "task linked" object file, 188 similar to relocatable but also with globals converted to statics. */ 189 boolean task_link; 190 /* true if BFD should generate a shared object. */ 191 boolean shared; 192 /* true if BFD should pre-bind symbols in a shared object. */ 193 boolean symbolic; 194 /* true if shared objects should be linked directly, not shared. */ 195 boolean static_link; 196 /* true if the output file should be in a traditional format. This 208 /* TRUE if BFD should generate a relocatable object file. */ 209 unsigned int relocateable: 1; 210 211 /* TRUE if BFD should generate relocation information in the final 212 executable. */ 213 unsigned int emitrelocations: 1; 214 215 /* TRUE if BFD should generate a "task linked" object file, 216 similar to relocatable but also with globals converted to 217 statics. */ 218 unsigned int task_link: 1; 219 220 /* TRUE if BFD should generate a shared object. */ 221 unsigned int shared: 1; 222 223 /* TRUE if BFD should pre-bind symbols in a shared object. */ 224 unsigned int symbolic: 1; 225 226 /* TRUE if BFD should export all symbols in the dynamic symbol table 227 of an executable, rather than only those used. */ 228 unsigned int export_dynamic: 1; 229 230 /* TRUE if shared objects should be linked directly, not shared. */ 231 unsigned int static_link: 1; 232 233 /* TRUE if the output file should be in a traditional format. This 197 234 is equivalent to the setting of the BFD_TRADITIONAL_FORMAT flag 198 235 on the output file, but may be checked when reading the input 199 236 files. */ 200 boolean traditional_format; 201 /* true if we want to produced optimized output files. This might 237 unsigned int traditional_format: 1; 238 239 /* TRUE if we want to produced optimized output files. This might 202 240 need much more time and therefore must be explicitly selected. */ 203 boolean optimize; 204 /* true if BFD should generate errors for undefined symbols 241 unsigned int optimize: 1; 242 243 /* TRUE if BFD should generate errors for undefined symbols 205 244 even if generating a shared object. */ 206 boolean no_undefined; 207 /* true if BFD should allow undefined symbols in shared objects even 245 unsigned int no_undefined: 1; 246 247 /* TRUE if BFD should allow undefined symbols in shared objects even 208 248 when no_undefined is set to disallow undefined symbols. The net 209 249 result will be that undefined symbols in regular objects will … … 217 257 select an appropriate memset function. Apparently it is also 218 258 normal for HPPA shared libraries to have undefined symbols. */ 219 boolean allow_shlib_undefined; 259 unsigned int allow_shlib_undefined: 1; 260 261 /* TRUE if ok to have multiple definition. */ 262 unsigned int allow_multiple_definition: 1; 263 264 /* TRUE if ok to have version with no definition. */ 265 unsigned int allow_undefined_version: 1; 266 267 /* TRUE if symbols should be retained in memory, FALSE if they 268 should be freed and reread. */ 269 unsigned int keep_memory: 1; 270 271 /* TRUE if every symbol should be reported back via the notice 272 callback. */ 273 unsigned int notice_all: 1; 274 275 /* TRUE if executable should not contain copy relocs. 276 Setting this true may result in a non-sharable text segment. */ 277 unsigned int nocopyreloc: 1; 278 279 /* TRUE if the new ELF dynamic tags are enabled. */ 280 unsigned int new_dtags: 1; 281 282 /* TRUE if non-PLT relocs should be merged into one reloc section 283 and sorted so that relocs against the same symbol come together. */ 284 unsigned int combreloc: 1; 285 286 /* TRUE if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment 287 should be created. */ 288 unsigned int eh_frame_hdr: 1; 289 290 /* TRUE if global symbols in discarded sections should be stripped. */ 291 unsigned int strip_discarded: 1; 292 293 /* TRUE if relaxation is being finalized. */ 294 unsigned int relax_finalizing: 1; 295 220 296 /* Which symbols to strip. */ 221 297 enum bfd_link_strip strip; 298 222 299 /* Which local symbols to discard. */ 223 300 enum bfd_link_discard discard; 224 /* true if symbols should be retained in memory, false if they 225 should be freed and reread. */ 226 boolean keep_memory; 301 302 /* Criteria for skipping symbols when detemining 303 whether to include an object from an archive. */ 304 enum bfd_link_common_skip_ar_aymbols common_skip_ar_aymbols; 305 306 /* Function callbacks. */ 307 const struct bfd_link_callbacks *callbacks; 308 309 /* Hash table handled by BFD. */ 310 struct bfd_link_hash_table *hash; 311 312 /* Hash table of symbols to keep. This is NULL unless strip is 313 strip_some. */ 314 struct bfd_hash_table *keep_hash; 315 316 /* Hash table of symbols to report back via the notice callback. If 317 this is NULL, and notice_all is FALSE, then no symbols are 318 reported back. */ 319 struct bfd_hash_table *notice_hash; 320 321 /* Hash table of symbols which are being wrapped (the --wrap linker 322 option). If this is NULL, no symbols are being wrapped. */ 323 struct bfd_hash_table *wrap_hash; 324 227 325 /* The list of input BFD's involved in the link. These are chained 228 326 together via the link_next field. */ 229 327 bfd *input_bfds; 328 230 329 /* If a symbol should be created for each input BFD, this is section 231 330 where those symbols should be placed. It must be a section in … … 234 333 linker command language. */ 235 334 asection *create_object_symbols_section; 236 /* Hash table handled by BFD. */ 237 struct bfd_link_hash_table *hash; 238 /* Hash table of symbols to keep. This is NULL unless strip is 239 strip_some. */ 240 struct bfd_hash_table *keep_hash; 241 /* true if every symbol should be reported back via the notice 242 callback. */ 243 boolean notice_all; 244 /* Hash table of symbols to report back via the notice callback. If 245 this is NULL, and notice_all is false, then no symbols are 246 reported back. */ 247 struct bfd_hash_table *notice_hash; 248 /* Hash table of symbols which are being wrapped (the --wrap linker 249 option). If this is NULL, no symbols are being wrapped. */ 250 struct bfd_hash_table *wrap_hash; 335 336 /* List of global symbol names that are starting points for marking 337 sections against garbage collection. */ 338 struct bfd_sym_chain *gc_sym_list; 339 251 340 /* If a base output file is wanted, then this points to it */ 252 341 PTR base_file; 253 254 /* If non-zero, specifies that branches which are problematic for the255 MPC860 C0 (or earlier) should be checked for and modified. It gives the256 number of bytes that should be checked at the end of each text page. */257 int mpc860c0;258 342 259 343 /* The function to call when the executable or shared object is 260 344 loaded. */ 261 345 const char *init_function; 346 262 347 /* The function to call when the executable or shared object is 263 348 unloaded. */ 264 349 const char *fini_function; 265 350 266 /* true if the new ELF dynamic tags are enabled. */ 267 boolean new_dtags; 351 /* If non-zero, specifies that branches which are problematic for the 352 MPC860 C0 (or earlier) should be checked for and modified. It gives the 353 number of bytes that should be checked at the end of each text page. */ 354 int mpc860c0; 355 356 /* Non-zero if auto-import thunks for DATA items in pei386 DLLs 357 should be generated/linked against. Set to 1 if this feature 358 is explicitly requested by the user, -1 if enabled by default. */ 359 int pei386_auto_import; 360 361 /* Non-zero if runtime relocs for DATA items with non-zero addends 362 in pei386 DLLs should be generated. Set to 1 if this feature 363 is explicitly requested by the user, -1 if enabled by default. */ 364 int pei386_runtime_pseudo_reloc; 365 366 /* How many spare .dynamic DT_NULL entries should be added? */ 367 unsigned int spare_dynamic_tags; 268 368 269 369 /* May be used to set DT_FLAGS for ELF. */ … … 277 377 called by the BFD linker routines. The first argument to each 278 378 callback function is the bfd_link_info structure being used. Each 279 function returns a boolean value. If the function returns false,379 function returns a boolean value. If the function returns FALSE, 280 380 then the BFD function which called it will return with a failure 281 381 indication. */ … … 287 387 name of the symbol which caused the archive element to be pulled 288 388 in. */ 289 boolean (*add_archive_element) PARAMS ((struct bfd_link_info *, 290 bfd *abfd, 291 const char *name)); 389 bfd_boolean (*add_archive_element) 390 PARAMS ((struct bfd_link_info *, bfd *abfd, const char *name)); 292 391 /* A function which is called when a symbol is found with multiple 293 392 definitions. NAME is the symbol which is defined multiple times. … … 296 395 the new value. OBFD may be NULL. OSEC and NSEC may be 297 396 bfd_com_section or bfd_ind_section. */ 298 boolean (*multiple_definition) PARAMS ((struct bfd_link_info *, 299 const char *name, 300 bfd *obfd, 301 asection *osec, 302 bfd_vma oval, 303 bfd *nbfd, 304 asection *nsec, 305 bfd_vma nval)); 397 bfd_boolean (*multiple_definition) 398 PARAMS ((struct bfd_link_info *, const char *name, 399 bfd *obfd, asection *osec, bfd_vma oval, 400 bfd *nbfd, asection *nsec, bfd_vma nval)); 306 401 /* A function which is called when a common symbol is defined 307 402 multiple times. NAME is the symbol appearing multiple times. … … 315 410 bfd_link_hash_indirect. If NTYPE is bfd_link_hash_common, NSIZE 316 411 is the size of the new symbol. */ 317 boolean (*multiple_common) PARAMS ((struct bfd_link_info *, 318 const char *name, 319 bfd *obfd, 320 enum bfd_link_hash_type otype, 321 bfd_vma osize, 322 bfd *nbfd, 323 enum bfd_link_hash_type ntype, 324 bfd_vma nsize)); 412 bfd_boolean (*multiple_common) 413 PARAMS ((struct bfd_link_info *, const char *name, 414 bfd *obfd, enum bfd_link_hash_type otype, bfd_vma osize, 415 bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize)); 325 416 /* A function which is called to add a symbol to a set. ENTRY is 326 417 the link hash table entry for the set itself (e.g., … … 329 420 get the size of the entry when generating an executable file. 330 421 ABFD, SEC and VALUE identify the value to add to the set. */ 331 b oolean (*add_to_set) PARAMS ((struct bfd_link_info *,332 333 bfd_reloc_code_real_type reloc,334 bfd *abfd, asection *sec,bfd_vma value));422 bfd_boolean (*add_to_set) 423 PARAMS ((struct bfd_link_info *, struct bfd_link_hash_entry *entry, 424 bfd_reloc_code_real_type reloc, bfd *abfd, asection *sec, 425 bfd_vma value)); 335 426 /* A function which is called when the name of a g++ constructor or 336 427 destructor is found. This is only called by some object file 337 formats. CONSTRUCTOR is true for a constructor, falsefor a428 formats. CONSTRUCTOR is TRUE for a constructor, FALSE for a 338 429 destructor. This will use BFD_RELOC_CTOR when generating a 339 430 relocateable file. NAME is the name of the symbol found. ABFD, 340 431 SECTION and VALUE are the value of the symbol. */ 341 boolean (*constructor) PARAMS ((struct bfd_link_info *, 342 boolean constructor, 343 const char *name, bfd *abfd, asection *sec, 344 bfd_vma value)); 432 bfd_boolean (*constructor) 433 PARAMS ((struct bfd_link_info *, bfd_boolean constructor, 434 const char *name, bfd *abfd, asection *sec, bfd_vma value)); 345 435 /* A function which is called to issue a linker warning. For 346 436 example, this is called when there is a reference to a warning … … 350 440 which trigerred the warning; either ABFD or SECTION or both may 351 441 be NULL if the location is not known. */ 352 boolean (*warning) PARAMS ((struct bfd_link_info *, 353 const char *warning, const char *symbol, 354 bfd *abfd, asection *section, 355 bfd_vma address)); 442 bfd_boolean (*warning) 443 PARAMS ((struct bfd_link_info *, const char *warning, const char *symbol, 444 bfd *abfd, asection *section, bfd_vma address)); 356 445 /* A function which is called when a relocation is attempted against 357 446 an undefined symbol. NAME is the symbol which is undefined. … … 359 448 reference is made. FATAL indicates whether an undefined symbol is 360 449 a fatal error or not. In some cases SECTION may be NULL. */ 361 boolean (*undefined_symbol) PARAMS ((struct bfd_link_info *, 362 const char *name, bfd *abfd, 363 asection *section, 364 bfd_vma address, 365 boolean fatal)); 450 bfd_boolean (*undefined_symbol) 451 PARAMS ((struct bfd_link_info *, const char *name, bfd *abfd, 452 asection *section, bfd_vma address, bfd_boolean fatal)); 366 453 /* A function which is called when a reloc overflow occurs. NAME is 367 454 the name of the symbol or section the reloc is against, … … 371 458 bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then 372 459 ABFD will be NULL. */ 373 boolean (*reloc_overflow) PARAMS ((struct bfd_link_info *, 374 const char *name, 375 const char *reloc_name, bfd_vma addend, 376 bfd *abfd, asection *section, 377 bfd_vma address)); 460 bfd_boolean (*reloc_overflow) 461 PARAMS ((struct bfd_link_info *, const char *name, const char *reloc_name, 462 bfd_vma addend, bfd *abfd, asection *section, bfd_vma address)); 378 463 /* A function which is called when a dangerous reloc is performed. 379 464 The canonical example is an a29k IHCONST reloc which does not … … 383 468 bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then 384 469 ABFD will be NULL. */ 385 boolean (*reloc_dangerous) PARAMS ((struct bfd_link_info *, 386 const char *message, 387 bfd *abfd, asection *section, 388 bfd_vma address)); 470 bfd_boolean (*reloc_dangerous) 471 PARAMS ((struct bfd_link_info *, const char *message, 472 bfd *abfd, asection *section, bfd_vma address)); 389 473 /* A function which is called when a reloc is found to be attached 390 474 to a symbol which is not being written out. NAME is the name of … … 393 477 bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then 394 478 ABFD will be NULL. */ 395 boolean (*unattached_reloc) PARAMS ((struct bfd_link_info *, 396 const char *name, 397 bfd *abfd, asection *section, 398 bfd_vma address)); 479 bfd_boolean (*unattached_reloc) 480 PARAMS ((struct bfd_link_info *, const char *name, 481 bfd *abfd, asection *section, bfd_vma address)); 399 482 /* A function which is called when a symbol in notice_hash is 400 483 defined or referenced. NAME is the symbol. ABFD, SECTION and 401 484 ADDRESS are the value of the symbol. If SECTION is 402 485 bfd_und_section, this is a reference. */ 403 boolean (*notice) PARAMS ((struct bfd_link_info *, const char *name, 404 bfd *abfd, asection *section, bfd_vma address)); 486 bfd_boolean (*notice) 487 PARAMS ((struct bfd_link_info *, const char *name, 488 bfd *abfd, asection *section, bfd_vma address)); 489 /* A function which is called for reporting a linker error. ID is the 490 error identifier. The remaining input is the same as einfo () in 491 ld. */ 492 bfd_boolean (*error_handler) 493 PARAMS ((int id, const char * fmt, ...)); 405 494 }; 406 495 … … 415 504 bfd_undefined_link_order, /* Undefined. */ 416 505 bfd_indirect_link_order, /* Built from a section. */ 417 bfd_fill_link_order, /* Fill with a 16 bit constant. */418 506 bfd_data_link_order, /* Set to explicit data. */ 419 507 bfd_section_reloc_link_order, /* Relocate against a section. */ … … 424 512 attached to the section whose contents they are describing. */ 425 513 426 struct bfd_link_order 514 struct bfd_link_order 427 515 { 428 516 /* Next link_order in chain. */ … … 431 519 enum bfd_link_order_type type; 432 520 /* Offset within output section. */ 433 bfd_vma offset; 521 bfd_vma offset; 434 522 /* Size within output section. */ 435 523 bfd_size_type size; 436 524 /* Type specific information. */ 437 union 525 union 438 526 { 439 struct 527 struct 440 528 { 441 529 /* Section to include. If this is used, then … … 449 537 struct 450 538 { 451 /* Value to fill with. */ 452 unsigned int value; 453 } fill; 454 struct 455 { 456 /* Data to put into file. The size field gives the number 457 of bytes which this field points to. */ 539 /* Size of contents, or zero when contents size == size 540 within output section. 541 A non-zero value allows filling of the output section 542 with an arbitrary repeated pattern. */ 543 unsigned int size; 544 /* Data to put into file. */ 458 545 bfd_byte *contents; 459 546 } data; … … 521 608 const char *pattern; 522 609 /* Matching function. */ 523 int (*match) PARAMS((struct bfd_elf_version_expr *, const char *)); 610 int (*match) PARAMS ((struct bfd_elf_version_expr *, const char *)); 611 /* Defined by ".symver". */ 612 unsigned int symver: 1; 613 /* Defined by version script. */ 614 unsigned int script : 1; 524 615 }; 525 616 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.