From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VogQE-0004jW-5R for qemu-devel@nongnu.org; Thu, 05 Dec 2013 16:25:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VogQ5-0000cs-Ow for qemu-devel@nongnu.org; Thu, 05 Dec 2013 16:25:22 -0500 Received: from mail-yh0-x230.google.com ([2607:f8b0:4002:c01::230]:45848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VogQ5-0000co-KL for qemu-devel@nongnu.org; Thu, 05 Dec 2013 16:25:13 -0500 Received: by mail-yh0-f48.google.com with SMTP id f73so12928623yha.7 for ; Thu, 05 Dec 2013 13:25:13 -0800 (PST) Sender: Richard Henderson Message-ID: <52A0EF2B.9000905@twiddle.net> Date: Fri, 06 Dec 2013 10:24:59 +1300 From: Richard Henderson 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> In-Reply-To: <52A09933.5090302@redhat.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: Paolo Bonzini , Don Slutz Cc: qemu-devel@nongnu.org, xen-devel@lists.xensource.com, 1257099@bugs.launchpad.net, Stefano Stabellini , Ian Campbell 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~