This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Fix Thumb-2 shared libraries
- From: Christophe LYON <christophe dot lyon at st dot com>
- To: binutils at sourceware dot org
- Date: Wed, 26 Aug 2009 11:01:47 +0200
- Subject: Re: Fix Thumb-2 shared libraries
- References: <4A324BAC.7090702@redhat.com> <4A3255D9.9030906@st.com> <20090612140642.GA31950@caradoc.them.org> <4A32626C.8090407@st.com> <4A3658C4.3000800@st.com> <20090615175935.GA22200@caradoc.them.org> <4A390CF5.3000505@st.com> <20090617162337.GA9315@caradoc.them.org> <4A3A4DEF.5070704@st.com> <4A3A4E62.8030603@st.com> <20090825185158.GA2712@caradoc.them.org>
On 25.08.2009 20:51, Daniel Jacobowitz wrote:
> Unfortunately, this patch breaks Thumb-2 shared libraries.
Would you mind giving an example?
But now the symbol table still points to the Thumb code, and we've
marked the entry as STT_FUNC. It ends up without the ISA bit set.
This causes R_ARM_JUMP_SLOT relocations to jump to the target function
as if it were ARM code - does not work.
I expected this part of allocate_dynrelocs() to be used only by
CALL-like relocs, and thought it was better to fix the definition in one
place, rather than several uses, which is error prone.
If I revert just this part of your patch, there is one additional
failure in the testsuite (thanks, as usual, for test cases!). We use
blx to branch to the PLT entry, so I assume that's what this hunk was
for. We have to change the use of the symbol in this case, rather
than the definition.
Agreed.
The test still needs a fixup, because the version that's there now
would not work at runtime. It has:
.* <__lib_func3_from_thumb>:
.*: e59fc000 ldr ip, \[pc, #0\] ; 1000364 <__lib_func3_from_thumb\+0x8>
.*: e08ff00c add pc, pc, ip
.*: feffff90 .word 0xfeffff90
That will branch to lib_func3 in ARM mode, but lib_func3 is a Thumb
function.
Good catch! Sorry not to have noticed this, despite having re-read my
patch quite a few times before committing!
Here's a patch I'm testing for this failure.
It seems OK, but I think you forgot to add a test case :-)
Christophe.