a problem with ld options
Nick Clifton
nickc@redhat.com
Mon Oct 25 09:57:00 GMT 2004
Hi Chenyu,
>> readelf try.o -r
>> readelf try.out -r
>> The first readelf works well, but the second exits with segment fault.
>
>
> Well, that's at least two bugs. readelf shouldn't segfault, and ld -q
> ought to work. :-(
Attached is a patch for the first bug. It fixes readelf so that it no
longer assumes that the string table offset for dynamic relocs will be a
valid offset into the dynamic string table. Instead it checks and
prints a suitable error message if a corrupt index is found. I will be
applying this patch shortly.
Cheers
Nick
binutils/ChangeLog
2004-10-25 Nick Clifton <nickc@redhat.com>
* readelf.c (dynamic_strings_length): New global variable.
(VALID_DYNAMIC_NAME, GET_DYNAMIC_NAME): New macros for accessing
strings in the dynamic string table.
(process_section_headers): Initialise dynamic_strings_length.
(process_dynamic_section): Likewise.
(process_object): Reset dynamic_string_length when the buffer is freed.
(dynamic_sections_mips_val): Use the new macros.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(process_symbol_table): Likewise.
(process_syminfo): Likewise.
(process_mips_specific): Likewise.
(dump_relocations): Add a new parameter 'strtablen' and use this
to verify that string offset in a given reloc is valid. Print a
suitable error message otherwise.
(process_relocs): Pass the new argument to dump_relocations.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: readelf.c.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20041025/3685a258/attachment.ksh>
More information about the Binutils
mailing list