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

Blue Swirl <blauwir...@gmail.com>
Signed-off-by: Aurelien Jarno <aurel...@aurel32.net>
---
 sparc.ld |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/sparc.ld b/sparc.ld
index 56efe34..e52c3d2 100644
--- a/sparc.ld
+++ b/sparc.ld
@@ -37,8 +37,20 @@ SECTIONS
   .rela.fini     : { *(.rela.fini)      }
   .rel.bss       : { *(.rel.bss)                }
   .rela.bss      : { *(.rela.bss)               }
-  .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          : { *(.init)   } =0x47ff041f
   .text      :
   {
-- 
1.7.7.3


Reply via email to