diff mbox

ppc-linux-user: Fix missing symbols in .rel/.rela.plt sections

Message ID 1325967395-1633-1-git-send-email-aurelien@aurel32.net
State New
Headers show

Commit Message

Aurelien Jarno Jan. 7, 2012, 8:16 p.m. UTC
Fix .rel.plt sections in the output to not only include .rel.plt
sections from the input but also the .rel.iplt sections and to define
the hidden symbols __rel_iplt_start and __rel_iplt_end around
.rel.iplt as otherwise we get undefined references to these when
linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 ppc.ld |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

Comments

Alexander Graf Jan. 9, 2012, 1:31 p.m. UTC | #1
On 07.01.2012, at 21:16, Aurelien Jarno wrote:

> Fix .rel.plt sections in the output to not only include .rel.plt
> sections from the input but also the .rel.iplt sections and to define
> the hidden symbols __rel_iplt_start and __rel_iplt_end around
> .rel.iplt as otherwise we get undefined references to these when
> linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).

Please see:

http://patchwork.ozlabs.org/patch/130932/

I'd still say that we should fix the linker scripts regardless. Also for 1.0.


Alex
Aurelien Jarno Jan. 9, 2012, 11:06 p.m. UTC | #2
On Mon, Jan 09, 2012 at 02:31:15PM +0100, Alexander Graf wrote:
> 
> On 07.01.2012, at 21:16, Aurelien Jarno wrote:
> 
> > Fix .rel.plt sections in the output to not only include .rel.plt
> > sections from the input but also the .rel.iplt sections and to define
> > the hidden symbols __rel_iplt_start and __rel_iplt_end around
> > .rel.iplt as otherwise we get undefined references to these when
> > linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).
> 
> Please see:
> 
> http://patchwork.ozlabs.org/patch/130932/
> 
> I'd still say that we should fix the linker scripts regardless. Also for 1.0.

I agree that we should either remove them or fix them. Not fixing them
because they should not be there, but at the same time not removing
them is a bad idea.

On my side I have also tested that it can work with PROVIDE instead of
PROVIDE_HIDDEN, so we end-up with the same patches. Now how should we
proceed to merge that to master, which is the first step before getting
that into stable?
Alexander Graf Jan. 9, 2012, 11:11 p.m. UTC | #3
On 10.01.2012, at 00:06, Aurelien Jarno wrote:

> On Mon, Jan 09, 2012 at 02:31:15PM +0100, Alexander Graf wrote:
>> 
>> On 07.01.2012, at 21:16, Aurelien Jarno wrote:
>> 
>>> Fix .rel.plt sections in the output to not only include .rel.plt
>>> sections from the input but also the .rel.iplt sections and to define
>>> the hidden symbols __rel_iplt_start and __rel_iplt_end around
>>> .rel.iplt as otherwise we get undefined references to these when
>>> linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).
>> 
>> Please see:
>> 
>> http://patchwork.ozlabs.org/patch/130932/
>> 
>> I'd still say that we should fix the linker scripts regardless. Also for 1.0.
> 
> I agree that we should either remove them or fix them. Not fixing them
> because they should not be there, but at the same time not removing
> them is a bad idea.
> 
> On my side I have also tested that it can work with PROVIDE instead of
> PROVIDE_HIDDEN, so we end-up with the same patches. Now how should we
> proceed to merge that to master, which is the first step before getting
> that into stable?

Either apply yours and rebase mine on top, so ppc64 is fixed too, or apply mine :). I'm rather indifferent on that one.


Alex
Aurelien Jarno Jan. 10, 2012, 5:29 p.m. UTC | #4
On Tue, Jan 10, 2012 at 12:11:33AM +0100, Alexander Graf wrote:
> 
> On 10.01.2012, at 00:06, Aurelien Jarno wrote:
> 
> > On Mon, Jan 09, 2012 at 02:31:15PM +0100, Alexander Graf wrote:
> >> 
> >> On 07.01.2012, at 21:16, Aurelien Jarno wrote:
> >> 
> >>> Fix .rel.plt sections in the output to not only include .rel.plt
> >>> sections from the input but also the .rel.iplt sections and to define
> >>> the hidden symbols __rel_iplt_start and __rel_iplt_end around
> >>> .rel.iplt as otherwise we get undefined references to these when
> >>> linking statically to a multiarch enabled libc (using STT_GNU_IFUNC).
> >> 
> >> Please see:
> >> 
> >> http://patchwork.ozlabs.org/patch/130932/
> >> 
> >> I'd still say that we should fix the linker scripts regardless. Also for 1.0.
> > 
> > I agree that we should either remove them or fix them. Not fixing them
> > because they should not be there, but at the same time not removing
> > them is a bad idea.
> > 
> > On my side I have also tested that it can work with PROVIDE instead of
> > PROVIDE_HIDDEN, so we end-up with the same patches. Now how should we
> > proceed to merge that to master, which is the first step before getting
> > that into stable?
> 
> Either apply yours and rebase mine on top, so ppc64 is fixed too, or apply mine :). I'm rather indifferent on that one.
> 

I have just applied yours.
diff mbox

Patch

diff --git a/ppc.ld b/ppc.ld
index 69aa3f2..1c0bcf1 100644
--- a/ppc.ld
+++ b/ppc.ld
@@ -49,8 +49,20 @@  SECTIONS
   .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
   .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.plt        : { *(.rel.plt) }
-  .rela.plt       : { *(.rela.plt) }
+  .rel.plt      :
+  {
+    *(.rel.plt)
+    PROVIDE_HIDDEN (__rel_iplt_start = .);
+    *(.rel.iplt)
+    PROVIDE_HIDDEN (__rel_iplt_end = .);
+  }
+  .rela.plt       :
+  {
+    *(.rela.plt)
+    PROVIDE_HIDDEN (__rela_iplt_start = .);
+    *(.rela.iplt)
+    PROVIDE_HIDDEN (__rela_iplt_end = .);
+  }
   .init           :
   {
     KEEP (*(.init))