Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWTnD-0003cx-5j for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:59:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWTn8-0003T8-CR for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:59:42 -0500 Received: from [199.232.76.173] (port=35400 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWTn8-0003Se-5z for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:59:38 -0500 Received: from duck.dooz.org ([194.146.227.125]:34108) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWTn7-0000F6-Ju for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:59:37 -0500 Received: from bee.dooz.org (serris.dooz.org [88.166.229.232]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by duck.dooz.org (Postfix) with ESMTP id DC8A3C809C for ; Sun, 17 Jan 2010 12:59:36 +0100 (CET) Date: Sun, 17 Jan 2010 12:59:32 +0100 From: =?iso-8859-1?Q?Lo=EFc?= Minier Message-ID: <20100117115932.GB23875@bee.dooz.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="R3G7APHDIzY6R/pk" Content-Disposition: inline Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --R3G7APHDIzY6R/pk Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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-definitio= n -Wold-style-declaration -I. -I/home/lool/git/savannah/qemu -U_FORTIFY_SOU= RCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE -Wstrict-pro= totypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmi= ssing-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 flatloa= d.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 nwfp= e/extended_cpdo.o arm-semi.o -Wl,--whole-archive ../libuser/libuser.a libqe= mu.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, --=20 Lo=EFc Minier --R3G7APHDIzY6R/pk Content-Type: text/x-diff; charset=iso-8859-1 Content-Disposition: attachment; filename="0001-Fix-missing-symbols-in-.rela.plt-sections.patch" Content-Transfer-Encoding: quoted-printable >From ac0fe6dabaf05bf434e9c57d4f9b61d73f660e3c Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Lo=3DC3=3DAFc=3D20Minier?=3D 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=3DUTF-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=EFc Minier --- 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 =3D .); + *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end =3D .); + } .init : { *(.init) } =3D0x47ff041f .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 =3D .); + *(.rela.iplt) + PROVIDE_HIDDEN (__rela_iplt_end =3D .); + } .init : { KEEP (*(.init)) --=20 1.6.5 --R3G7APHDIzY6R/pk--