* [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections
@ 2010-01-17 11:59 Loïc Minier
2010-01-19 13:57 ` Loïc Minier
0 siblings, 1 reply; 2+ messages in thread
From: Loïc Minier @ 2010-01-17 11:59 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]
Hi there,
Static builds of qemu on x86-64 (and probably i386) fail with:
gcc -I/home/lool/git/savannah/qemu/slirp -Werror -m64 -Wold-style-definition -Wold-style-declaration -I. -I/home/lool/git/savannah/qemu -U_FORTIFY_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -I/home/lool/git/savannah/qemu/fpu -I/home/lool/git/savannah/qemu/tcg -I/home/lool/git/savannah/qemu/tcg/x86_64 -I.. -I/home/lool/git/savannah/qemu/target-arm -DNEED_CPU_H -I/home/lool/git/savannah/qemu/linux-user -I/home/lool/git/savannah/qemu/linux-user/arm -O2 -g -static -Wl,--warn-common -m64 -g -Wl,-T../config-host.ld -Wl,-T,/home/lool/git/savannah/qemu/x86_64.ld -o qemu-arm main.o syscall.o strace.o mmap.o signal.o thunk.o elfload.o linuxload.o uaccess.o gdbstub.o flatload.o gdbstub-xml.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o -Wl,--whole-archive ../libuser/libuser.a libqemu.a -Wl,--no-whole-archive -lrt -lpthread -lm
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0xd4): undefined reference to `__rela_iplt_end'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0xe5): undefined reference to `__rela_iplt_start'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0x100): undefined reference to `__rela_iplt_start'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0x10a): undefined reference to `__rela_iplt_start'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0x10f): undefined reference to `__rela_iplt_start'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/libc.a(elf-init.o): In function `__libc_csu_irel':
(.text+0x114): undefined reference to `__rela_iplt_start'
collect2: ld returned 1 exit status
This is due to changes in binutils + glibc, qemu's linker script need
to be adjusted to include these symbols. qemu's scripts weren't
copying the .rela.iplt section at all, so I included this section and
the __rela_iplt_start and __rela_iplt_end arount it.
Tested by building qemu in static and shared mode for the
arm-softmmu,i386-softmmu,x86_64-softmmu,arm-linux-user,i386-linux-user,x86_64-linux-user
target-list; I also ran qemu for almost all combinations.
Thanks,
--
Loïc Minier
[-- Attachment #2: 0001-Fix-missing-symbols-in-.rela.plt-sections.patch --]
[-- Type: text/x-diff, Size: 1882 bytes --]
>From ac0fe6dabaf05bf434e9c57d4f9b61d73f660e3c 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 .rela.plt sections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix .rela.plt sections in the output to not only include .rela.plt
sections from the input but also the .rela.iplt sections and to define
the hidden symbols __rela_iplt_start and __rela_iplt_end around
.rela.iplt as otherwise we get undefined references to these when
linking statically to a multilib libc.a.
Signed-off-by: Loïc Minier <lool@dooz.org>
---
i386.ld | 8 +++++++-
x86_64.ld | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/i386.ld b/i386.ld
index f2dafec..bb245a7 100644
--- a/i386.ld
+++ b/i386.ld
@@ -40,7 +40,13 @@ SECTIONS
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
- .rela.plt : { *(.rela.plt) }
+ .rela.plt :
+ {
+ *(.rela.plt)
+ PROVIDE_HIDDEN (__rela_iplt_start = .);
+ *(.rela.iplt)
+ PROVIDE_HIDDEN (__rela_iplt_end = .);
+ }
.init : { *(.init) } =0x47ff041f
.text :
{
diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..684d2d7 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -36,7 +36,13 @@ SECTIONS
.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) }
+ .rela.plt :
+ {
+ *(.rela.plt)
+ PROVIDE_HIDDEN (__rela_iplt_start = .);
+ *(.rela.iplt)
+ PROVIDE_HIDDEN (__rela_iplt_end = .);
+ }
.init :
{
KEEP (*(.init))
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections
2010-01-17 11:59 [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections Loïc Minier
@ 2010-01-19 13:57 ` Loïc Minier
0 siblings, 0 replies; 2+ messages in thread
From: Loïc Minier @ 2010-01-19 13:57 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 438 bytes --]
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,
--
Loïc Minier
[-- Attachment #2: 0001-Fix-missing-symbols-in-.rel-.rela.plt-sections.patch --]
[-- Type: text/x-diff, Size: 2443 bytes --]
>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(-)
diff --git a/i386.ld b/i386.ld
index f2dafec..f8df7bf 100644
--- 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 :
{
diff --git a/x86_64.ld b/x86_64.ld
index 24ea77d..46d8d4d 100644
--- 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))
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-19 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 11:59 [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections Loïc Minier
2010-01-19 13:57 ` Loïc Minier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).