elf_link_hash_entry vs generic_link_hash_entry

Nick Clifton nickc@cambridge.redhat.com
Wed Aug 22 00:44:00 GMT 2001


Hi Guys,

  Ian Taylor has pointed out that my recent patch to elfxx-target.h
  has actually broken several elf based ports.  (Specifically: pj,
  m88k, m68hc11, m68hc12, i960, d30v, arc, gen).  The problem is that
  these ports uses the generic linker code to perform section
  relocation rather than having their own specific code.  This breaks
  if the elf hash table structure (elf_link_hash_entry) is used
  instead of the generic_link_hash_entry structure, since the two
  structures are not compatable.  The reason that my patch changed
  elfxx-target.h so that all elf backends would use elf_link_hash_entry
  is that several other parts of the elf linker rely upon using other
  fields which are only found in that structure.

  As I see there are three ways that we can fix this:

   1. Require that all ELF backends define their own section
      relocation function and final link function.  Make it a #error
      if they do not.  Fix all the ports that currently do not do
      this.  This is Ian's recommended solution.

   2. Add the fields from generic_link_hash_entry to
      elf_link_hash_entry so that the generic functions can be used
      with the elf structure.  This is my preferred solution, but as
      Ian points out, this will increase the size of the hash table
      and that is already a significant memory hog.

   3. Go back to the old situation where elf ports that do not provide
      their own relocation backends use the generic linker hash table
      entry structure, but add code to the other elf routines to
      detect this and fail before they try to access fields in the
      hash structure that are not there.

  Any comments ?

Cheers
        Nick





More information about the Binutils mailing list