A DT_INIT/DT_FINI glibc patch.

Alan Modra alan@linuxcare.com.au
Tue, 21 Nov 2000 14:22:53 +1100 (EST)


On Mon, 20 Nov 2000, Grant Grundler wrote:

> I'm afraid we will break binary compatibility for elf32 hppa-linux again.
> I only raise this in case there is really a "right" way to fix the
> DT_INIT/DT_FINI problem.

The fix involves pruning out all the special handling in bfd/elf32-hppa.c
for DT_INIT,DT_FINI, and making some small changes to glibc.  H.J. Lu has
already made the necessary framework changes, and all we need to do is
something like

#define DL_FUNCTION_ADDRESS(map, addr) _dl_start_address (map, addr)
#define DL_DT_INIT_ADDRESS(map, addr) \
  ((addr) & 2 ? (addr) : DL_FUNCTION_ADDRESS (map, addr))

with similar defines for DT_FINI.  The test for (addr) & 2 is the
fairly innocuous fudge to support old binaries.


Another glibc issue (which is why I'm sending this back to the list) is
that there has been quite some discussion on the binutils list over the
use of the EI_OSABI field.  The conclusion being that it isn't really
correct to use this field to discern the intendend execution platform.
It's purpose is really to tell ELF tools that a file contains fields and
values that need to be interpreted in a non-standard way.  Since both
elf32-hppa and elf64-hppa follow the standards, I'm inclined to think that
the gnu tools should set EI_OSABI to zero for both HPUX and Linux targets.

Instead the .note.ABI-tag section should be examined to determine the
target, which sadly isn't set correctly at the moment.  :-(

Alan Modra
-- 
Linuxcare.  Support for the Revolution.