Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXEaR-0007Nj-IC for qemu-devel@nongnu.org; Tue, 19 Jan 2010 08:57:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXEaM-0007N5-7e for qemu-devel@nongnu.org; Tue, 19 Jan 2010 08:57:38 -0500 Received: from [199.232.76.173] (port=48390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXEaM-0007N2-3a for qemu-devel@nongnu.org; Tue, 19 Jan 2010 08:57:34 -0500 Received: from duck.dooz.org ([194.146.227.125]:48825) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXEaL-00053J-4P for qemu-devel@nongnu.org; Tue, 19 Jan 2010 08:57:33 -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 6C1ACC809C for ; Tue, 19 Jan 2010 14:57:31 +0100 (CET) Date: Tue, 19 Jan 2010 14:57:30 +0100 From: =?iso-8859-1?Q?Lo=EFc?= Minier Subject: Re: [Qemu-devel] [PATCH] Fix missing symbols in .rela.plt sections Message-ID: <20100119135730.GA6325@bee.dooz.org> References: <20100117115932.GB23875@bee.dooz.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline In-Reply-To: <20100117115932.GB23875@bee.dooz.org> Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 17, 2010, Lo=EFc 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, --=20 Lo=EFc Minier --Q68bSM7Ycu6FN28Q Content-Type: text/x-diff; charset=iso-8859-1 Content-Disposition: attachment; filename="0001-Fix-missing-symbols-in-.rel-.rela.plt-sections.patch" Content-Transfer-Encoding: quoted-printable >From a3582e37351596119e947b0606021aedb19b6f61 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 .rel/.rela.plt sections MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-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=EFc Minier --- 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 =3D .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end =3D .); + } + .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..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 =3D .); + *(.rel.iplt) + PROVIDE_HIDDEN (__rel_iplt_end =3D .); + } + .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 --Q68bSM7Ycu6FN28Q--