From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H . J . Lu" To: Nick Clifton Cc: binutils@sources.redhat.com, Ian Lance Taylor Subject: Re: elf_link_hash_entry vs generic_link_hash_entry Date: Fri, 24 Aug 2001 10:02:00 -0000 Message-id: <20010824100230.A5440@lucon.org> References: <20010823092140.A15101@lucon.org> <20010823113656.A17692@lucon.org> <20010823120958.A18304@lucon.org> X-SW-Source: 2001-08/msg00567.html 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.