aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-hppa.c
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/elf32-hppa.c
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/elf32-hppa.c')
-rw-r--r--bfd/elf32-hppa.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index fb112b3..d362b58 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -257,8 +257,7 @@ elf32_hppa_args_hash_newfunc
static boolean
elf32_hppa_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **,
- char *));
+ bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static boolean
elf32_hppa_stub_hash_table_init
@@ -762,8 +761,7 @@ hppa_elf_relocate_insn (abfd, input_sect, insn, address, sym_value,
static boolean
elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections,
- output_names)
+ contents, relocs, local_syms, local_sections)
bfd *output_bfd;
struct bfd_link_info *info;
bfd *input_bfd;
@@ -772,7 +770,6 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
- char *output_names;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *rel;
@@ -865,7 +862,9 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
sym_name = h->root.root.string;
else
{
- sym_name = output_names + sym->st_name;
+ sym_name = elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
if (sym_name == NULL)
return false;
if (*sym_name == '\0')