This is the mail archive of the binutils@sources.redhat.com 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]

Re: Always use _bfd_elf_link_hash_table_create


Nick Clifton <nickc@cambridge.redhat.com> writes:

[ Switched from bug-binutils to binutils ]

>   Joern recently pointed out to me that elfxx-target.h is only
>   defining bfd_elfNN_bfd_link_hash_table_create as the elf specific
>   version if elf_backend_relocate_section is defined.
> 
>   Presumably it used to be true that elf specific fields in the hash
>   table were only needed if the backend was going to perform its own
>   relocations.  This is no longer true however, as for example the
>   'dynobj' field is used by size_dynamic_sections even if the generic
>   section relocator is being used.
> 
>   Fixed by applying the following patch.  Tested against Linux native
>   and sh-elf cross targets.

I'm pretty sure this patch is incorrect, and will break ELF targets
which use the generic linker.  The generic linker uses it's own hash
table, defined in genlink.h.  If you create a different hash table,
the hash table entries will be defined incorrectly (compare
generic_link_hash_entry and elf_link_hash_entry).

Admittedly ELF targets should preferentially use the ELF linker rather
than the generic linker.  But the fix then should be to force an error
if elf_backend_relocate_section is not defined.

Ian


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