Subject: ld.elf_so changes
To: None <tech-userlevel@netbsd.org>
From: Charles Hannum <abuse@spamalicious.com>
List: tech-userlevel
Date: 09/12/2002 14:42:32
So, in the interest of fixing bugs, and making the MIPS ld.elf_so
relocatable, I plan to make the following change:

* Add a `relocbase' argument to _rtld() and _rtld_init(), which is
  passed in from the glue code in _rtld_start().  This will be used to
  set objself.relocbase.

The reason this is necessary is that the rather klugy code in
_rtld_init() makes the assumption that the VMA in the ELF headers is 0
on all platforms except MIPS, where it is the same as `mapbase'.  This
prevents link ld.elf_so at a non-0 address on other platforms, and
requires it to be loaded at the VMA address on MIPS.  By passing in
the empirically determined relocbase, both of these restrictions are
eliminated.

I can implement and test this on 9 platforms (and, given that I
already determine relocbase on those platforms to call
_rtld_relocate_nonplt_self(), it's rather trivial).  However, I cannot
test hppa (should be trivial), sh (doesn't work anyway), or x86_64
(there is no hardware available).  It should take Fredette ~5 minutes
to do hppa, and I assume that Frank can handle x86_64.

Therefore, I plan to make this change imminently.  Please note it will
BREAK hppa and x86_64 support in ld.elf_so until those ports are
updated.