diff options
author | Nick Clifton <nickc@redhat.com> | 2015-09-23 17:23:58 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-09-23 17:23:58 +0100 |
commit | 6a40cf0c5c845683fdb82721813ebd5dd867cce5 (patch) | |
tree | b13bf45e4cb2ce850c1252eb9201906074ebc210 /bfd/elf32-m32c.c | |
parent | bcd68f9e44a70c73bde08e612a28e413570dc039 (diff) | |
download | gdb-6a40cf0c5c845683fdb82721813ebd5dd867cce5.zip gdb-6a40cf0c5c845683fdb82721813ebd5dd867cce5.tar.gz gdb-6a40cf0c5c845683fdb82721813ebd5dd867cce5.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf32-m32c.c')
-rw-r--r-- | bfd/elf32-m32c.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index 953f00e..b2db4f5 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -1473,8 +1473,11 @@ m32c_elf_relax_section || (sec->flags & SEC_CODE) == 0) return TRUE; - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + symtab_hdr = & elf_symtab_hdr (abfd); + if (elf_symtab_shndx_list (abfd)) + shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr; + else + shndx_hdr = NULL; /* Get the section contents. */ if (elf_section_data (sec)->this_hdr.contents != NULL) @@ -1495,7 +1498,7 @@ m32c_elf_relax_section symtab_hdr->contents = (bfd_byte *) intsyms; } - if (shndx_hdr->sh_size != 0) + if (shndx_hdr && shndx_hdr->sh_size != 0) { bfd_size_type amt; @@ -2043,8 +2046,16 @@ m32c_elf_relax_delete_bytes isymend = isym + symtab_hdr->sh_info; sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec); - shndx_hdr = & elf_tdata (abfd)->symtab_shndx_hdr; - shndx_buf = (Elf_External_Sym_Shndx *) shndx_hdr->contents; + if (elf_symtab_shndx_list (abfd)) + { + shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr; + shndx_buf = (Elf_External_Sym_Shndx *) shndx_hdr->contents; + } + else + { + shndx_hdr = NULL; + shndx_buf = NULL; + } shndx = shndx_buf; for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL)) |