Subject: base-relative relocations
To: None <firstname.lastname@example.org>
From: Charles M. Hannum <email@example.com>
Date: 08/06/1998 04:21:31
As some of you know, I've been looking at the disgusting hacks in the
arm32 version of ld(1) and ld.so(1). I more or less have all of the
problems fixed, but there's one unresolved issue...
Our version of gas on other a.out platforms outputs base-relative
relocations with addends that are symbol-relative, whereas BFD (and
thus the new gas) outputs addends that are base-relative. The linker
(both ld and ld.so) expect the symbol-relative addends.
There are a couple of solutions to this:
1) Change the linker to deal with the base-relative addends, only on
the ARM platform. The easy way to do this would be to adjust the
addend on input and output; unfortunately this is not so easy given
the structure of the linker, because part of the information needed
to do the base-relative fixup is thrown away too early. (I need to
know what the offset of the symbol was in the input file.)
The current arm32 patch has a different approach to this which
causes the symbol-relative offset to be removed, which has great
Obviously this can only be done for arm32 (and new platforms), or
it will break compatibility with old libraries and object files.
2) Change BFD/gas to grok the symbol-relative addends. I stared at
the code for quite a while, and I couldn't figure it out. Maybe
someone else can.
This is going to be necessary to use the new BFD/gas on other a.out
ports, so it has to be done eventually anyway. In addition, since
other changes necessitate breaking compatibility on the arm32 port,
it doesn't hurt there.
Other than that, I have the arm32 code more or less working (doing
run-time copies of data items and everything) without any changes in
the MI code.
Could someone who groks BFD figure out how to make it DTRT here?