Subject: a.out ld.so problems
To: None <tech-toolchain@NetBSD.ORG>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-toolchain
Date: 07/26/1998 12:16:36
I have some problems with our a.out ld.so and my port of binutils, and
ld.so is slightly too magic for me to play with at the moment...


The problem:
When binutils 2.8 generates PIC code, it uses relocations against the data
section for code of the following type (even though foo is global)

   void *foo = &foo;

But ld.so doesn't relocate this correctly:

   (gdb) p &foo
   $1 = (void **) 0xbadc
   (gdb) p foo
   $2 = (void *) 0x40026068

This seems to be due to ld.so doing the relocations in a memory area 
different from where the data will be placed, and then copies the data
without compensating the relocation.


I'd be really happy if someone could look into this (or at lest give me
some ideas how to fix ld.so), since it is one of the two issues remaining
for my binutils port to be useable. (I will probably have to change the 
behaviour of binutils, or else it will not be possible to use it with
NetBSD-1.3 or older, but it would simplify my job if I could keep this
behaviour for the moment.)

   /Krister