From a3582e37351596119e947b0606021aedb19b6f61 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <lool@dooz.org>
Date: Sun, 17 Jan 2010 12:09:38 +0100
Subject: [PATCH] Fix missing symbols in .rel/.rela.plt sections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
i386.ld | 16 ++++++++++++++--
x86_64.ld | 16 ++++++++++++++--
2 files changed, 28 insertions(+), 4 deletions(-)
@@ -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 :
{
@@ -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))
--
1.6.5
On Sun, Jan 17, 2010, Loïc Minier wrote: > Static builds of qemu on x86-64 (and probably i386) fail After actually checking in an i386 Ubuntu lucid chroot, I found out that ld uses .rel.plt and .rel.iplt instead of .rela.plt and .rela.iplt. I've applied the same fixes to the two .ld scripts and could build static flavors of qemu-linux-user on both with the updated patch in attachment. Thanks,