]> git.proxmox.com Git - qemu.git/commitdiff
Fix missing symbols in .rel/.rela.plt sections
authorLoïc Minier <lool@dooz.org>
Sun, 31 Jan 2010 11:22:52 +0000 (12:22 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 2 Jun 2010 18:45:03 +0000 (20:45 +0200)
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 multilib libc.a.  This fixes the static build
under i386.

Apply similar logic to rela.plt/.iplt and __rela_iplt/_plt_start/_end to
fix the static build under amd64.

Signed-off-by: Loïc Minier <lool@dooz.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 845f2c2812d9ed24b36c02a3d06ee83aeafe8b49)

i386.ld
x86_64.ld

diff --git a/i386.ld b/i386.ld
index f2dafecc1a5f3ca01d96830670212ee7fddb07b3..f8df7bf8dd66fffb768e14f9aa14397f5177b522 100644 (file)
--- a/i386.ld
+++ b/i386.ld
@@ -39,8 +39,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      :
   {
index 24ea77dadf7f7526f3ca8a819beca18da8f2ba9f..46d8d4d9ddf24d1eca5b1c8120f4b1eea6425e15 100644 (file)
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -35,8 +35,20 @@ SECTIONS
   .rela.got       : { *(.rela.got) }
   .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))