Skip to contentSkip to conversation

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

PATCH In review Aurelien Jarno 2 participants 5 messages Jan 7, 2012 – Jan 10, 2012

lore
Share & tools
lore
#0 lore raw

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

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).

---
 ppc.ld |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
ppc.ld +14 -2
index 69aa3f2..1c0bcf1 100644
@@ -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))
Signature · 1 line
1.7.7.3
#1 lore raw
Quoted 5 lines · Aurelien Jarno

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

#2 lore raw
Quoted 9 lines · Alexander Graf
Quoted 5 lines · Aurelien Jarno

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).

Quoted 5 lines

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?

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw
Quoted 16 lines · Aurelien Jarno
Quoted 9 lines · Alexander Graf
Quoted 5 lines · Aurelien Jarno

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).

Quoted 5 lines

Please see:

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

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

Quoted 8 lines

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

#4 lore raw
Quoted 23 lines · Alexander Graf
Quoted 20 lines · Aurelien Jarno
Quoted 9 lines · Alexander Graf
Quoted 5 lines · Aurelien Jarno

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).

Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net