| 1 | /* BFD back-end data structures for ELF files.
|
|---|
| 2 | Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
|---|
| 3 | 2002, 2003 Free Software Foundation, Inc.
|
|---|
| 4 | Written by Cygnus Support.
|
|---|
| 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 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 |
|
|---|
| 22 | #ifndef _LIBELF_H_
|
|---|
| 23 | #define _LIBELF_H_ 1
|
|---|
| 24 |
|
|---|
| 25 | #include "elf/common.h"
|
|---|
| 26 | #include "elf/internal.h"
|
|---|
| 27 | #include "elf/external.h"
|
|---|
| 28 | #include "bfdlink.h"
|
|---|
| 29 |
|
|---|
| 30 | /* The number of entries in a section is its size divided by the size
|
|---|
| 31 | of a single entry. This is normally only applicable to reloc and
|
|---|
| 32 | symbol table sections. */
|
|---|
| 33 | #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
|
|---|
| 34 |
|
|---|
| 35 | /* If size isn't specified as 64 or 32, NAME macro should fail. */
|
|---|
| 36 | /* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
|---|
| 37 | remove whitespace added here, and thus will fail to concatenate
|
|---|
| 38 | the tokens. */
|
|---|
| 39 | #ifndef NAME
|
|---|
| 40 | #if ARCH_SIZE==64
|
|---|
| 41 | #define NAME(x,y) CONCAT4 (x,64,_,y)
|
|---|
| 42 | #endif
|
|---|
| 43 | #if ARCH_SIZE==32
|
|---|
| 44 | #define NAME(x,y) CONCAT4 (x,32,_,y)
|
|---|
| 45 | #endif
|
|---|
| 46 | #endif
|
|---|
| 47 |
|
|---|
| 48 | #ifndef NAME
|
|---|
| 49 | #define NAME(x,y) CONCAT4 (x,NOSIZE,_,y)
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
| 52 | #define ElfNAME(X) NAME(Elf,X)
|
|---|
| 53 | #define elfNAME(X) NAME(elf,X)
|
|---|
| 54 |
|
|---|
| 55 | /* Information held for an ELF symbol. The first field is the
|
|---|
| 56 | corresponding asymbol. Every symbol is an ELF file is actually a
|
|---|
| 57 | pointer to this structure, although it is often handled as a
|
|---|
| 58 | pointer to an asymbol. */
|
|---|
| 59 |
|
|---|
| 60 | typedef struct
|
|---|
| 61 | {
|
|---|
| 62 | /* The BFD symbol. */
|
|---|
| 63 | asymbol symbol;
|
|---|
| 64 | /* ELF symbol information. */
|
|---|
| 65 | Elf_Internal_Sym internal_elf_sym;
|
|---|
| 66 | /* Backend specific information. */
|
|---|
| 67 | union
|
|---|
| 68 | {
|
|---|
| 69 | unsigned int hppa_arg_reloc;
|
|---|
| 70 | PTR mips_extr;
|
|---|
| 71 | PTR any;
|
|---|
| 72 | }
|
|---|
| 73 | tc_data;
|
|---|
| 74 |
|
|---|
| 75 | /* Version information. This is from an Elf_Internal_Versym
|
|---|
| 76 | structure in a SHT_GNU_versym section. It is zero if there is no
|
|---|
| 77 | version information. */
|
|---|
| 78 | unsigned short version;
|
|---|
| 79 |
|
|---|
| 80 | } elf_symbol_type;
|
|---|
| 81 | |
|---|
| 82 |
|
|---|
| 83 | struct elf_strtab_hash;
|
|---|
| 84 | struct got_entry;
|
|---|
| 85 | struct plt_entry;
|
|---|
| 86 |
|
|---|
| 87 | /* ELF linker hash table entries. */
|
|---|
| 88 |
|
|---|
| 89 | struct elf_link_hash_entry
|
|---|
| 90 | {
|
|---|
| 91 | struct bfd_link_hash_entry root;
|
|---|
| 92 |
|
|---|
| 93 | /* Symbol index in output file. This is initialized to -1. It is
|
|---|
| 94 | set to -2 if the symbol is used by a reloc. */
|
|---|
| 95 | long indx;
|
|---|
| 96 |
|
|---|
| 97 | /* Symbol index as a dynamic symbol. Initialized to -1, and remains
|
|---|
| 98 | -1 if this is not a dynamic symbol. */
|
|---|
| 99 | /* ??? Note that this is consistently used as a synonym for tests
|
|---|
| 100 | against whether we can perform various simplifying transformations
|
|---|
| 101 | to the code. (E.g. changing a pc-relative jump to a PLT entry
|
|---|
| 102 | into a pc-relative jump to the target function.) That test, which
|
|---|
| 103 | is often relatively complex, and someplaces wrong or incomplete,
|
|---|
| 104 | should really be replaced by a predicate in elflink.c.
|
|---|
| 105 |
|
|---|
| 106 | End result: this field -1 does not indicate that the symbol is
|
|---|
| 107 | not in the dynamic symbol table, but rather that the symbol is
|
|---|
| 108 | not visible outside this DSO. */
|
|---|
| 109 | long dynindx;
|
|---|
| 110 |
|
|---|
| 111 | /* String table index in .dynstr if this is a dynamic symbol. */
|
|---|
| 112 | unsigned long dynstr_index;
|
|---|
| 113 |
|
|---|
| 114 | /* Hash value of the name computed using the ELF hash function. */
|
|---|
| 115 | unsigned long elf_hash_value;
|
|---|
| 116 |
|
|---|
| 117 | /* If this is a weak defined symbol from a dynamic object, this
|
|---|
| 118 | field points to a defined symbol with the same value, if there is
|
|---|
| 119 | one. Otherwise it is NULL. */
|
|---|
| 120 | struct elf_link_hash_entry *weakdef;
|
|---|
| 121 |
|
|---|
| 122 | /* If this symbol is used in the linker created sections, the processor
|
|---|
| 123 | specific backend uses this field to map the field into the offset
|
|---|
| 124 | from the beginning of the section. */
|
|---|
| 125 | struct elf_linker_section_pointers *linker_section_pointer;
|
|---|
| 126 |
|
|---|
| 127 | /* Version information. */
|
|---|
| 128 | union
|
|---|
| 129 | {
|
|---|
| 130 | /* This field is used for a symbol which is not defined in a
|
|---|
| 131 | regular object. It points to the version information read in
|
|---|
| 132 | from the dynamic object. */
|
|---|
| 133 | Elf_Internal_Verdef *verdef;
|
|---|
| 134 | /* This field is used for a symbol which is defined in a regular
|
|---|
| 135 | object. It is set up in size_dynamic_sections. It points to
|
|---|
| 136 | the version information we should write out for this symbol. */
|
|---|
| 137 | struct bfd_elf_version_tree *vertree;
|
|---|
| 138 | } verinfo;
|
|---|
| 139 |
|
|---|
| 140 | /* Virtual table entry use information. This array is nominally of size
|
|---|
| 141 | size/sizeof(target_void_pointer), though we have to be able to assume
|
|---|
| 142 | and track a size while the symbol is still undefined. It is indexed
|
|---|
| 143 | via offset/sizeof(target_void_pointer). */
|
|---|
| 144 | size_t vtable_entries_size;
|
|---|
| 145 | bfd_boolean *vtable_entries_used;
|
|---|
| 146 |
|
|---|
| 147 | /* Virtual table derivation info. */
|
|---|
| 148 | struct elf_link_hash_entry *vtable_parent;
|
|---|
| 149 |
|
|---|
| 150 | /* If this symbol requires an entry in the global offset table, the
|
|---|
| 151 | processor specific backend uses this field to track usage and
|
|---|
| 152 | final offset. Two schemes are supported: The first assumes that
|
|---|
| 153 | a symbol may only have one GOT entry, and uses REFCOUNT until
|
|---|
| 154 | size_dynamic_sections, at which point the contents of the .got is
|
|---|
| 155 | fixed. Afterward, if OFFSET is -1, then the symbol does not
|
|---|
| 156 | require a global offset table entry. The second scheme allows
|
|---|
| 157 | multiple GOT entries per symbol, managed via a linked list
|
|---|
| 158 | pointed to by GLIST. */
|
|---|
| 159 | union gotplt_union
|
|---|
| 160 | {
|
|---|
| 161 | bfd_signed_vma refcount;
|
|---|
| 162 | bfd_vma offset;
|
|---|
| 163 | struct got_entry *glist;
|
|---|
| 164 | struct plt_entry *plist;
|
|---|
| 165 | } got;
|
|---|
| 166 |
|
|---|
| 167 | /* Same, but tracks a procedure linkage table entry. */
|
|---|
| 168 | union gotplt_union plt;
|
|---|
| 169 |
|
|---|
| 170 | /* Symbol size. */
|
|---|
| 171 | bfd_size_type size;
|
|---|
| 172 |
|
|---|
| 173 | /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
|
|---|
| 174 | char type;
|
|---|
| 175 |
|
|---|
| 176 | /* Symbol st_other value, symbol visibility. */
|
|---|
| 177 | unsigned char other;
|
|---|
| 178 |
|
|---|
| 179 | /* Some flags; legal values follow. */
|
|---|
| 180 | unsigned short elf_link_hash_flags;
|
|---|
| 181 | /* Symbol is referenced by a non-shared object. */
|
|---|
| 182 | #define ELF_LINK_HASH_REF_REGULAR 01
|
|---|
| 183 | /* Symbol is defined by a non-shared object. */
|
|---|
| 184 | #define ELF_LINK_HASH_DEF_REGULAR 02
|
|---|
| 185 | /* Symbol is referenced by a shared object. */
|
|---|
| 186 | #define ELF_LINK_HASH_REF_DYNAMIC 04
|
|---|
| 187 | /* Symbol is defined by a shared object. */
|
|---|
| 188 | #define ELF_LINK_HASH_DEF_DYNAMIC 010
|
|---|
| 189 | /* Symbol has a non-weak reference from a non-shared object. */
|
|---|
| 190 | #define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
|
|---|
| 191 | /* Dynamic symbol has been adjustd. */
|
|---|
| 192 | #define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
|
|---|
| 193 | /* Symbol needs a copy reloc. */
|
|---|
| 194 | #define ELF_LINK_HASH_NEEDS_COPY 0100
|
|---|
| 195 | /* Symbol needs a procedure linkage table entry. */
|
|---|
| 196 | #define ELF_LINK_HASH_NEEDS_PLT 0200
|
|---|
| 197 | /* Symbol appears in a non-ELF input file. */
|
|---|
| 198 | #define ELF_LINK_NON_ELF 0400
|
|---|
| 199 | /* Symbol should be marked as hidden in the version information. */
|
|---|
| 200 | #define ELF_LINK_HIDDEN 01000
|
|---|
| 201 | /* Symbol was forced to local scope due to a version script file. */
|
|---|
| 202 | #define ELF_LINK_FORCED_LOCAL 02000
|
|---|
| 203 | /* Symbol was marked during garbage collection. */
|
|---|
| 204 | #define ELF_LINK_HASH_MARK 04000
|
|---|
| 205 | /* Symbol is referenced by a non-GOT/non-PLT relocation. This is
|
|---|
| 206 | not currently set by all the backends. */
|
|---|
| 207 | #define ELF_LINK_NON_GOT_REF 010000
|
|---|
| 208 | /* Symbol has a definition in a shared object. */
|
|---|
| 209 | #define ELF_LINK_DYNAMIC_DEF 020000
|
|---|
| 210 | /* Symbol is weak in all shared objects. */
|
|---|
| 211 | #define ELF_LINK_DYNAMIC_WEAK 040000
|
|---|
| 212 | };
|
|---|
| 213 |
|
|---|
| 214 | /* Records local symbols to be emitted in the dynamic symbol table. */
|
|---|
| 215 |
|
|---|
| 216 | struct elf_link_local_dynamic_entry
|
|---|
| 217 | {
|
|---|
| 218 | struct elf_link_local_dynamic_entry *next;
|
|---|
| 219 |
|
|---|
| 220 | /* The input bfd this symbol came from. */
|
|---|
| 221 | bfd *input_bfd;
|
|---|
| 222 |
|
|---|
| 223 | /* The index of the local symbol being copied. */
|
|---|
| 224 | long input_indx;
|
|---|
| 225 |
|
|---|
| 226 | /* The index in the outgoing dynamic symbol table. */
|
|---|
| 227 | long dynindx;
|
|---|
| 228 |
|
|---|
| 229 | /* A copy of the input symbol. */
|
|---|
| 230 | Elf_Internal_Sym isym;
|
|---|
| 231 | };
|
|---|
| 232 |
|
|---|
| 233 | struct elf_link_loaded_list
|
|---|
| 234 | {
|
|---|
| 235 | struct elf_link_loaded_list *next;
|
|---|
| 236 | bfd *abfd;
|
|---|
| 237 | };
|
|---|
| 238 |
|
|---|
| 239 | /* Structures used by the eh_frame optimization code. */
|
|---|
| 240 | struct cie_header
|
|---|
| 241 | {
|
|---|
| 242 | unsigned int length;
|
|---|
| 243 | unsigned int id;
|
|---|
| 244 | };
|
|---|
| 245 |
|
|---|
| 246 | struct cie
|
|---|
| 247 | {
|
|---|
| 248 | struct cie_header hdr;
|
|---|
| 249 | unsigned char version;
|
|---|
| 250 | unsigned char augmentation[20];
|
|---|
| 251 | unsigned int code_align;
|
|---|
| 252 | int data_align;
|
|---|
| 253 | unsigned int ra_column;
|
|---|
| 254 | unsigned int augmentation_size;
|
|---|
| 255 | struct elf_link_hash_entry *personality;
|
|---|
| 256 | unsigned char per_encoding;
|
|---|
| 257 | unsigned char lsda_encoding;
|
|---|
| 258 | unsigned char fde_encoding;
|
|---|
| 259 | unsigned char initial_insn_length;
|
|---|
| 260 | unsigned char make_relative;
|
|---|
| 261 | unsigned char make_lsda_relative;
|
|---|
| 262 | unsigned char initial_instructions[50];
|
|---|
| 263 | };
|
|---|
| 264 |
|
|---|
| 265 | struct eh_cie_fde
|
|---|
| 266 | {
|
|---|
| 267 | unsigned int offset;
|
|---|
| 268 | unsigned int size;
|
|---|
| 269 | asection *sec;
|
|---|
| 270 | unsigned int new_offset;
|
|---|
| 271 | unsigned char fde_encoding;
|
|---|
| 272 | unsigned char lsda_encoding;
|
|---|
| 273 | unsigned char lsda_offset;
|
|---|
| 274 | unsigned char cie : 1;
|
|---|
| 275 | unsigned char removed : 1;
|
|---|
| 276 | unsigned char make_relative : 1;
|
|---|
| 277 | unsigned char make_lsda_relative : 1;
|
|---|
| 278 | unsigned char per_encoding_relative : 1;
|
|---|
| 279 | };
|
|---|
| 280 |
|
|---|
| 281 | struct eh_frame_sec_info
|
|---|
| 282 | {
|
|---|
| 283 | unsigned int count;
|
|---|
| 284 | unsigned int alloced;
|
|---|
| 285 | struct eh_cie_fde entry[1];
|
|---|
| 286 | };
|
|---|
| 287 |
|
|---|
| 288 | struct eh_frame_array_ent
|
|---|
| 289 | {
|
|---|
| 290 | bfd_vma initial_loc;
|
|---|
| 291 | bfd_vma fde;
|
|---|
| 292 | };
|
|---|
| 293 |
|
|---|
| 294 | struct eh_frame_hdr_info
|
|---|
| 295 | {
|
|---|
| 296 | struct cie last_cie;
|
|---|
| 297 | asection *last_cie_sec;
|
|---|
| 298 | asection *hdr_sec;
|
|---|
| 299 | unsigned int last_cie_offset;
|
|---|
| 300 | unsigned int fde_count, array_count;
|
|---|
| 301 | struct eh_frame_array_ent *array;
|
|---|
| 302 | /* TRUE if .eh_frame_hdr should contain the sorted search table.
|
|---|
| 303 | We build it if we successfully read all .eh_frame input sections
|
|---|
| 304 | and recognize them. */
|
|---|
| 305 | bfd_boolean table;
|
|---|
| 306 | };
|
|---|
| 307 |
|
|---|
| 308 | /* Cached start, size and alignment of PT_TLS segment. */
|
|---|
| 309 | struct elf_link_tls_segment
|
|---|
| 310 | {
|
|---|
| 311 | bfd_vma start;
|
|---|
| 312 | bfd_size_type size;
|
|---|
| 313 | unsigned int align;
|
|---|
| 314 | };
|
|---|
| 315 |
|
|---|
| 316 | /* ELF linker hash table. */
|
|---|
| 317 |
|
|---|
| 318 | struct elf_link_hash_table
|
|---|
| 319 | {
|
|---|
| 320 | struct bfd_link_hash_table root;
|
|---|
| 321 |
|
|---|
| 322 | /* Whether we have created the special dynamic sections required
|
|---|
| 323 | when linking against or generating a shared object. */
|
|---|
| 324 | bfd_boolean dynamic_sections_created;
|
|---|
| 325 |
|
|---|
| 326 | /* The BFD used to hold special sections created by the linker.
|
|---|
| 327 | This will be the first BFD found which requires these sections to
|
|---|
| 328 | be created. */
|
|---|
| 329 | bfd *dynobj;
|
|---|
| 330 |
|
|---|
| 331 | /* The value to use when initialising got.refcount/offset and
|
|---|
| 332 | plt.refcount/offset in an elf_link_hash_entry. Set to zero when
|
|---|
| 333 | the values are refcounts. Set to init_offset in
|
|---|
| 334 | size_dynamic_sections when the values may be offsets. */
|
|---|
| 335 | union gotplt_union init_refcount;
|
|---|
| 336 |
|
|---|
| 337 | /* The value to use for got.refcount/offset and plt.refcount/offset
|
|---|
| 338 | when the values may be offsets. Normally (bfd_vma) -1. */
|
|---|
| 339 | union gotplt_union init_offset;
|
|---|
| 340 |
|
|---|
| 341 | /* The number of symbols found in the link which must be put into
|
|---|
| 342 | the .dynsym section. */
|
|---|
| 343 | bfd_size_type dynsymcount;
|
|---|
| 344 |
|
|---|
| 345 | /* The string table of dynamic symbols, which becomes the .dynstr
|
|---|
| 346 | section. */
|
|---|
| 347 | struct elf_strtab_hash *dynstr;
|
|---|
| 348 |
|
|---|
| 349 | /* The number of buckets in the hash table in the .hash section.
|
|---|
| 350 | This is based on the number of dynamic symbols. */
|
|---|
| 351 | bfd_size_type bucketcount;
|
|---|
| 352 |
|
|---|
| 353 | /* A linked list of DT_NEEDED names found in dynamic objects
|
|---|
| 354 | included in the link. */
|
|---|
| 355 | struct bfd_link_needed_list *needed;
|
|---|
| 356 |
|
|---|
| 357 | /* The _GLOBAL_OFFSET_TABLE_ symbol. */
|
|---|
| 358 | struct elf_link_hash_entry *hgot;
|
|---|
| 359 |
|
|---|
| 360 | /* A pointer to information used to link stabs in sections. */
|
|---|
| 361 | PTR stab_info;
|
|---|
| 362 |
|
|---|
| 363 | /* A pointer to information used to merge SEC_MERGE sections. */
|
|---|
| 364 | PTR merge_info;
|
|---|
| 365 |
|
|---|
| 366 | /* Used by eh_frame code when editing .eh_frame. */
|
|---|
| 367 | struct eh_frame_hdr_info eh_info;
|
|---|
| 368 |
|
|---|
| 369 | /* A linked list of local symbols to be added to .dynsym. */
|
|---|
| 370 | struct elf_link_local_dynamic_entry *dynlocal;
|
|---|
| 371 |
|
|---|
| 372 | /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
|
|---|
| 373 | objects included in the link. */
|
|---|
| 374 | struct bfd_link_needed_list *runpath;
|
|---|
| 375 |
|
|---|
| 376 | /* Cached start, size and alignment of PT_TLS segment. */
|
|---|
| 377 | struct elf_link_tls_segment *tls_segment;
|
|---|
| 378 |
|
|---|
| 379 | /* A linked list of BFD's loaded in the link. */
|
|---|
| 380 | struct elf_link_loaded_list *loaded;
|
|---|
| 381 | };
|
|---|
| 382 |
|
|---|
| 383 | /* Look up an entry in an ELF linker hash table. */
|
|---|
| 384 |
|
|---|
| 385 | #define elf_link_hash_lookup(table, string, create, copy, follow) \
|
|---|
| 386 | ((struct elf_link_hash_entry *) \
|
|---|
| 387 | bfd_link_hash_lookup (&(table)->root, (string), (create), \
|
|---|
| 388 | (copy), (follow)))
|
|---|
| 389 |
|
|---|
| 390 | /* Traverse an ELF linker hash table. */
|
|---|
| 391 |
|
|---|
| 392 | #define elf_link_hash_traverse(table, func, info) \
|
|---|
| 393 | (bfd_link_hash_traverse \
|
|---|
| 394 | (&(table)->root, \
|
|---|
| 395 | (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
|
|---|
| 396 | (info)))
|
|---|
| 397 |
|
|---|
| 398 | /* Get the ELF linker hash table from a link_info structure. */
|
|---|
| 399 |
|
|---|
| 400 | #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
|
|---|
| 401 |
|
|---|
| 402 | /* Returns TRUE if the hash table is a struct elf_link_hash_table. */
|
|---|
| 403 | #define is_elf_hash_table(p) \
|
|---|
| 404 | ((p)->hash->type == bfd_link_elf_hash_table)
|
|---|
| 405 |
|
|---|
| 406 | /* Used by bfd_section_from_r_symndx to cache a small number of local
|
|---|
| 407 | symbol to section mappings. */
|
|---|
| 408 | #define LOCAL_SYM_CACHE_SIZE 32
|
|---|
| 409 | struct sym_sec_cache
|
|---|
| 410 | {
|
|---|
| 411 | bfd *abfd;
|
|---|
| 412 | unsigned long indx[LOCAL_SYM_CACHE_SIZE];
|
|---|
| 413 | asection *sec[LOCAL_SYM_CACHE_SIZE];
|
|---|
| 414 | };
|
|---|
| 415 | |
|---|
| 416 |
|
|---|
| 417 | /* Constant information held for an ELF backend. */
|
|---|
| 418 |
|
|---|
| 419 | struct elf_size_info {
|
|---|
| 420 | unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
|
|---|
| 421 | unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
|
|---|
| 422 |
|
|---|
| 423 | /* The size of entries in the .hash section. */
|
|---|
| 424 | unsigned char sizeof_hash_entry;
|
|---|
| 425 |
|
|---|
| 426 | /* The number of internal relocations to allocate per external
|
|---|
| 427 | relocation entry. */
|
|---|
| 428 | unsigned char int_rels_per_ext_rel;
|
|---|
| 429 | /* We use some fixed size arrays. This should be large enough to
|
|---|
| 430 | handle all back-ends. */
|
|---|
| 431 | #define MAX_INT_RELS_PER_EXT_REL 3
|
|---|
| 432 |
|
|---|
| 433 | unsigned char arch_size, file_align;
|
|---|
| 434 | unsigned char elfclass, ev_current;
|
|---|
| 435 | int (*write_out_phdrs)
|
|---|
| 436 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
|
|---|
| 437 | bfd_boolean (*write_shdrs_and_ehdr)
|
|---|
| 438 | PARAMS ((bfd *));
|
|---|
| 439 | void (*write_relocs)
|
|---|
| 440 | PARAMS ((bfd *, asection *, PTR));
|
|---|
| 441 | void (*swap_symbol_in)
|
|---|
| 442 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
|
|---|
| 443 | void (*swap_symbol_out)
|
|---|
| 444 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
|
|---|
| 445 | bfd_boolean (*slurp_reloc_table)
|
|---|
| 446 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
|
|---|
| 447 | long (*slurp_symbol_table)
|
|---|
| 448 | PARAMS ((bfd *, asymbol **, bfd_boolean));
|
|---|
| 449 | void (*swap_dyn_in)
|
|---|
| 450 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
|---|
| 451 | void (*swap_dyn_out)
|
|---|
| 452 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
|---|
| 453 |
|
|---|
| 454 | /* This function is called to swap in a REL relocation. If an
|
|---|
| 455 | external relocation corresponds to more than one internal
|
|---|
| 456 | relocation, then all relocations are swapped in at once. */
|
|---|
| 457 | void (*swap_reloc_in)
|
|---|
| 458 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 459 |
|
|---|
| 460 | /* This function is called to swap out a REL relocation. */
|
|---|
| 461 | void (*swap_reloc_out)
|
|---|
| 462 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 463 |
|
|---|
| 464 | /* This function is called to swap in a RELA relocation. If an
|
|---|
| 465 | external relocation corresponds to more than one internal
|
|---|
| 466 | relocation, then all relocations are swapped in at once. */
|
|---|
| 467 | void (*swap_reloca_in)
|
|---|
| 468 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 469 |
|
|---|
| 470 | /* This function is called to swap out a RELA relocation. */
|
|---|
| 471 | void (*swap_reloca_out)
|
|---|
| 472 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 473 | };
|
|---|
| 474 |
|
|---|
| 475 | #define elf_symbol_from(ABFD,S) \
|
|---|
| 476 | (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
|
|---|
| 477 | && (S)->the_bfd->tdata.elf_obj_data != 0) \
|
|---|
| 478 | ? (elf_symbol_type *) (S) \
|
|---|
| 479 | : 0)
|
|---|
| 480 |
|
|---|
| 481 | enum elf_reloc_type_class {
|
|---|
| 482 | reloc_class_normal,
|
|---|
| 483 | reloc_class_relative,
|
|---|
| 484 | reloc_class_plt,
|
|---|
| 485 | reloc_class_copy
|
|---|
| 486 | };
|
|---|
| 487 |
|
|---|
| 488 | struct elf_reloc_cookie
|
|---|
| 489 | {
|
|---|
| 490 | Elf_Internal_Rela *rels, *rel, *relend;
|
|---|
| 491 | Elf_Internal_Sym *locsyms;
|
|---|
| 492 | bfd *abfd;
|
|---|
| 493 | size_t locsymcount;
|
|---|
| 494 | size_t extsymoff;
|
|---|
| 495 | struct elf_link_hash_entry **sym_hashes;
|
|---|
| 496 | bfd_boolean bad_symtab;
|
|---|
| 497 | };
|
|---|
| 498 |
|
|---|
| 499 | /* The level of IRIX compatibility we're striving for. */
|
|---|
| 500 |
|
|---|
| 501 | typedef enum {
|
|---|
| 502 | ict_none,
|
|---|
| 503 | ict_irix5,
|
|---|
| 504 | ict_irix6
|
|---|
| 505 | } irix_compat_t;
|
|---|
| 506 |
|
|---|
| 507 | struct elf_backend_data
|
|---|
| 508 | {
|
|---|
| 509 | /* The architecture for this backend. */
|
|---|
| 510 | enum bfd_architecture arch;
|
|---|
| 511 |
|
|---|
| 512 | /* The ELF machine code (EM_xxxx) for this backend. */
|
|---|
| 513 | int elf_machine_code;
|
|---|
| 514 |
|
|---|
| 515 | /* The maximum page size for this backend. */
|
|---|
| 516 | bfd_vma maxpagesize;
|
|---|
| 517 |
|
|---|
| 518 | /* A function to translate an ELF RELA relocation to a BFD arelent
|
|---|
| 519 | structure. */
|
|---|
| 520 | void (*elf_info_to_howto)
|
|---|
| 521 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|---|
| 522 |
|
|---|
| 523 | /* A function to translate an ELF REL relocation to a BFD arelent
|
|---|
| 524 | structure. */
|
|---|
| 525 | void (*elf_info_to_howto_rel)
|
|---|
| 526 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|---|
| 527 |
|
|---|
| 528 | /* A function to determine whether a symbol is global when
|
|---|
| 529 | partitioning the symbol table into local and global symbols.
|
|---|
| 530 | This should be NULL for most targets, in which case the correct
|
|---|
| 531 | thing will be done. MIPS ELF, at least on the Irix 5, has
|
|---|
| 532 | special requirements. */
|
|---|
| 533 | bfd_boolean (*elf_backend_sym_is_global)
|
|---|
| 534 | PARAMS ((bfd *, asymbol *));
|
|---|
| 535 |
|
|---|
| 536 | /* The remaining functions are hooks which are called only if they
|
|---|
| 537 | are not NULL. */
|
|---|
| 538 |
|
|---|
| 539 | /* A function to permit a backend specific check on whether a
|
|---|
| 540 | particular BFD format is relevant for an object file, and to
|
|---|
| 541 | permit the backend to set any global information it wishes. When
|
|---|
| 542 | this is called elf_elfheader is set, but anything else should be
|
|---|
| 543 | used with caution. If this returns FALSE, the check_format
|
|---|
| 544 | routine will return a bfd_error_wrong_format error. */
|
|---|
| 545 | bfd_boolean (*elf_backend_object_p)
|
|---|
| 546 | PARAMS ((bfd *));
|
|---|
| 547 |
|
|---|
| 548 | /* A function to do additional symbol processing when reading the
|
|---|
| 549 | ELF symbol table. This is where any processor-specific special
|
|---|
| 550 | section indices are handled. */
|
|---|
| 551 | void (*elf_backend_symbol_processing)
|
|---|
| 552 | PARAMS ((bfd *, asymbol *));
|
|---|
| 553 |
|
|---|
| 554 | /* A function to do additional symbol processing after reading the
|
|---|
| 555 | entire ELF symbol table. */
|
|---|
| 556 | bfd_boolean (*elf_backend_symbol_table_processing)
|
|---|
| 557 | PARAMS ((bfd *, elf_symbol_type *, unsigned int));
|
|---|
| 558 |
|
|---|
| 559 | /* A function to set the type of the info field. Processor-specific
|
|---|
| 560 | types should be handled here. */
|
|---|
| 561 | int (*elf_backend_get_symbol_type)
|
|---|
| 562 | PARAMS (( Elf_Internal_Sym *, int));
|
|---|
| 563 |
|
|---|
| 564 | /* A function to do additional processing on the ELF section header
|
|---|
| 565 | just before writing it out. This is used to set the flags and
|
|---|
| 566 | type fields for some sections, or to actually write out data for
|
|---|
| 567 | unusual sections. */
|
|---|
| 568 | bfd_boolean (*elf_backend_section_processing)
|
|---|
| 569 | PARAMS ((bfd *, Elf_Internal_Shdr *));
|
|---|
| 570 |
|
|---|
| 571 | /* A function to handle unusual section types when creating BFD
|
|---|
| 572 | sections from ELF sections. */
|
|---|
| 573 | bfd_boolean (*elf_backend_section_from_shdr)
|
|---|
| 574 | PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
|
|---|
| 575 |
|
|---|
| 576 | /* A function to convert machine dependent section header flags to
|
|---|
| 577 | BFD internal section header flags. */
|
|---|
| 578 | bfd_boolean (*elf_backend_section_flags)
|
|---|
| 579 | PARAMS ((flagword *, Elf_Internal_Shdr *));
|
|---|
| 580 |
|
|---|
| 581 | /* A function to handle unusual program segment types when creating BFD
|
|---|
| 582 | sections from ELF program segments. */
|
|---|
| 583 | bfd_boolean (*elf_backend_section_from_phdr)
|
|---|
| 584 | PARAMS ((bfd *, Elf_Internal_Phdr *, int));
|
|---|
| 585 |
|
|---|
| 586 | /* A function to set up the ELF section header for a BFD section in
|
|---|
| 587 | preparation for writing it out. This is where the flags and type
|
|---|
| 588 | fields are set for unusual sections. */
|
|---|
| 589 | bfd_boolean (*elf_backend_fake_sections)
|
|---|
| 590 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
|
|---|
| 591 |
|
|---|
| 592 | /* A function to get the ELF section index for a BFD section. If
|
|---|
| 593 | this returns TRUE, the section was found. If it is a normal ELF
|
|---|
| 594 | section, *RETVAL should be left unchanged. If it is not a normal
|
|---|
| 595 | ELF section *RETVAL should be set to the SHN_xxxx index. */
|
|---|
| 596 | bfd_boolean (*elf_backend_section_from_bfd_section)
|
|---|
| 597 | PARAMS ((bfd *, asection *, int *retval));
|
|---|
| 598 |
|
|---|
| 599 | /* If this field is not NULL, it is called by the add_symbols phase
|
|---|
| 600 | of a link just before adding a symbol to the global linker hash
|
|---|
| 601 | table. It may modify any of the fields as it wishes. If *NAME
|
|---|
| 602 | is set to NULL, the symbol will be skipped rather than being
|
|---|
| 603 | added to the hash table. This function is responsible for
|
|---|
| 604 | handling all processor dependent symbol bindings and section
|
|---|
| 605 | indices, and must set at least *FLAGS and *SEC for each processor
|
|---|
| 606 | dependent case; failure to do so will cause a link error. */
|
|---|
| 607 | bfd_boolean (*elf_add_symbol_hook)
|
|---|
| 608 | PARAMS ((bfd *abfd, struct bfd_link_info *info,
|
|---|
| 609 | const Elf_Internal_Sym *, const char **name,
|
|---|
| 610 | flagword *flags, asection **sec, bfd_vma *value));
|
|---|
| 611 |
|
|---|
| 612 | /* If this field is not NULL, it is called by the elf_link_output_sym
|
|---|
| 613 | phase of a link for each symbol which will appear in the object file. */
|
|---|
| 614 | bfd_boolean (*elf_backend_link_output_symbol_hook)
|
|---|
| 615 | PARAMS ((bfd *, struct bfd_link_info *info, const char *,
|
|---|
| 616 | Elf_Internal_Sym *, asection *));
|
|---|
| 617 |
|
|---|
| 618 | /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
|---|
| 619 | linker the first time it encounters a dynamic object in the link.
|
|---|
| 620 | This function must create any sections required for dynamic
|
|---|
| 621 | linking. The ABFD argument is a dynamic object. The .interp,
|
|---|
| 622 | .dynamic, .dynsym, .dynstr, and .hash functions have already been
|
|---|
| 623 | created, and this function may modify the section flags if
|
|---|
| 624 | desired. This function will normally create the .got and .plt
|
|---|
| 625 | sections, but different backends have different requirements. */
|
|---|
| 626 | bfd_boolean (*elf_backend_create_dynamic_sections)
|
|---|
| 627 | PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
|---|
| 628 |
|
|---|
| 629 | /* The CHECK_RELOCS function is called by the add_symbols phase of
|
|---|
| 630 | the ELF backend linker. It is called once for each section with
|
|---|
| 631 | relocs of an object file, just after the symbols for the object
|
|---|
| 632 | file have been added to the global linker hash table. The
|
|---|
| 633 | function must look through the relocs and do any special handling
|
|---|
| 634 | required. This generally means allocating space in the global
|
|---|
| 635 | offset table, and perhaps allocating space for a reloc. The
|
|---|
| 636 | relocs are always passed as Rela structures; if the section
|
|---|
| 637 | actually uses Rel structures, the r_addend field will always be
|
|---|
| 638 | zero. */
|
|---|
| 639 | bfd_boolean (*check_relocs)
|
|---|
| 640 | PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
|
|---|
| 641 | const Elf_Internal_Rela *relocs));
|
|---|
| 642 |
|
|---|
| 643 | /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
|
|---|
| 644 | linker for every symbol which is defined by a dynamic object and
|
|---|
| 645 | referenced by a regular object. This is called after all the
|
|---|
| 646 | input files have been seen, but before the SIZE_DYNAMIC_SECTIONS
|
|---|
| 647 | function has been called. The hash table entry should be
|
|---|
| 648 | bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
|
|---|
| 649 | defined in a section from a dynamic object. Dynamic object
|
|---|
| 650 | sections are not included in the final link, and this function is
|
|---|
| 651 | responsible for changing the value to something which the rest of
|
|---|
| 652 | the link can deal with. This will normally involve adding an
|
|---|
| 653 | entry to the .plt or .got or some such section, and setting the
|
|---|
| 654 | symbol to point to that. */
|
|---|
| 655 | bfd_boolean (*elf_backend_adjust_dynamic_symbol)
|
|---|
| 656 | PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h));
|
|---|
| 657 |
|
|---|
| 658 | /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker
|
|---|
| 659 | after all the linker input files have been seen but before the
|
|---|
| 660 | section sizes have been set. This is called after
|
|---|
| 661 | ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */
|
|---|
| 662 | bfd_boolean (*elf_backend_always_size_sections)
|
|---|
| 663 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
|
|---|
| 664 |
|
|---|
| 665 | /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend
|
|---|
| 666 | linker after all the linker input files have been seen but before
|
|---|
| 667 | the sections sizes have been set. This is called after
|
|---|
| 668 | ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols.
|
|---|
| 669 | It is only called when linking against a dynamic object. It must
|
|---|
| 670 | set the sizes of the dynamic sections, and may fill in their
|
|---|
| 671 | contents as well. The generic ELF linker can handle the .dynsym,
|
|---|
| 672 | .dynstr and .hash sections. This function must handle the
|
|---|
| 673 | .interp section and any sections created by the
|
|---|
| 674 | CREATE_DYNAMIC_SECTIONS entry point. */
|
|---|
| 675 | bfd_boolean (*elf_backend_size_dynamic_sections)
|
|---|
| 676 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
|
|---|
| 677 |
|
|---|
| 678 | /* The RELOCATE_SECTION function is called by the ELF backend linker
|
|---|
| 679 | to handle the relocations for a section.
|
|---|
| 680 |
|
|---|
| 681 | The relocs are always passed as Rela structures; if the section
|
|---|
| 682 | actually uses Rel structures, the r_addend field will always be
|
|---|
| 683 | zero.
|
|---|
| 684 |
|
|---|
| 685 | This function is responsible for adjust the section contents as
|
|---|
| 686 | necessary, and (if using Rela relocs and generating a
|
|---|
| 687 | relocateable output file) adjusting the reloc addend as
|
|---|
| 688 | necessary.
|
|---|
| 689 |
|
|---|
| 690 | This function does not have to worry about setting the reloc
|
|---|
| 691 | address or the reloc symbol index.
|
|---|
| 692 |
|
|---|
| 693 | LOCAL_SYMS is a pointer to the swapped in local symbols.
|
|---|
| 694 |
|
|---|
| 695 | LOCAL_SECTIONS is an array giving the section in the input file
|
|---|
| 696 | corresponding to the st_shndx field of each local symbol.
|
|---|
| 697 |
|
|---|
| 698 | The global hash table entry for the global symbols can be found
|
|---|
| 699 | via elf_sym_hashes (input_bfd).
|
|---|
| 700 |
|
|---|
| 701 | When generating relocateable output, this function must handle
|
|---|
| 702 | STB_LOCAL/STT_SECTION symbols specially. The output symbol is
|
|---|
| 703 | going to be the section symbol corresponding to the output
|
|---|
| 704 | section, which means that the addend must be adjusted
|
|---|
| 705 | accordingly. */
|
|---|
| 706 | bfd_boolean (*elf_backend_relocate_section)
|
|---|
| 707 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
|
|---|
| 708 | bfd *input_bfd, asection *input_section, bfd_byte *contents,
|
|---|
| 709 | Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
|
|---|
| 710 | asection **local_sections));
|
|---|
| 711 |
|
|---|
| 712 | /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
|
|---|
| 713 | linker just before it writes a symbol out to the .dynsym section.
|
|---|
| 714 | The processor backend may make any required adjustment to the
|
|---|
| 715 | symbol. It may also take the opportunity to set contents of the
|
|---|
| 716 | dynamic sections. Note that FINISH_DYNAMIC_SYMBOL is called on
|
|---|
| 717 | all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
|
|---|
| 718 | on those symbols which are defined by a dynamic object. */
|
|---|
| 719 | bfd_boolean (*elf_backend_finish_dynamic_symbol)
|
|---|
| 720 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
|
|---|
| 721 | struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
|
|---|
| 722 |
|
|---|
| 723 | /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
|
|---|
| 724 | linker just before it writes all the dynamic sections out to the
|
|---|
| 725 | output file. The FINISH_DYNAMIC_SYMBOL will have been called on
|
|---|
| 726 | all dynamic symbols. */
|
|---|
| 727 | bfd_boolean (*elf_backend_finish_dynamic_sections)
|
|---|
| 728 | PARAMS ((bfd *output_bfd, struct bfd_link_info *info));
|
|---|
| 729 |
|
|---|
| 730 | /* A function to do any beginning processing needed for the ELF file
|
|---|
| 731 | before building the ELF headers and computing file positions. */
|
|---|
| 732 | void (*elf_backend_begin_write_processing)
|
|---|
| 733 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 734 |
|
|---|
| 735 | /* A function to do any final processing needed for the ELF file
|
|---|
| 736 | before writing it out. The LINKER argument is TRUE if this BFD
|
|---|
| 737 | was created by the ELF backend linker. */
|
|---|
| 738 | void (*elf_backend_final_write_processing)
|
|---|
| 739 | PARAMS ((bfd *, bfd_boolean linker));
|
|---|
| 740 |
|
|---|
| 741 | /* This function is called by get_program_header_size. It should
|
|---|
| 742 | return the number of additional program segments which this BFD
|
|---|
| 743 | will need. It should return -1 on error. */
|
|---|
| 744 | int (*elf_backend_additional_program_headers)
|
|---|
| 745 | PARAMS ((bfd *));
|
|---|
| 746 |
|
|---|
| 747 | /* This function is called to modify an existing segment map in a
|
|---|
| 748 | backend specific fashion. */
|
|---|
| 749 | bfd_boolean (*elf_backend_modify_segment_map)
|
|---|
| 750 | PARAMS ((bfd *));
|
|---|
| 751 |
|
|---|
| 752 | /* This function is called during section gc to discover the section a
|
|---|
| 753 | particular relocation refers to. */
|
|---|
| 754 | asection * (*gc_mark_hook)
|
|---|
| 755 | PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
|
|---|
| 756 | struct elf_link_hash_entry *h, Elf_Internal_Sym *));
|
|---|
| 757 |
|
|---|
| 758 | /* This function, if defined, is called during the sweep phase of gc
|
|---|
| 759 | in order that a backend might update any data structures it might
|
|---|
| 760 | be maintaining. */
|
|---|
| 761 | bfd_boolean (*gc_sweep_hook)
|
|---|
| 762 | PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
|
|---|
| 763 | const Elf_Internal_Rela *relocs));
|
|---|
| 764 |
|
|---|
| 765 | /* This function, if defined, is called after the ELF headers have
|
|---|
| 766 | been created. This allows for things like the OS and ABI versions
|
|---|
| 767 | to be changed. */
|
|---|
| 768 | void (*elf_backend_post_process_headers)
|
|---|
| 769 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 770 |
|
|---|
| 771 | /* This function, if defined, prints a symbol to file and returns the
|
|---|
| 772 | name of the symbol to be printed. It should return NULL to fall
|
|---|
| 773 | back to default symbol printing. */
|
|---|
| 774 | const char *(*elf_backend_print_symbol_all)
|
|---|
| 775 | PARAMS ((bfd *, PTR, asymbol *));
|
|---|
| 776 |
|
|---|
| 777 | /* This function, if defined, is called after all local symbols and
|
|---|
| 778 | global symbols converted to locals are emited into the symtab
|
|---|
| 779 | section. It allows the backend to emit special global symbols
|
|---|
| 780 | not handled in the hash table. */
|
|---|
| 781 | bfd_boolean (*elf_backend_output_arch_syms)
|
|---|
| 782 | PARAMS ((bfd *, struct bfd_link_info *, PTR,
|
|---|
| 783 | bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
|
|---|
| 784 |
|
|---|
| 785 | /* Copy any information related to dynamic linking from a pre-existing
|
|---|
| 786 | symbol to a newly created symbol. Also called to copy flags and
|
|---|
| 787 | other back-end info to a weakdef, in which case the symbol is not
|
|---|
| 788 | newly created and plt/got refcounts and dynamic indices should not
|
|---|
| 789 | be copied. */
|
|---|
| 790 | void (*elf_backend_copy_indirect_symbol)
|
|---|
| 791 | PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
|
|---|
| 792 | struct elf_link_hash_entry *));
|
|---|
| 793 |
|
|---|
| 794 | /* Modify any information related to dynamic linking such that the
|
|---|
| 795 | symbol is not exported. */
|
|---|
| 796 | void (*elf_backend_hide_symbol)
|
|---|
| 797 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
|
|---|
| 798 |
|
|---|
| 799 | /* Emit relocations. Overrides default routine for emitting relocs,
|
|---|
| 800 | except during a relocatable link, or if all relocs are being emitted. */
|
|---|
| 801 | bfd_boolean (*elf_backend_emit_relocs)
|
|---|
| 802 | PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
|
|---|
| 803 |
|
|---|
| 804 | /* Count relocations. Not called for relocatable links
|
|---|
| 805 | or if all relocs are being preserved in the output. */
|
|---|
| 806 | unsigned int (*elf_backend_count_relocs)
|
|---|
| 807 | PARAMS ((asection *, Elf_Internal_Rela *));
|
|---|
| 808 |
|
|---|
| 809 | /* This function, if defined, is called when an NT_PRSTATUS note is found
|
|---|
| 810 | in a core file. */
|
|---|
| 811 | bfd_boolean (*elf_backend_grok_prstatus)
|
|---|
| 812 | PARAMS ((bfd *, Elf_Internal_Note *));
|
|---|
| 813 |
|
|---|
| 814 | /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
|
|---|
| 815 | note is found in a core file. */
|
|---|
| 816 | bfd_boolean (*elf_backend_grok_psinfo)
|
|---|
| 817 | PARAMS ((bfd *, Elf_Internal_Note *));
|
|---|
| 818 |
|
|---|
| 819 | /* Functions to print VMAs. Special code to handle 64 bit ELF files. */
|
|---|
| 820 | void (* elf_backend_sprintf_vma)
|
|---|
| 821 | PARAMS ((bfd *, char *, bfd_vma));
|
|---|
| 822 | void (* elf_backend_fprintf_vma)
|
|---|
| 823 | PARAMS ((bfd *, PTR, bfd_vma));
|
|---|
| 824 |
|
|---|
| 825 | /* This function returns class of a reloc type. */
|
|---|
| 826 | enum elf_reloc_type_class (*elf_backend_reloc_type_class)
|
|---|
| 827 | PARAMS ((const Elf_Internal_Rela *));
|
|---|
| 828 |
|
|---|
| 829 | /* This function, if defined, removes information about discarded functions
|
|---|
| 830 | from other sections which mention them. */
|
|---|
| 831 | bfd_boolean (*elf_backend_discard_info)
|
|---|
| 832 | PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *));
|
|---|
| 833 |
|
|---|
| 834 | /* This function, if defined, signals that the function above has removed
|
|---|
| 835 | the discarded relocations for this section. */
|
|---|
| 836 | bfd_boolean (*elf_backend_ignore_discarded_relocs)
|
|---|
| 837 | PARAMS ((asection *));
|
|---|
| 838 |
|
|---|
| 839 | /* This function, if defined, may write out the given section.
|
|---|
| 840 | Returns TRUE if it did so and FALSE if the caller should. */
|
|---|
| 841 | bfd_boolean (*elf_backend_write_section)
|
|---|
| 842 | PARAMS ((bfd *, asection *, bfd_byte *));
|
|---|
| 843 |
|
|---|
| 844 | /* The level of IRIX compatibility we're striving for.
|
|---|
| 845 | MIPS ELF specific function. */
|
|---|
| 846 | irix_compat_t (*elf_backend_mips_irix_compat)
|
|---|
| 847 | PARAMS ((bfd *));
|
|---|
| 848 |
|
|---|
| 849 | reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
|
|---|
| 850 | PARAMS ((unsigned int, bfd_boolean));
|
|---|
| 851 |
|
|---|
| 852 | /* The swapping table to use when dealing with ECOFF information.
|
|---|
| 853 | Used for the MIPS ELF .mdebug section. */
|
|---|
| 854 | const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
|
|---|
| 855 |
|
|---|
| 856 | /* Alternate EM_xxxx machine codes for this backend. */
|
|---|
| 857 | int elf_machine_alt1;
|
|---|
| 858 | int elf_machine_alt2;
|
|---|
| 859 |
|
|---|
| 860 | const struct elf_size_info *s;
|
|---|
| 861 |
|
|---|
| 862 | /* offset of the _GLOBAL_OFFSET_TABLE_ symbol from the start of the
|
|---|
| 863 | .got section */
|
|---|
| 864 | bfd_vma got_symbol_offset;
|
|---|
| 865 |
|
|---|
| 866 | /* The size in bytes of the headers for the GOT and PLT. This includes
|
|---|
| 867 | the so-called reserved entries on some systems. */
|
|---|
| 868 | bfd_vma got_header_size;
|
|---|
| 869 | bfd_vma plt_header_size;
|
|---|
| 870 |
|
|---|
| 871 | /* This is TRUE if the linker should act like collect and gather
|
|---|
| 872 | global constructors and destructors by name. This is TRUE for
|
|---|
| 873 | MIPS ELF because the Irix 5 tools can not handle the .init
|
|---|
| 874 | section. */
|
|---|
| 875 | unsigned collect : 1;
|
|---|
| 876 |
|
|---|
| 877 | /* This is TRUE if the linker should ignore changes to the type of a
|
|---|
| 878 | symbol. This is TRUE for MIPS ELF because some Irix 5 objects
|
|---|
| 879 | record undefined functions as STT_OBJECT although the definitions
|
|---|
| 880 | are STT_FUNC. */
|
|---|
| 881 | unsigned type_change_ok : 1;
|
|---|
| 882 |
|
|---|
| 883 | /* Whether the backend may use REL relocations. (Some backends use
|
|---|
| 884 | both REL and RELA relocations, and this flag is set for those
|
|---|
| 885 | backends.) */
|
|---|
| 886 | unsigned may_use_rel_p : 1;
|
|---|
| 887 |
|
|---|
| 888 | /* Whether the backend may use RELA relocations. (Some backends use
|
|---|
| 889 | both REL and RELA relocations, and this flag is set for those
|
|---|
| 890 | backends.) */
|
|---|
| 891 | unsigned may_use_rela_p : 1;
|
|---|
| 892 |
|
|---|
| 893 | /* Whether the default relocation type is RELA. If a backend with
|
|---|
| 894 | this flag set wants REL relocations for a particular section,
|
|---|
| 895 | it must note that explicitly. Similarly, if this flag is clear,
|
|---|
| 896 | and the backend wants RELA relocations for a particular
|
|---|
| 897 | section. */
|
|---|
| 898 | unsigned default_use_rela_p : 1;
|
|---|
| 899 |
|
|---|
| 900 | /* Set if RELA relocations for a relocatable link can be handled by
|
|---|
| 901 | generic code. Backends that set this flag need do nothing in the
|
|---|
| 902 | backend relocate_section routine for relocatable linking. */
|
|---|
| 903 | unsigned rela_normal : 1;
|
|---|
| 904 |
|
|---|
| 905 | /* TRUE if addresses "naturally" sign extend. This is used when
|
|---|
| 906 | swapping in from Elf32 when BFD64. */
|
|---|
| 907 | unsigned sign_extend_vma : 1;
|
|---|
| 908 |
|
|---|
| 909 | unsigned want_got_plt : 1;
|
|---|
| 910 | unsigned plt_readonly : 1;
|
|---|
| 911 | unsigned want_plt_sym : 1;
|
|---|
| 912 | unsigned plt_not_loaded : 1;
|
|---|
| 913 | unsigned plt_alignment : 4;
|
|---|
| 914 | unsigned can_gc_sections : 1;
|
|---|
| 915 | unsigned can_refcount : 1;
|
|---|
| 916 | unsigned want_got_sym : 1;
|
|---|
| 917 | unsigned want_dynbss : 1;
|
|---|
| 918 | /* Targets which do not support physical addressing often require
|
|---|
| 919 | that the p_paddr field in the section header to be set to zero.
|
|---|
| 920 | This field indicates whether this behavior is required. */
|
|---|
| 921 | unsigned want_p_paddr_set_to_zero : 1;
|
|---|
| 922 | };
|
|---|
| 923 |
|
|---|
| 924 | /* Information stored for each BFD section in an ELF file. This
|
|---|
| 925 | structure is allocated by elf_new_section_hook. */
|
|---|
| 926 |
|
|---|
| 927 | struct bfd_elf_section_data
|
|---|
| 928 | {
|
|---|
| 929 | /* The ELF header for this section. */
|
|---|
| 930 | Elf_Internal_Shdr this_hdr;
|
|---|
| 931 |
|
|---|
| 932 | /* The ELF header for the reloc section associated with this
|
|---|
| 933 | section, if any. */
|
|---|
| 934 | Elf_Internal_Shdr rel_hdr;
|
|---|
| 935 |
|
|---|
| 936 | /* If there is a second reloc section associated with this section,
|
|---|
| 937 | as can happen on Irix 6, this field points to the header. */
|
|---|
| 938 | Elf_Internal_Shdr *rel_hdr2;
|
|---|
| 939 |
|
|---|
| 940 | /* The number of relocations currently assigned to REL_HDR. */
|
|---|
| 941 | unsigned int rel_count;
|
|---|
| 942 |
|
|---|
| 943 | /* The number of relocations currently assigned to REL_HDR2. */
|
|---|
| 944 | unsigned int rel_count2;
|
|---|
| 945 |
|
|---|
| 946 | /* The ELF section number of this section. Only used for an output
|
|---|
| 947 | file. */
|
|---|
| 948 | int this_idx;
|
|---|
| 949 |
|
|---|
| 950 | /* The ELF section number of the reloc section indicated by
|
|---|
| 951 | REL_HDR if any. Only used for an output file. */
|
|---|
| 952 | int rel_idx;
|
|---|
| 953 |
|
|---|
| 954 | /* The ELF section number of the reloc section indicated by
|
|---|
| 955 | REL_HDR2 if any. Only used for an output file. */
|
|---|
| 956 | int rel_idx2;
|
|---|
| 957 |
|
|---|
| 958 | /* Used by the backend linker when generating a shared library to
|
|---|
| 959 | record the dynamic symbol index for a section symbol
|
|---|
| 960 | corresponding to this section. A value of 0 means that there is
|
|---|
| 961 | no dynamic symbol for this section. */
|
|---|
| 962 | int dynindx;
|
|---|
| 963 |
|
|---|
| 964 | /* Used by the backend linker to store the symbol hash table entries
|
|---|
| 965 | associated with relocs against global symbols. */
|
|---|
| 966 | struct elf_link_hash_entry **rel_hashes;
|
|---|
| 967 |
|
|---|
| 968 | /* A pointer to the swapped relocs. If the section uses REL relocs,
|
|---|
| 969 | rather than RELA, all the r_addend fields will be zero. This
|
|---|
| 970 | pointer may be NULL. It is used by the backend linker. */
|
|---|
| 971 | Elf_Internal_Rela *relocs;
|
|---|
| 972 |
|
|---|
| 973 | /* A pointer to a linked list tracking dynamic relocs copied for
|
|---|
| 974 | local symbols. */
|
|---|
| 975 | PTR local_dynrel;
|
|---|
| 976 |
|
|---|
| 977 | /* A pointer to the bfd section used for dynamic relocs. */
|
|---|
| 978 | asection *sreloc;
|
|---|
| 979 |
|
|---|
| 980 | union {
|
|---|
| 981 | /* Group name, if this section is a member of a group. */
|
|---|
| 982 | const char *name;
|
|---|
| 983 |
|
|---|
| 984 | /* Group signature sym, if this is the SHT_GROUP section. */
|
|---|
| 985 | struct symbol_cache_entry *id;
|
|---|
| 986 | } group;
|
|---|
| 987 |
|
|---|
| 988 | /* A linked list of sections in the group. Circular when used by
|
|---|
| 989 | the linker. */
|
|---|
| 990 | asection *next_in_group;
|
|---|
| 991 |
|
|---|
| 992 | /* A pointer used for various section optimizations. */
|
|---|
| 993 | PTR sec_info;
|
|---|
| 994 | };
|
|---|
| 995 |
|
|---|
| 996 | #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
|---|
| 997 | #define elf_group_name(sec) (elf_section_data(sec)->group.name)
|
|---|
| 998 | #define elf_group_id(sec) (elf_section_data(sec)->group.id)
|
|---|
| 999 | #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
|
|---|
| 1000 |
|
|---|
| 1001 | /* Return TRUE if section has been discarded. */
|
|---|
| 1002 | #define elf_discarded_section(sec) \
|
|---|
| 1003 | (!bfd_is_abs_section (sec) \
|
|---|
| 1004 | && bfd_is_abs_section ((sec)->output_section) \
|
|---|
| 1005 | && sec->sec_info_type != ELF_INFO_TYPE_MERGE \
|
|---|
| 1006 | && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
|
|---|
| 1007 |
|
|---|
| 1008 | #define get_elf_backend_data(abfd) \
|
|---|
| 1009 | ((struct elf_backend_data *) (abfd)->xvec->backend_data)
|
|---|
| 1010 |
|
|---|
| 1011 | /* Enumeration to specify the special section. */
|
|---|
| 1012 | typedef enum elf_linker_section_enum
|
|---|
| 1013 | {
|
|---|
| 1014 | LINKER_SECTION_UNKNOWN, /* not used */
|
|---|
| 1015 | LINKER_SECTION_GOT, /* .got section for global offset pointers */
|
|---|
| 1016 | LINKER_SECTION_PLT, /* .plt section for generated procedure stubs */
|
|---|
| 1017 | LINKER_SECTION_SDATA, /* .sdata/.sbss section for PowerPC */
|
|---|
| 1018 | LINKER_SECTION_SDATA2, /* .sdata2/.sbss2 section for PowerPC */
|
|---|
| 1019 | LINKER_SECTION_MAX /* # of linker sections */
|
|---|
| 1020 | } elf_linker_section_enum_t;
|
|---|
| 1021 |
|
|---|
| 1022 | /* Sections created by the linker. */
|
|---|
| 1023 |
|
|---|
| 1024 | typedef struct elf_linker_section
|
|---|
| 1025 | {
|
|---|
| 1026 | char *name; /* name of the section */
|
|---|
| 1027 | char *rel_name; /* name of the associated .rel{,a}. section */
|
|---|
| 1028 | char *bss_name; /* name of a related .bss section */
|
|---|
| 1029 | char *sym_name; /* name of symbol to reference this section */
|
|---|
| 1030 | asection *section; /* pointer to the section */
|
|---|
| 1031 | asection *bss_section; /* pointer to the bss section associated with this */
|
|---|
| 1032 | asection *rel_section; /* pointer to the relocations needed for this section */
|
|---|
| 1033 | struct elf_link_hash_entry *sym_hash; /* pointer to the created symbol hash value */
|
|---|
| 1034 | bfd_vma initial_size; /* initial size before any linker generated allocations */
|
|---|
| 1035 | bfd_vma sym_offset; /* offset of symbol from beginning of section */
|
|---|
| 1036 | bfd_vma hole_size; /* size of reserved address hole in allocation */
|
|---|
| 1037 | bfd_vma hole_offset; /* current offset for the hole */
|
|---|
| 1038 | bfd_vma max_hole_offset; /* maximum offset for the hole */
|
|---|
| 1039 | elf_linker_section_enum_t which; /* which section this is */
|
|---|
| 1040 | bfd_boolean hole_written_p; /* whether the hole has been initialized */
|
|---|
| 1041 | unsigned int alignment; /* alignment for the section */
|
|---|
| 1042 | flagword flags; /* flags to use to create the section */
|
|---|
| 1043 | } elf_linker_section_t;
|
|---|
| 1044 |
|
|---|
| 1045 | /* Linked list of allocated pointer entries. This hangs off of the symbol lists, and
|
|---|
| 1046 | provides allows us to return different pointers, based on different addend's. */
|
|---|
| 1047 |
|
|---|
| 1048 | typedef struct elf_linker_section_pointers
|
|---|
| 1049 | {
|
|---|
| 1050 | struct elf_linker_section_pointers *next; /* next allocated pointer for this symbol */
|
|---|
| 1051 | bfd_vma offset; /* offset of pointer from beginning of section */
|
|---|
| 1052 | bfd_vma addend; /* addend used */
|
|---|
| 1053 | elf_linker_section_enum_t which; /* which linker section this is */
|
|---|
| 1054 | bfd_boolean written_address_p; /* whether address was written yet */
|
|---|
| 1055 | } elf_linker_section_pointers_t;
|
|---|
| 1056 |
|
|---|
| 1057 | /* Some private data is stashed away for future use using the tdata pointer
|
|---|
| 1058 | in the bfd structure. */
|
|---|
| 1059 |
|
|---|
| 1060 | struct elf_obj_tdata
|
|---|
| 1061 | {
|
|---|
| 1062 | Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
|
|---|
| 1063 | Elf_Internal_Shdr **elf_sect_ptr;
|
|---|
| 1064 | Elf_Internal_Phdr *phdr;
|
|---|
| 1065 | struct elf_segment_map *segment_map;
|
|---|
| 1066 | struct elf_strtab_hash *strtab_ptr;
|
|---|
| 1067 | int num_locals;
|
|---|
| 1068 | int num_globals;
|
|---|
| 1069 | unsigned int num_elf_sections; /* elf_sect_ptr size */
|
|---|
| 1070 | int num_section_syms;
|
|---|
| 1071 | asymbol **section_syms; /* STT_SECTION symbols for each section */
|
|---|
| 1072 | Elf_Internal_Shdr symtab_hdr;
|
|---|
| 1073 | Elf_Internal_Shdr shstrtab_hdr;
|
|---|
| 1074 | Elf_Internal_Shdr strtab_hdr;
|
|---|
| 1075 | Elf_Internal_Shdr dynsymtab_hdr;
|
|---|
| 1076 | Elf_Internal_Shdr dynstrtab_hdr;
|
|---|
| 1077 | Elf_Internal_Shdr dynversym_hdr;
|
|---|
| 1078 | Elf_Internal_Shdr dynverref_hdr;
|
|---|
| 1079 | Elf_Internal_Shdr dynverdef_hdr;
|
|---|
| 1080 | Elf_Internal_Shdr symtab_shndx_hdr;
|
|---|
| 1081 | unsigned int symtab_section, shstrtab_section;
|
|---|
| 1082 | unsigned int strtab_section, dynsymtab_section;
|
|---|
| 1083 | unsigned int symtab_shndx_section;
|
|---|
| 1084 | unsigned int dynversym_section, dynverdef_section, dynverref_section;
|
|---|
| 1085 | file_ptr next_file_pos;
|
|---|
| 1086 | #if 0
|
|---|
| 1087 | /* we don't need these inside bfd anymore, and I think
|
|---|
| 1088 | these weren't used outside bfd. */
|
|---|
| 1089 | void *prstatus; /* The raw /proc prstatus structure */
|
|---|
| 1090 | void *prpsinfo; /* The raw /proc prpsinfo structure */
|
|---|
| 1091 | #endif
|
|---|
| 1092 | bfd_vma gp; /* The gp value */
|
|---|
| 1093 | unsigned int gp_size; /* The gp size */
|
|---|
| 1094 |
|
|---|
| 1095 | Elf_Internal_Shdr **group_sect_ptr;
|
|---|
| 1096 | int num_group;
|
|---|
| 1097 |
|
|---|
| 1098 | /* Information grabbed from an elf core file. */
|
|---|
| 1099 | int core_signal;
|
|---|
| 1100 | int core_pid;
|
|---|
| 1101 | int core_lwpid;
|
|---|
| 1102 | char* core_program;
|
|---|
| 1103 | char* core_command;
|
|---|
| 1104 |
|
|---|
| 1105 | /* This is set to TRUE if the object was created by the backend
|
|---|
| 1106 | linker. */
|
|---|
| 1107 | bfd_boolean linker;
|
|---|
| 1108 |
|
|---|
| 1109 | /* A mapping from external symbols to entries in the linker hash
|
|---|
| 1110 | table, used when linking. This is indexed by the symbol index
|
|---|
| 1111 | minus the sh_info field of the symbol table header. */
|
|---|
| 1112 | struct elf_link_hash_entry **sym_hashes;
|
|---|
| 1113 |
|
|---|
| 1114 | /* Track usage and final offsets of GOT entries for local symbols.
|
|---|
| 1115 | This array is indexed by symbol index. Elements are used
|
|---|
| 1116 | identically to "got" in struct elf_link_hash_entry. */
|
|---|
| 1117 | union
|
|---|
| 1118 | {
|
|---|
| 1119 | bfd_signed_vma *refcounts;
|
|---|
| 1120 | bfd_vma *offsets;
|
|---|
| 1121 | struct got_entry **ents;
|
|---|
| 1122 | } local_got;
|
|---|
| 1123 |
|
|---|
| 1124 | /* A mapping from local symbols to offsets into the various linker
|
|---|
| 1125 | sections added. This is index by the symbol index. */
|
|---|
| 1126 | elf_linker_section_pointers_t **linker_section_pointers;
|
|---|
| 1127 |
|
|---|
| 1128 | /* The linker ELF emulation code needs to let the backend ELF linker
|
|---|
| 1129 | know what filename should be used for a dynamic object if the
|
|---|
| 1130 | dynamic object is found using a search. The emulation code then
|
|---|
| 1131 | sometimes needs to know what name was actually used. Until the
|
|---|
| 1132 | file has been added to the linker symbol table, this field holds
|
|---|
| 1133 | the name the linker wants. After it has been added, it holds the
|
|---|
| 1134 | name actually used, which will be the DT_SONAME entry if there is
|
|---|
| 1135 | one. */
|
|---|
| 1136 | const char *dt_name;
|
|---|
| 1137 |
|
|---|
| 1138 | /* When a reference in a regular object is resolved by a shared
|
|---|
| 1139 | object is loaded into via the DT_NEEDED entries by the linker
|
|---|
| 1140 | ELF emulation code, we need to add the shared object to the
|
|---|
| 1141 | DT_NEEDED list of the resulting binary to indicate the dependency
|
|---|
| 1142 | as if the -l option is passed to the linker. This field holds the
|
|---|
| 1143 | name of the loaded shared object. */
|
|---|
| 1144 | const char *dt_soname;
|
|---|
| 1145 |
|
|---|
| 1146 | /* Irix 5 often screws up the symbol table, sorting local symbols
|
|---|
| 1147 | after global symbols. This flag is set if the symbol table in
|
|---|
| 1148 | this BFD appears to be screwed up. If it is, we ignore the
|
|---|
| 1149 | sh_info field in the symbol table header, and always read all the
|
|---|
| 1150 | symbols. */
|
|---|
| 1151 | bfd_boolean bad_symtab;
|
|---|
| 1152 |
|
|---|
| 1153 | /* Records the result of `get_program_header_size'. */
|
|---|
| 1154 | bfd_size_type program_header_size;
|
|---|
| 1155 |
|
|---|
| 1156 | /* Used by find_nearest_line entry point. */
|
|---|
| 1157 | PTR line_info;
|
|---|
| 1158 |
|
|---|
| 1159 | /* Used by MIPS ELF find_nearest_line entry point. The structure
|
|---|
| 1160 | could be included directly in this one, but there's no point to
|
|---|
| 1161 | wasting the memory just for the infrequently called
|
|---|
| 1162 | find_nearest_line. */
|
|---|
| 1163 | struct mips_elf_find_line *find_line_info;
|
|---|
| 1164 |
|
|---|
| 1165 | /* A place to stash dwarf1 info for this bfd. */
|
|---|
| 1166 | struct dwarf1_debug *dwarf1_find_line_info;
|
|---|
| 1167 |
|
|---|
| 1168 | /* A place to stash dwarf2 info for this bfd. */
|
|---|
| 1169 | PTR dwarf2_find_line_info;
|
|---|
| 1170 |
|
|---|
| 1171 | /* An array of stub sections indexed by symbol number, used by the
|
|---|
| 1172 | MIPS ELF linker. FIXME: We should figure out some way to only
|
|---|
| 1173 | include this field for a MIPS ELF target. */
|
|---|
| 1174 | asection **local_stubs;
|
|---|
| 1175 |
|
|---|
| 1176 | /* Used to determine if PT_GNU_EH_FRAME segment header should be
|
|---|
| 1177 | created. */
|
|---|
| 1178 | asection *eh_frame_hdr;
|
|---|
| 1179 |
|
|---|
| 1180 | /* Used to determine if the e_flags field has been initialized */
|
|---|
| 1181 | bfd_boolean flags_init;
|
|---|
| 1182 |
|
|---|
| 1183 | /* Number of symbol version definitions we are about to emit. */
|
|---|
| 1184 | unsigned int cverdefs;
|
|---|
| 1185 |
|
|---|
| 1186 | /* Number of symbol version references we are about to emit. */
|
|---|
| 1187 | unsigned int cverrefs;
|
|---|
| 1188 |
|
|---|
| 1189 | /* Symbol version definitions in external objects. */
|
|---|
| 1190 | Elf_Internal_Verdef *verdef;
|
|---|
| 1191 |
|
|---|
| 1192 | /* Symbol version references to external objects. */
|
|---|
| 1193 | Elf_Internal_Verneed *verref;
|
|---|
| 1194 |
|
|---|
| 1195 | /* Linker sections that we are interested in. */
|
|---|
| 1196 | struct elf_linker_section *linker_section[ (int)LINKER_SECTION_MAX ];
|
|---|
| 1197 |
|
|---|
| 1198 | /* The Irix 5 support uses two virtual sections, which represent
|
|---|
| 1199 | text/data symbols defined in dynamic objects. */
|
|---|
| 1200 | asymbol *elf_data_symbol;
|
|---|
| 1201 | asymbol *elf_text_symbol;
|
|---|
| 1202 | asection *elf_data_section;
|
|---|
| 1203 | asection *elf_text_section;
|
|---|
| 1204 | };
|
|---|
| 1205 |
|
|---|
| 1206 | #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
|
|---|
| 1207 | #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
|
|---|
| 1208 | #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
|
|---|
| 1209 | #define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections)
|
|---|
| 1210 | #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
|
|---|
| 1211 | #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
|
|---|
| 1212 | #define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
|
|---|
| 1213 | #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
|
|---|
| 1214 | #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
|
|---|
| 1215 | #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
|
|---|
| 1216 | #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
|
|---|
| 1217 | #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
|
|---|
| 1218 | #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
|
|---|
| 1219 | #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
|
|---|
| 1220 | #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
|
|---|
| 1221 | #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
|
|---|
| 1222 | #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
|
|---|
| 1223 | #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
|
|---|
| 1224 | #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
|
|---|
| 1225 | #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
|
|---|
| 1226 | #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
|
|---|
| 1227 | #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
|
|---|
| 1228 | #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
|
|---|
| 1229 | #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
|
|---|
| 1230 | #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
|
|---|
| 1231 | #define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
|
|---|
| 1232 | #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
|
|---|
| 1233 | #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
|
|---|
| 1234 | #define elf_linker_section(bfd,n) (elf_tdata(bfd) -> linker_section[(int)n])
|
|---|
| 1235 | |
|---|
| 1236 |
|
|---|
| 1237 | extern void _bfd_elf_swap_verdef_in
|
|---|
| 1238 | PARAMS ((bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *));
|
|---|
| 1239 | extern void _bfd_elf_swap_verdef_out
|
|---|
| 1240 | PARAMS ((bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *));
|
|---|
| 1241 | extern void _bfd_elf_swap_verdaux_in
|
|---|
| 1242 | PARAMS ((bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *));
|
|---|
| 1243 | extern void _bfd_elf_swap_verdaux_out
|
|---|
| 1244 | PARAMS ((bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *));
|
|---|
| 1245 | extern void _bfd_elf_swap_verneed_in
|
|---|
| 1246 | PARAMS ((bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *));
|
|---|
| 1247 | extern void _bfd_elf_swap_verneed_out
|
|---|
| 1248 | PARAMS ((bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *));
|
|---|
| 1249 | extern void _bfd_elf_swap_vernaux_in
|
|---|
| 1250 | PARAMS ((bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *));
|
|---|
| 1251 | extern void _bfd_elf_swap_vernaux_out
|
|---|
| 1252 | PARAMS ((bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *));
|
|---|
| 1253 | extern void _bfd_elf_swap_versym_in
|
|---|
| 1254 | PARAMS ((bfd *, const Elf_External_Versym *, Elf_Internal_Versym *));
|
|---|
| 1255 | extern void _bfd_elf_swap_versym_out
|
|---|
| 1256 | PARAMS ((bfd *, const Elf_Internal_Versym *, Elf_External_Versym *));
|
|---|
| 1257 |
|
|---|
| 1258 | extern int _bfd_elf_section_from_bfd_section
|
|---|
| 1259 | PARAMS ((bfd *, asection *));
|
|---|
| 1260 | extern char *bfd_elf_string_from_elf_section
|
|---|
| 1261 | PARAMS ((bfd *, unsigned, unsigned));
|
|---|
| 1262 | extern char *bfd_elf_get_str_section
|
|---|
| 1263 | PARAMS ((bfd *, unsigned));
|
|---|
| 1264 | extern Elf_Internal_Sym *bfd_elf_get_elf_syms
|
|---|
| 1265 | PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
|
|---|
| 1266 | Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
|
|---|
| 1267 | extern const char *bfd_elf_local_sym_name
|
|---|
| 1268 | PARAMS ((bfd *, Elf_Internal_Sym *));
|
|---|
| 1269 |
|
|---|
| 1270 | extern bfd_boolean _bfd_elf_copy_private_bfd_data
|
|---|
| 1271 | PARAMS ((bfd *, bfd *));
|
|---|
| 1272 | extern bfd_boolean _bfd_elf_print_private_bfd_data
|
|---|
| 1273 | PARAMS ((bfd *, PTR));
|
|---|
| 1274 | extern void bfd_elf_print_symbol
|
|---|
| 1275 | PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
|
|---|
| 1276 |
|
|---|
| 1277 | #define elf_string_from_elf_strtab(abfd, strindex) \
|
|---|
| 1278 | bfd_elf_string_from_elf_section(abfd, elf_elfheader(abfd)->e_shstrndx, \
|
|---|
| 1279 | strindex)
|
|---|
| 1280 |
|
|---|
| 1281 | #define bfd_elf32_print_symbol bfd_elf_print_symbol
|
|---|
| 1282 | #define bfd_elf64_print_symbol bfd_elf_print_symbol
|
|---|
| 1283 |
|
|---|
| 1284 | extern void _bfd_elf_sprintf_vma
|
|---|
| 1285 | PARAMS ((bfd *, char *, bfd_vma));
|
|---|
| 1286 | extern void _bfd_elf_fprintf_vma
|
|---|
| 1287 | PARAMS ((bfd *, PTR, bfd_vma));
|
|---|
| 1288 |
|
|---|
| 1289 | extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
|
|---|
| 1290 | PARAMS ((const Elf_Internal_Rela *));
|
|---|
| 1291 | extern bfd_vma _bfd_elf_rela_local_sym
|
|---|
| 1292 | PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
|
|---|
| 1293 | extern bfd_vma _bfd_elf_rel_local_sym
|
|---|
| 1294 | PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
|
|---|
| 1295 | extern bfd_vma _bfd_elf_section_offset
|
|---|
| 1296 | PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
|
|---|
| 1297 |
|
|---|
| 1298 | extern unsigned long bfd_elf_hash
|
|---|
| 1299 | PARAMS ((const char *));
|
|---|
| 1300 |
|
|---|
| 1301 | extern bfd_reloc_status_type bfd_elf_generic_reloc
|
|---|
| 1302 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
|---|
| 1303 | extern bfd_boolean bfd_elf_mkobject
|
|---|
| 1304 | PARAMS ((bfd *));
|
|---|
| 1305 | extern bfd_boolean bfd_elf_mkcorefile
|
|---|
| 1306 | PARAMS ((bfd *));
|
|---|
| 1307 | extern Elf_Internal_Shdr *bfd_elf_find_section
|
|---|
| 1308 | PARAMS ((bfd *, char *));
|
|---|
| 1309 | extern bfd_boolean _bfd_elf_make_section_from_shdr
|
|---|
| 1310 | PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
|
|---|
| 1311 | extern bfd_boolean _bfd_elf_make_section_from_phdr
|
|---|
| 1312 | PARAMS ((bfd *, Elf_Internal_Phdr *, int, const char *));
|
|---|
| 1313 | extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
|
|---|
| 1314 | PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
|---|
| 1315 | extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
|
|---|
| 1316 | PARAMS ((bfd *));
|
|---|
| 1317 | extern void _bfd_elf_link_hash_copy_indirect
|
|---|
| 1318 | PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
|
|---|
| 1319 | struct elf_link_hash_entry *));
|
|---|
| 1320 | extern void _bfd_elf_link_hash_hide_symbol
|
|---|
| 1321 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
|
|---|
| 1322 | extern bfd_boolean _bfd_elf_link_hash_table_init
|
|---|
| 1323 | PARAMS ((struct elf_link_hash_table *, bfd *,
|
|---|
| 1324 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
|---|
| 1325 | struct bfd_hash_table *,
|
|---|
| 1326 | const char *)));
|
|---|
| 1327 | extern bfd_boolean _bfd_elf_slurp_version_tables
|
|---|
| 1328 | PARAMS ((bfd *));
|
|---|
| 1329 | extern bfd_boolean _bfd_elf_merge_sections
|
|---|
| 1330 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1331 | extern bfd_boolean bfd_elf_discard_group
|
|---|
| 1332 | PARAMS ((bfd *, struct sec *));
|
|---|
| 1333 | extern void bfd_elf_set_group_contents
|
|---|
| 1334 | PARAMS ((bfd *, asection *, PTR));
|
|---|
| 1335 | extern void _bfd_elf_link_just_syms
|
|---|
| 1336 | PARAMS ((asection *, struct bfd_link_info *));
|
|---|
| 1337 | extern bfd_boolean _bfd_elf_copy_private_symbol_data
|
|---|
| 1338 | PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
|
|---|
| 1339 | extern bfd_boolean _bfd_elf_copy_private_section_data
|
|---|
| 1340 | PARAMS ((bfd *, asection *, bfd *, asection *));
|
|---|
| 1341 | extern bfd_boolean _bfd_elf_write_object_contents
|
|---|
| 1342 | PARAMS ((bfd *));
|
|---|
| 1343 | extern bfd_boolean _bfd_elf_write_corefile_contents
|
|---|
| 1344 | PARAMS ((bfd *));
|
|---|
| 1345 | extern bfd_boolean _bfd_elf_set_section_contents
|
|---|
| 1346 | PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
|
|---|
| 1347 | extern long _bfd_elf_get_symtab_upper_bound
|
|---|
| 1348 | PARAMS ((bfd *));
|
|---|
| 1349 | extern long _bfd_elf_get_symtab
|
|---|
| 1350 | PARAMS ((bfd *, asymbol **));
|
|---|
| 1351 | extern long _bfd_elf_get_dynamic_symtab_upper_bound
|
|---|
| 1352 | PARAMS ((bfd *));
|
|---|
| 1353 | extern long _bfd_elf_canonicalize_dynamic_symtab
|
|---|
| 1354 | PARAMS ((bfd *, asymbol **));
|
|---|
| 1355 | extern long _bfd_elf_get_reloc_upper_bound
|
|---|
| 1356 | PARAMS ((bfd *, sec_ptr));
|
|---|
| 1357 | extern long _bfd_elf_canonicalize_reloc
|
|---|
| 1358 | PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
|
|---|
| 1359 | extern long _bfd_elf_get_dynamic_reloc_upper_bound
|
|---|
| 1360 | PARAMS ((bfd *));
|
|---|
| 1361 | extern long _bfd_elf_canonicalize_dynamic_reloc
|
|---|
| 1362 | PARAMS ((bfd *, arelent **, asymbol **));
|
|---|
| 1363 | extern asymbol *_bfd_elf_make_empty_symbol
|
|---|
| 1364 | PARAMS ((bfd *));
|
|---|
| 1365 | extern void _bfd_elf_get_symbol_info
|
|---|
| 1366 | PARAMS ((bfd *, asymbol *, symbol_info *));
|
|---|
| 1367 | extern bfd_boolean _bfd_elf_is_local_label_name
|
|---|
| 1368 | PARAMS ((bfd *, const char *));
|
|---|
| 1369 | extern alent *_bfd_elf_get_lineno
|
|---|
| 1370 | PARAMS ((bfd *, asymbol *));
|
|---|
| 1371 | extern bfd_boolean _bfd_elf_set_arch_mach
|
|---|
| 1372 | PARAMS ((bfd *, enum bfd_architecture, unsigned long));
|
|---|
| 1373 | extern bfd_boolean _bfd_elf_find_nearest_line
|
|---|
| 1374 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
|
|---|
| 1375 | const char **, unsigned int *));
|
|---|
| 1376 | #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
|
|---|
| 1377 | #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
|---|
| 1378 | extern int _bfd_elf_sizeof_headers
|
|---|
| 1379 | PARAMS ((bfd *, bfd_boolean));
|
|---|
| 1380 | extern bfd_boolean _bfd_elf_new_section_hook
|
|---|
| 1381 | PARAMS ((bfd *, asection *));
|
|---|
| 1382 | extern bfd_boolean _bfd_elf_init_reloc_shdr
|
|---|
| 1383 | PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean));
|
|---|
| 1384 |
|
|---|
| 1385 | /* If the target doesn't have reloc handling written yet: */
|
|---|
| 1386 | extern void _bfd_elf_no_info_to_howto
|
|---|
| 1387 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|---|
| 1388 |
|
|---|
| 1389 | extern bfd_boolean bfd_section_from_shdr
|
|---|
| 1390 | PARAMS ((bfd *, unsigned int shindex));
|
|---|
| 1391 | extern bfd_boolean bfd_section_from_phdr
|
|---|
| 1392 | PARAMS ((bfd *, Elf_Internal_Phdr *, int));
|
|---|
| 1393 |
|
|---|
| 1394 | extern int _bfd_elf_symbol_from_bfd_symbol
|
|---|
| 1395 | PARAMS ((bfd *, asymbol **));
|
|---|
| 1396 |
|
|---|
| 1397 | extern asection *bfd_section_from_r_symndx
|
|---|
| 1398 | PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long));
|
|---|
| 1399 | extern asection *bfd_section_from_elf_index
|
|---|
| 1400 | PARAMS ((bfd *, unsigned int));
|
|---|
| 1401 | extern bfd_boolean _bfd_elf_create_dynamic_sections
|
|---|
| 1402 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1403 | extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
|
|---|
| 1404 | PARAMS ((void));
|
|---|
| 1405 |
|
|---|
| 1406 | extern struct elf_strtab_hash * _bfd_elf_strtab_init
|
|---|
| 1407 | PARAMS ((void));
|
|---|
| 1408 | extern void _bfd_elf_strtab_free
|
|---|
| 1409 | PARAMS ((struct elf_strtab_hash *));
|
|---|
| 1410 | extern bfd_size_type _bfd_elf_strtab_add
|
|---|
| 1411 | PARAMS ((struct elf_strtab_hash *, const char *, bfd_boolean));
|
|---|
| 1412 | extern void _bfd_elf_strtab_addref
|
|---|
| 1413 | PARAMS ((struct elf_strtab_hash *, bfd_size_type));
|
|---|
| 1414 | extern void _bfd_elf_strtab_delref
|
|---|
| 1415 | PARAMS ((struct elf_strtab_hash *, bfd_size_type));
|
|---|
| 1416 | extern void _bfd_elf_strtab_clear_all_refs
|
|---|
| 1417 | PARAMS ((struct elf_strtab_hash *));
|
|---|
| 1418 | extern bfd_size_type _bfd_elf_strtab_size
|
|---|
| 1419 | PARAMS ((struct elf_strtab_hash *));
|
|---|
| 1420 | extern bfd_size_type _bfd_elf_strtab_offset
|
|---|
| 1421 | PARAMS ((struct elf_strtab_hash *, bfd_size_type));
|
|---|
| 1422 | extern bfd_boolean _bfd_elf_strtab_emit
|
|---|
| 1423 | PARAMS ((bfd *, struct elf_strtab_hash *));
|
|---|
| 1424 | extern void _bfd_elf_strtab_finalize
|
|---|
| 1425 | PARAMS ((struct elf_strtab_hash *));
|
|---|
| 1426 |
|
|---|
| 1427 | extern bfd_boolean _bfd_elf_discard_section_eh_frame
|
|---|
| 1428 | PARAMS ((bfd *, struct bfd_link_info *, asection *,
|
|---|
| 1429 | bfd_boolean (*) (bfd_vma, PTR), struct elf_reloc_cookie *));
|
|---|
| 1430 | extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
|
|---|
| 1431 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1432 | extern bfd_vma _bfd_elf_eh_frame_section_offset
|
|---|
| 1433 | PARAMS ((bfd *, asection *, bfd_vma));
|
|---|
| 1434 | extern bfd_boolean _bfd_elf_write_section_eh_frame
|
|---|
| 1435 | PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_byte *));
|
|---|
| 1436 | extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
|
|---|
| 1437 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1438 | extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
|
|---|
| 1439 | PARAMS ((struct bfd_link_info *));
|
|---|
| 1440 |
|
|---|
| 1441 | extern bfd_boolean _bfd_elf_link_record_dynamic_symbol
|
|---|
| 1442 | PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
|
|---|
| 1443 | extern long _bfd_elf_link_lookup_local_dynindx
|
|---|
| 1444 | PARAMS ((struct bfd_link_info *, bfd *, long));
|
|---|
| 1445 | extern bfd_boolean _bfd_elf_compute_section_file_positions
|
|---|
| 1446 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1447 | extern void _bfd_elf_assign_file_positions_for_relocs
|
|---|
| 1448 | PARAMS ((bfd *));
|
|---|
| 1449 | extern file_ptr _bfd_elf_assign_file_position_for_section
|
|---|
| 1450 | PARAMS ((Elf_Internal_Shdr *, file_ptr, bfd_boolean));
|
|---|
| 1451 |
|
|---|
| 1452 | extern bfd_boolean _bfd_elf_validate_reloc
|
|---|
| 1453 | PARAMS ((bfd *, arelent *));
|
|---|
| 1454 |
|
|---|
| 1455 | extern bfd_boolean _bfd_elf_create_dynamic_sections
|
|---|
| 1456 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1457 | extern bfd_boolean _bfd_elf_create_got_section
|
|---|
| 1458 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1459 | extern unsigned long _bfd_elf_link_renumber_dynsyms
|
|---|
| 1460 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1461 |
|
|---|
| 1462 | extern bfd_boolean _bfd_elfcore_make_pseudosection
|
|---|
| 1463 | PARAMS ((bfd *, char *, size_t, ufile_ptr));
|
|---|
| 1464 | extern char *_bfd_elfcore_strndup
|
|---|
| 1465 | PARAMS ((bfd *, char *, size_t));
|
|---|
| 1466 |
|
|---|
| 1467 | extern elf_linker_section_t *_bfd_elf_create_linker_section
|
|---|
| 1468 | PARAMS ((bfd *, struct bfd_link_info *, enum elf_linker_section_enum,
|
|---|
| 1469 | elf_linker_section_t *));
|
|---|
| 1470 |
|
|---|
| 1471 | extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
|
|---|
| 1472 | PARAMS ((elf_linker_section_pointers_t *, bfd_vma,
|
|---|
| 1473 | elf_linker_section_enum_t));
|
|---|
| 1474 |
|
|---|
| 1475 | extern bfd_boolean bfd_elf32_create_pointer_linker_section
|
|---|
| 1476 | PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
|
|---|
| 1477 | struct elf_link_hash_entry *, const Elf_Internal_Rela *));
|
|---|
| 1478 |
|
|---|
| 1479 | extern bfd_vma bfd_elf32_finish_pointer_linker_section
|
|---|
| 1480 | PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
|
|---|
| 1481 | struct elf_link_hash_entry *, bfd_vma,
|
|---|
| 1482 | const Elf_Internal_Rela *, int));
|
|---|
| 1483 |
|
|---|
| 1484 | extern bfd_boolean bfd_elf64_create_pointer_linker_section
|
|---|
| 1485 | PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
|
|---|
| 1486 | struct elf_link_hash_entry *, const Elf_Internal_Rela *));
|
|---|
| 1487 |
|
|---|
| 1488 | extern bfd_vma bfd_elf64_finish_pointer_linker_section
|
|---|
| 1489 | PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
|
|---|
| 1490 | struct elf_link_hash_entry *, bfd_vma,
|
|---|
| 1491 | const Elf_Internal_Rela *, int));
|
|---|
| 1492 |
|
|---|
| 1493 | extern bfd_boolean _bfd_elf_make_linker_section_rela
|
|---|
| 1494 | PARAMS ((bfd *, elf_linker_section_t *, int));
|
|---|
| 1495 |
|
|---|
| 1496 | extern const bfd_target *bfd_elf32_object_p
|
|---|
| 1497 | PARAMS ((bfd *));
|
|---|
| 1498 | extern const bfd_target *bfd_elf32_core_file_p
|
|---|
| 1499 | PARAMS ((bfd *));
|
|---|
| 1500 | extern char *bfd_elf32_core_file_failing_command
|
|---|
| 1501 | PARAMS ((bfd *));
|
|---|
| 1502 | extern int bfd_elf32_core_file_failing_signal
|
|---|
| 1503 | PARAMS ((bfd *));
|
|---|
| 1504 | extern bfd_boolean bfd_elf32_core_file_matches_executable_p
|
|---|
| 1505 | PARAMS ((bfd *, bfd *));
|
|---|
| 1506 |
|
|---|
| 1507 | extern bfd_boolean bfd_elf32_bfd_link_add_symbols
|
|---|
| 1508 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1509 | extern bfd_boolean bfd_elf32_bfd_final_link
|
|---|
| 1510 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1511 |
|
|---|
| 1512 | extern void bfd_elf32_swap_symbol_in
|
|---|
| 1513 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
|
|---|
| 1514 | extern void bfd_elf32_swap_symbol_out
|
|---|
| 1515 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
|
|---|
| 1516 | extern void bfd_elf32_swap_reloc_in
|
|---|
| 1517 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 1518 | extern void bfd_elf32_swap_reloc_out
|
|---|
| 1519 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 1520 | extern void bfd_elf32_swap_reloca_in
|
|---|
| 1521 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 1522 | extern void bfd_elf32_swap_reloca_out
|
|---|
| 1523 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 1524 | extern void bfd_elf32_swap_phdr_in
|
|---|
| 1525 | PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
|
|---|
| 1526 | extern void bfd_elf32_swap_phdr_out
|
|---|
| 1527 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *));
|
|---|
| 1528 | extern void bfd_elf32_swap_dyn_in
|
|---|
| 1529 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
|---|
| 1530 | extern void bfd_elf32_swap_dyn_out
|
|---|
| 1531 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
|---|
| 1532 | extern long bfd_elf32_slurp_symbol_table
|
|---|
| 1533 | PARAMS ((bfd *, asymbol **, bfd_boolean));
|
|---|
| 1534 | extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
|
|---|
| 1535 | PARAMS ((bfd *));
|
|---|
| 1536 | extern int bfd_elf32_write_out_phdrs
|
|---|
| 1537 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
|
|---|
| 1538 | extern void bfd_elf32_write_relocs
|
|---|
| 1539 | PARAMS ((bfd *, asection *, PTR));
|
|---|
| 1540 | extern bfd_boolean bfd_elf32_slurp_reloc_table
|
|---|
| 1541 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
|
|---|
| 1542 | extern bfd_boolean bfd_elf32_add_dynamic_entry
|
|---|
| 1543 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
|
|---|
| 1544 | extern bfd_boolean bfd_elf32_link_create_dynamic_sections
|
|---|
| 1545 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1546 | extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
|
|---|
| 1547 | PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean));
|
|---|
| 1548 |
|
|---|
| 1549 | extern const bfd_target *bfd_elf64_object_p
|
|---|
| 1550 | PARAMS ((bfd *));
|
|---|
| 1551 | extern const bfd_target *bfd_elf64_core_file_p
|
|---|
| 1552 | PARAMS ((bfd *));
|
|---|
| 1553 | extern char *bfd_elf64_core_file_failing_command
|
|---|
| 1554 | PARAMS ((bfd *));
|
|---|
| 1555 | extern int bfd_elf64_core_file_failing_signal
|
|---|
| 1556 | PARAMS ((bfd *));
|
|---|
| 1557 | extern bfd_boolean bfd_elf64_core_file_matches_executable_p
|
|---|
| 1558 | PARAMS ((bfd *, bfd *));
|
|---|
| 1559 | extern bfd_boolean bfd_elf64_bfd_link_add_symbols
|
|---|
| 1560 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1561 | extern bfd_boolean bfd_elf64_bfd_final_link
|
|---|
| 1562 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1563 |
|
|---|
| 1564 | extern void bfd_elf64_swap_symbol_in
|
|---|
| 1565 | PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *));
|
|---|
| 1566 | extern void bfd_elf64_swap_symbol_out
|
|---|
| 1567 | PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
|
|---|
| 1568 | extern void bfd_elf64_swap_reloc_in
|
|---|
| 1569 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 1570 | extern void bfd_elf64_swap_reloc_out
|
|---|
| 1571 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 1572 | extern void bfd_elf64_swap_reloca_in
|
|---|
| 1573 | PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
|---|
| 1574 | extern void bfd_elf64_swap_reloca_out
|
|---|
| 1575 | PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
|---|
| 1576 | extern void bfd_elf64_swap_phdr_in
|
|---|
| 1577 | PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
|
|---|
| 1578 | extern void bfd_elf64_swap_phdr_out
|
|---|
| 1579 | PARAMS ((bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *));
|
|---|
| 1580 | extern void bfd_elf64_swap_dyn_in
|
|---|
| 1581 | PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
|---|
| 1582 | extern void bfd_elf64_swap_dyn_out
|
|---|
| 1583 | PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
|---|
| 1584 | extern long bfd_elf64_slurp_symbol_table
|
|---|
| 1585 | PARAMS ((bfd *, asymbol **, bfd_boolean));
|
|---|
| 1586 | extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
|
|---|
| 1587 | PARAMS ((bfd *));
|
|---|
| 1588 | extern int bfd_elf64_write_out_phdrs
|
|---|
| 1589 | PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
|
|---|
| 1590 | extern void bfd_elf64_write_relocs
|
|---|
| 1591 | PARAMS ((bfd *, asection *, PTR));
|
|---|
| 1592 | extern bfd_boolean bfd_elf64_slurp_reloc_table
|
|---|
| 1593 | PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
|
|---|
| 1594 | extern bfd_boolean bfd_elf64_add_dynamic_entry
|
|---|
| 1595 | PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
|
|---|
| 1596 | extern bfd_boolean bfd_elf64_link_create_dynamic_sections
|
|---|
| 1597 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1598 | extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
|
|---|
| 1599 | PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean));
|
|---|
| 1600 |
|
|---|
| 1601 | #define bfd_elf32_link_record_dynamic_symbol \
|
|---|
| 1602 | _bfd_elf_link_record_dynamic_symbol
|
|---|
| 1603 | #define bfd_elf64_link_record_dynamic_symbol \
|
|---|
| 1604 | _bfd_elf_link_record_dynamic_symbol
|
|---|
| 1605 |
|
|---|
| 1606 | extern int elf_link_record_local_dynamic_symbol
|
|---|
| 1607 | PARAMS ((struct bfd_link_info *, bfd *, long));
|
|---|
| 1608 | #define _bfd_elf32_link_record_local_dynamic_symbol \
|
|---|
| 1609 | elf_link_record_local_dynamic_symbol
|
|---|
| 1610 | #define _bfd_elf64_link_record_local_dynamic_symbol \
|
|---|
| 1611 | elf_link_record_local_dynamic_symbol
|
|---|
| 1612 |
|
|---|
| 1613 | extern bfd_boolean _bfd_elf_close_and_cleanup
|
|---|
| 1614 | PARAMS ((bfd *));
|
|---|
| 1615 | extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
|
|---|
| 1616 | PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
|
|---|
| 1617 | asection *, bfd *, char **));
|
|---|
| 1618 |
|
|---|
| 1619 | extern bfd_boolean _bfd_elf32_gc_sections
|
|---|
| 1620 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1621 | extern bfd_boolean _bfd_elf32_gc_common_finalize_got_offsets
|
|---|
| 1622 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1623 | extern bfd_boolean _bfd_elf32_gc_common_final_link
|
|---|
| 1624 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1625 | extern bfd_boolean _bfd_elf32_gc_record_vtinherit
|
|---|
| 1626 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
|---|
| 1627 | extern bfd_boolean _bfd_elf32_gc_record_vtentry
|
|---|
| 1628 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
|---|
| 1629 |
|
|---|
| 1630 | extern bfd_boolean _bfd_elf64_gc_sections
|
|---|
| 1631 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1632 | extern bfd_boolean _bfd_elf64_gc_common_finalize_got_offsets
|
|---|
| 1633 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1634 | extern bfd_boolean _bfd_elf64_gc_common_final_link
|
|---|
| 1635 | PARAMS ((bfd *, struct bfd_link_info *));
|
|---|
| 1636 | extern bfd_boolean _bfd_elf64_gc_record_vtinherit
|
|---|
| 1637 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
|---|
| 1638 | extern bfd_boolean _bfd_elf64_gc_record_vtentry
|
|---|
| 1639 | PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
|---|
| 1640 |
|
|---|
| 1641 | extern bfd_boolean _bfd_elf32_reloc_symbol_deleted_p
|
|---|
| 1642 | PARAMS ((bfd_vma, PTR));
|
|---|
| 1643 | extern bfd_boolean _bfd_elf64_reloc_symbol_deleted_p
|
|---|
| 1644 | PARAMS ((bfd_vma, PTR));
|
|---|
| 1645 |
|
|---|
| 1646 | /* Exported interface for writing elf corefile notes. */
|
|---|
| 1647 | extern char *elfcore_write_note
|
|---|
| 1648 | PARAMS ((bfd *, char *, int *, const char *, int, const PTR, int));
|
|---|
| 1649 | extern char *elfcore_write_prpsinfo
|
|---|
| 1650 | PARAMS ((bfd *, char *, int *, const char *, const char *));
|
|---|
| 1651 | extern char *elfcore_write_prstatus
|
|---|
| 1652 | PARAMS ((bfd *, char *, int *, long, int, const PTR));
|
|---|
| 1653 | extern char * elfcore_write_pstatus
|
|---|
| 1654 | PARAMS ((bfd *, char *, int *, long, int, const PTR));
|
|---|
| 1655 | extern char *elfcore_write_prfpreg
|
|---|
| 1656 | PARAMS ((bfd *, char *, int *, const PTR, int));
|
|---|
| 1657 | extern char *elfcore_write_prxfpreg
|
|---|
| 1658 | PARAMS ((bfd *, char *, int *, const PTR, int));
|
|---|
| 1659 | extern char *elfcore_write_lwpstatus
|
|---|
| 1660 | PARAMS ((bfd *, char *, int *, long, int, const PTR));
|
|---|
| 1661 |
|
|---|
| 1662 | /* SH ELF specific routine. */
|
|---|
| 1663 |
|
|---|
| 1664 | extern bfd_boolean _sh_elf_set_mach_from_flags
|
|---|
| 1665 | PARAMS ((bfd *));
|
|---|
| 1666 |
|
|---|
| 1667 | #endif /* _LIBELF_H_ */
|
|---|