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: elf_link_hash_entry vs generic_link_hash_entry


On Fri, Aug 24, 2001 at 05:32:19PM +0100, Nick Clifton wrote:
> 
> I had to make one change though - I reverted the definition of
> elf_hash_table() back to its original version, since it cannot be
> allowed to return NULL.  (It is used in too many places as the first
> argument to elf_link_hash_lookup).  Instead I created a new macro
> called 'is_elf_hash_table' and I added code to check it in
> elf_link_add_object_symbols(), like this.
> 

I don't like it. I prefer elf_hash_table

1. Returns NULL on generic hash table

#define elf_hash_table(p)	\
  ((struct elf_link_hash_table *) \
     (((p)->hash->type == bfd_link_elf_hash_table) ? (p)->hash : NULL))

so that ld gets a core dump. Or

2. Aborts on generic hash table

#define elf_hash_table(p)	\
  ((struct elf_link_hash_table *) \
     (((p)->hash->type == bfd_link_elf_hash_table)
      ? (p)->hash : (abort (), NULL)))

so that we can catch all the bogus code.


H.J.


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