From 6a40cf0c5c845683fdb82721813ebd5dd867cce5 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 23 Sep 2015 17:23:58 +0100 Subject: Add support for files that contain multiple symbol index tables. Fixes PR 15835 binutils PR binutils/15835 * readelf.c (struct elf_section_list): New structure. (symtab_shndx_hdr): Replace with symtab_shndx_list. (get_32bit_elf_symbols): Scan for a symbol index table matching the symbol table in use. (get_64bit_elf_symbols): Likewise. (process_section_headers): Handle multiple symbol index sections. bfd * elf-bfd.h (struct elf_section_list): New structure. (struct elf_obj_tdata): Replace symtab_shndx_hdr with symtab_shndx_list. Delete symtab_shndx_section. (elf_symtab_shndx): Replace macro with elf_symtab_shndx_list. * elf.c (bfd_elf_get_syms): If symtab index sections are present, scan them for the section that matches the provided symbol table. (bfd_section_from_shdr): Record all SHT_SYMTAB_SHNDX sections. (assign_section_numbers): Use the first symtab index table in the list. (_bfd_elf_compute_section_file_positions): Replace use of symtab_shndx_hdr with use of symtab_shndx_list. (find_section_in_list): New function. (assign_file_postions_except_relocs): Use new function. (_bfd_elf_copy_private_symbol_data): Likewise. (swap_out_syms): Handle multiple symbol table index sections. * elf32-m32c.c (m32c_elf_relax_section): Replace use of symtab_shndx_hdr with use of symtab_shndx_list. * elf32-rl78.c (rl78_elf_relax_section): Likewise. * elf32-rx.c (rx_relax_section): Likewise. * elf32-v850.c (v850_elf_relax_delete_bytes): Likewise. * elflink.c (bfd_elf_final_link): Likewise. --- bfd/elf-bfd.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bfd/elf-bfd.h') diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index e0e372f..b7ca2d0 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1654,6 +1654,14 @@ enum elf_gnu_symbols elf_gnu_symbol_all = (elf_gnu_symbol_ifunc | elf_gnu_symbol_unique) }; +typedef struct elf_section_list +{ + Elf_Internal_Shdr hdr; + unsigned int ndx; + struct elf_section_list * next; +} elf_section_list; + + /* Some private data is stashed away for future use using the tdata pointer in the bfd structure. */ @@ -1670,7 +1678,7 @@ struct elf_obj_tdata Elf_Internal_Shdr dynversym_hdr; Elf_Internal_Shdr dynverref_hdr; Elf_Internal_Shdr dynverdef_hdr; - Elf_Internal_Shdr symtab_shndx_hdr; + elf_section_list * symtab_shndx_list; bfd_vma gp; /* The gp value */ unsigned int gp_size; /* The gp size */ unsigned int num_elf_sections; /* elf_sect_ptr size */ @@ -1745,7 +1753,7 @@ struct elf_obj_tdata Elf_Internal_Shdr **group_sect_ptr; int num_group; - unsigned int symtab_section, symtab_shndx_section, dynsymtab_section; + unsigned int symtab_section, dynsymtab_section; unsigned int dynversym_section, dynverdef_section, dynverref_section; /* An identifier used to distinguish different target @@ -1787,7 +1795,7 @@ struct elf_obj_tdata #define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags) #define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr) #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) -#define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section) +#define elf_symtab_shndx_list(bfd) (elf_tdata(bfd) -> symtab_shndx_list) #define elf_strtab_sec(bfd) (elf_tdata(bfd) -> o->strtab_section) #define elf_shstrtab_sec(bfd) (elf_tdata(bfd) -> o->shstrtab_section) #define elf_symtab_hdr(bfd) (elf_tdata(bfd) -> symtab_hdr) -- cgit v1.1