PATCH: PR binutils/6412: New binutils is incompatible with old object files
H.J. Lu
hjl.tools@gmail.com
Mon Apr 21 22:07:00 GMT 2008
On Fri, Apr 18, 2008 at 3:32 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Hi,
>
> This is the patch for readelf to handle old object files. It checks if
> one of sh_link in section header table >= number of sections. It
> works on object files generated by GNU assembler and linker
> since they put the .strtab section at the end of section header
> table.
>
> I will use the similar approach in bfd. I think gold should also
> support old object files.
>
Hi,
Here is the patch for bfd and readelf. OK to install?
Thanks.
H.J.
---
bfd/
2008-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/6412
* bfd.c (bfd): Add has_gap_in_elf_shndx.
* bfd-in2.h: Regenerated.
* bfd-in.h (bfd_has_gap_in_elf_shndx): New.
* elf.c (setup_group): Handle gap in section indices.
* elfcode.h (elf_swap_symbol_in): Likewise.
(elf_object_p): Likewise. Use %B where reporting corrupt
string table index.
include/elf/
2008-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/6412
* internal.h (ELF_SECTION_HEADER_INDEX_GAP): New.
2008-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/6412
* readelf.c (hole_in_shndx): New.
(original_shndx_info): Likewise.
(original_shndx): Likewise.
(process_file_header): Move ELF magic bytes check to ...
(get_file_header): Here.
(get_32bit_section_headers): Set hole_in_shndx if sh_link
>= number of sections.
(get_64bit_section_headers): Likewise.
(get_32bit_elf_symbols): Adjust st_shndx if hole_in_shndx
isn't 0.
(get_64bit_elf_symbols): Likewise.
(process_section_headers): Adjust elf_header.e_shstrndx,
sh_link and sh_info, save original sh_link and sh_info,
display adjustment for sh_link and sh_info if hole_in_shndx
isn't 0.
(process_section_groups): Adjust member section index if
hole_in_shndx isn't 0.
(process_object): Free original_shndx if needed.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sec64k.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20080421/958e76e2/attachment.txt>
More information about the Binutils
mailing list