aboutsummaryrefslogtreecommitdiff
path: root/bfd/libelf.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-10-17 22:03:14 +0000
committerIan Lance Taylor <ian@airs.com>1994-10-17 22:03:14 +0000
commiteb4267a3f937920d9cab71a265360c290db37d97 (patch)
treec79db7ee87ef7b62d373d08b7f31bdee4e27f8a5 /bfd/libelf.h
parent51bdfd9b22594abd73b2435efc7e534f82ef00b7 (diff)
downloadgdb-eb4267a3f937920d9cab71a265360c290db37d97.zip
gdb-eb4267a3f937920d9cab71a265360c290db37d97.tar.gz
gdb-eb4267a3f937920d9cab71a265360c290db37d97.tar.bz2
Use a hash table when writing out ELF symbol names.
* elfcode.h (elf_stringtab_init): New static function. (bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove. Change all callers to use elf_stringtab_init or _bfd_stringtab_add, and get stringtab lengths using _bfd_stringtab_size. (elf_fake_sections): Change ignored argument to pointer to boolean, and set the boolean to true if an error occurs. If an error has already occurred, don't do anything. (assign_section_numbers): Just set sh_size, not contents. (elf_compute_section_file_positions): Pass the address of a boolean to elf_fake_sections. Pass the address of a bfd_strtab_hash to swap_out_syms. Write out the .strtab section. (prep_headers): Change shstrtab to bfd_strtab_hash. (swap_out_syms): Take a pointer to a bfd_strtab_hash as an argument. Set it to the symbol names. (NAME(bfd_elf,write_object_contents)): Write out the section header names using _bfd_stringtab_emit. (elf_debug_section): Remove first argument; get the section name via the bfd_section pointer. Change caller. (elf_bfd_final_link): Write out the symbol names using _bfd_stringtab_emit. Likewise for the .dynstr section contents. Free the symbol names at the end of the function. (elf_link_input_bfd): Remove the last argument, output_names, from relocate_section. Save the old symbol contents before calling elf_link_output_sym, and restore them afterward. * libelf.h (struct elf_link_hash_table): Change dynstr field to struct bfd_strtab_hash. (struct elf_backend_data): Remove last argument, output_names, from elf_backend_relocate_section field. (struct strtab): Don't define. (struct elf_obj_tdata): Change strtab_ptr field to struct bfd_strtab_hash. * elf32-hppa.c (elf32_hppa_relocate_section): Remove last argument, output_names. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-mips.c (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
Diffstat (limited to 'bfd/libelf.h')
-rw-r--r--bfd/libelf.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/bfd/libelf.h b/bfd/libelf.h
index 5000e20..a92d166 100644
--- a/bfd/libelf.h
+++ b/bfd/libelf.h
@@ -137,7 +137,7 @@ struct elf_link_hash_table
size_t dynsymcount;
/* The string table of dynamic symbols, which becomes the .dynstr
section. */
- struct strtab *dynstr;
+ struct bfd_strtab_hash *dynstr;
/* The number of buckets in the hash table in the .hash section.
This is based on the number of dynamic symbols. */
size_t bucketcount;
@@ -357,7 +357,7 @@ struct elf_backend_data
PARAMS ((bfd *output_bfd, struct bfd_link_info *info,
bfd *input_bfd, asection *input_section, bfd_byte *contents,
Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms,
- asection **local_sections, char *output_names));
+ asection **local_sections));
/* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
linker just before it writes a symbol out to the .dynsym section.
@@ -429,13 +429,6 @@ struct bfd_elf_section_data {
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
-struct strtab
-{
- char *tab;
- int nentries;
- int length;
-};
-
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
@@ -444,7 +437,7 @@ struct elf_obj_tdata
Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
Elf_Internal_Shdr **elf_sect_ptr;
Elf_Internal_Phdr *phdr;
- struct strtab *strtab_ptr;
+ struct bfd_strtab_hash *strtab_ptr;
int num_locals;
int num_globals;
Elf_Sym_Extra *sym_extra;