This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
64k+-sections-change causes problems preserving section info in elf_object_p and elf_core_file_p
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: amodra at bigpond dot net dot au
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 18 Dec 2001 02:55:41 +0100
- Subject: 64k+-sections-change causes problems preserving section info in elf_object_p and elf_core_file_p
See most test-cases fail on cris-elf, objdump outputting section
data twice. You'd probably see it with --enable-all-targets
too, excluding CRIS vectors.
This is because section info is supposed to be preserved over
calls to elf_object_p (and elf_core_file_p), so
bfd_check_format_matches can try different targets on the same
bfd. However, it's no longer enough to preserve the sections
pointer and sections count; there's now also a section_tail
pointer and a hash-table.
For the case at hand, --target=cris-elf, there are two
non-generic elf targets, elf32-us-cris and elf32-cris. The
match order in bfd_check_format_matches is to try elf32-us-cris
then elf32-cris. The second call causes sections to appear
twice due to the change in section info in a bfd. The failure
is similar to those linked at
<URL:http://sources.redhat.com/ml/binutils/2001-11/msg00061.html>.
I'll try to fix this by also preserving section_tail and
introducing a (shallow-)copy function bfd_hash_table_copy for
the sections hash table, calling it to copy the hash table into
a local copy and bfd_hash_table_free the one in bfd and
bfd_hash_table_copy it back on failure.
Other suggestions welcome. (Fixes too. ;-)
brgds, H-P