aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-bfd.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-02-04 12:49:57 +0000
committerAlan Modra <amodra@gmail.com>2003-02-04 12:49:57 +0000
commit5cab59f6227cb9ef3e5ed2a5bf9df5d3836645b2 (patch)
tree1187ef2086919d41d343a00b4730c265baf49440 /bfd/elf-bfd.h
parent68bfbfcc5aa8bda806bef9edf274059d6ad571fc (diff)
downloadgdb-5cab59f6227cb9ef3e5ed2a5bf9df5d3836645b2.zip
gdb-5cab59f6227cb9ef3e5ed2a5bf9df5d3836645b2.tar.gz
gdb-5cab59f6227cb9ef3e5ed2a5bf9df5d3836645b2.tar.bz2
* elf-bfd.h (struct got_entry, struct plt_entry): Forward declare.
(struct elf_link_hash_entry): Add "glist" and "plist" fields to "got" union, and declare as gotplt_union. Use gotplt_uinion for "plt" field. (struct elf_link_hash_table): Make "init_refcount" a gotplt_union. Add "init_offset" field. (struct elf_obj_tdata <local_got>): Add "struct got_entry **" to union. (elf_local_got_ents): Declare. * elf.c (_bfd_elf_link_hash_newfunc): Adjust initialization of "got" and "plt". (_bfd_elf_link_hash_hide_symbol): Use "init_offset". (_bfd_elf_link_hash_table_init): Set "init_offset". * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set init_refcount from init_offset. (elf_adjust_dynamic_symbol): Set plt and got offsets using init_offset. * elf.c (bfd_elf_local_sym_name): Split out from.. (group_signature): ..here. * elf-bfd.h (bfd_elf_local_sym_name): Declare.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r--bfd/elf-bfd.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 8c401b5..2e5587c 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -80,6 +80,8 @@ typedef struct
} elf_symbol_type;
struct elf_strtab_hash;
+struct got_entry;
+struct plt_entry;
/* ELF linker hash table entries. */
@@ -146,23 +148,23 @@ struct elf_link_hash_entry
/* If this symbol requires an entry in the global offset table, the
processor specific backend uses this field to track usage and
- final offset. We use a union and two names primarily to document
- the intent of any particular piece of code. The field should be
- used as a count until size_dynamic_sections, at which point the
- contents of the .got is fixed. Afterward, if this field is -1,
- then the symbol does not require a global offset table entry. */
- union
+ final offset. Two schemes are supported: The first assumes that
+ a symbol may only have one GOT entry, and uses REFCOUNT until
+ size_dynamic_sections, at which point the contents of the .got is
+ fixed. Afterward, if OFFSET is -1, then the symbol does not
+ require a global offset table entry. The second scheme allows
+ multiple GOT entries per symbol, managed via a linked list
+ pointed to by GLIST. */
+ union gotplt_union
{
bfd_signed_vma refcount;
bfd_vma offset;
+ struct got_entry *glist;
+ struct plt_entry *plist;
} got;
/* Same, but tracks a procedure linkage table entry. */
- union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- } plt;
+ union gotplt_union plt;
/* Symbol size. */
bfd_size_type size;
@@ -323,9 +325,13 @@ struct elf_link_hash_table
/* The value to use when initialising got.refcount/offset and
plt.refcount/offset in an elf_link_hash_entry. Set to zero when
- the values are refcounts. Set to -1 in size_dynamic_sections
- when the values may be offsets. */
- bfd_signed_vma init_refcount;
+ the values are refcounts. Set to init_offset in
+ size_dynamic_sections when the values may be offsets. */
+ union gotplt_union init_refcount;
+
+ /* The value to use for got.refcount/offset and plt.refcount/offset
+ when the values may be offsets. Normally (bfd_vma) -1. */
+ union gotplt_union init_offset;
/* The number of symbols found in the link which must be put into
the .dynsym section. */
@@ -1099,17 +1105,14 @@ struct elf_obj_tdata
minus the sh_info field of the symbol table header. */
struct elf_link_hash_entry **sym_hashes;
- /* A mapping from local symbols to offsets into the global offset
- table, used when linking. This is indexed by the symbol index.
- Like for the globals, we use a union and two names primarily to
- document the intent of any particular piece of code. The field
- should be used as a count until size_dynamic_sections, at which
- point the contents of the .got is fixed. Afterward, if an entry
- is -1, then the symbol does not require a global offset table entry. */
+ /* Track usage and final offsets of GOT entries for local symbols.
+ This array is indexed by symbol index. Elements are used
+ identically to "got" in struct elf_link_hash_entry. */
union
{
bfd_signed_vma *refcounts;
bfd_vma *offsets;
+ struct got_entry **ents;
} local_got;
/* A mapping from local symbols to offsets into the various linker
@@ -1216,6 +1219,7 @@ struct elf_obj_tdata
#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
+#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
#define elf_dt_soname(bfd) (elf_tdata(bfd) -> dt_soname)
@@ -1253,6 +1257,8 @@ extern char *bfd_elf_get_str_section
extern Elf_Internal_Sym *bfd_elf_get_elf_syms
PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
+extern const char *bfd_elf_local_sym_name
+ PARAMS ((bfd *, Elf_Internal_Sym *));
extern bfd_boolean _bfd_elf_copy_private_bfd_data
PARAMS ((bfd *, bfd *));