From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq0o1-0001YW-6j for qemu-devel@nongnu.org; Mon, 09 Dec 2013 08:23:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vq0nu-0006ES-VA for qemu-devel@nongnu.org; Mon, 09 Dec 2013 08:23:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vq0nu-0006EO-Ly for qemu-devel@nongnu.org; Mon, 09 Dec 2013 08:23:18 -0500 Message-ID: <52A5C3FF.2030809@redhat.com> Date: Mon, 09 Dec 2013 14:22:07 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20131202223641.6000.456.malonedeb@chaenomeles.canonical.com> <20131202223641.6000.456.malonedeb@chaenomeles.canonical.com> <529E1194.9060504@redhat.com> <529E8638.2010102@terremark.com> <52A09933.5090302@redhat.com> <52A0EF2B.9000905@twiddle.net> <52A1427D.6000307@terremark.com> <52A5BBE6.9070000@terremark.com> In-Reply-To: <52A5BBE6.9070000@terremark.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Don Slutz Cc: xen-devel@lists.xensource.com, Ian Campbell , Stefano Stabellini , qemu-devel@nongnu.org, 1257099@bugs.launchpad.net, Richard Henderson Il 09/12/2013 13:47, Don Slutz ha scritto: > On 12/05/13 22:20, Don Slutz wrote: >> On 12/05/13 16:24, Richard Henderson wrote: >>> On 12/06/2013 04:18 AM, Paolo Bonzini wrote: >>>> $ gcc -shared -o f.so f.c -fPIE -fPIC >>>> /usr/bin/ld: /tmp/ccQc9els.o: relocation R_X86_64_PC32 against `f' >>>> can not be used when making a shared object; recompile with -fPIC >>>> /usr/bin/ld: final link failed: Bad value >>>> collect2: ld returned 1 exit status >>>> >>>> >>>> The bug is simply that "-fPIE -fPIC" counts as -fPIE rather than -fPIC: >>>> >>>> $ gcc -S -o - f.c -fPIE |grep call >>>> call f # PC32 relocation >>>> $ gcc -S -o - f.c -fPIC |grep call >>>> call f@PLT # PLT32 relocation >>> The easy workaround is to drop -fPIE when we're adding -fPIC. >>> >>> >>> r~ > [snip] > > Attached is a much better version. It drops -fPIE and adds -fPIC for > libtool. It's not much better, because using position-independent code for shared libraries is really platform-dependent knowledge of the kind that libtool is supposed to hide. For example, on Mac OS X everything is position-independent by default. And on some platforms you have -fpic instead of -fPIC. So I prefer the patch you had that disabled libtool if the platform is buggy. Paolo