This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

sh-elf shared library dilemma


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]