This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR binutils/6412: New binutils is incompatible with old object files


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.


H.J.
----
2008-04-18  H.J. Lu  <hongjiu.lu@intel.com>

        PR binutils/6412
        * readelf.c (hole_in_shndx): New.
        (original_shndx_info): Likewise.
        (original_shndx): Likewise.
        (SECTION_HEADER_INDEX_GAP): 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.

Attachment: 64k.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]