This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
sh-elf shared library dilemma
- To: binutils at sources dot redhat dot com
- Subject: sh-elf shared library dilemma
- From: Richard Henderson <rth at redhat dot com>
- Date: Fri, 9 Feb 2001 09:50:14 -0800
Consider a test like
.data
.long 0
label: .long label
that is, we have a non-global symbol at a non-zero section offset.
This results in a relocation against ".data+4".
The problem is that ld.so, for REL targets, applies a RELATIVE relocation
like mem += load_addr. For RELA targets it applies the relocation as
mem = load_addr + addend.
We treat basicly all relocs as partial-in-place on sh-elf. Probably
because coff did and it allowed more code to be copied. But we're a
RELA target because some of the relaxation relocs abuse the addend to
store data. The result of this is that we lose the addend at runtime.
I see two solutions:
(1) Stop doing partial-in-place stuff and use the RELA addend
as it's supposed to.
(2) Leave the object file relocations alone and use REL dynamic
relocations.
Both solutions have binary compatibility issues: the later only
affects sh-linux; the former affects everyone. The former seems
more Correct.
So: I'm soliciting opinions from those affected by this problem.
r~