This is the mail archive of the 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]

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

On Fri, Apr 18, 2008 at 3:32 PM, H.J. Lu <> 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.


Here is the patch for bfd and readelf. OK to install?



2008-04-21  H.J. Lu  <>

        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.


2008-04-21  H.J. Lu  <>

        PR binutils/6412
        * internal.h (ELF_SECTION_HEADER_INDEX_GAP): New.

2008-04-21  H.J. Lu  <>

        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.

Attachment: sec64k.txt
Description: Text document

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