From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VolzD-0000By-JZ for qemu-devel@nongnu.org; Thu, 05 Dec 2013 22:21:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Volz7-0005VQ-UE for qemu-devel@nongnu.org; Thu, 05 Dec 2013 22:21:51 -0500 Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:46298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Volz7-0005VM-Pf for qemu-devel@nongnu.org; Thu, 05 Dec 2013 22:21:45 -0500 From: Don Slutz Message-ID: <52A1427D.6000307@terremark.com> Date: Thu, 5 Dec 2013 22:20:29 -0500 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> In-Reply-To: <52A0EF2B.9000905@twiddle.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed 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: Richard Henderson Cc: xen-devel@lists.xensource.com, Ian Campbell , Stefano Stabellini , qemu-devel@nongnu.org, Don Slutz , 1257099@bugs.launchpad.net, Paolo Bonzini 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~ Here is a possible patch based on this statement: From 6e57382c58fa1b9be0fe9db8f35f53a7a7858ccd Mon Sep 17 00:00:00 2001 From: Don Slutz Date: Fri, 6 Dec 2013 03:12:12 +0000 Subject: [PATCH] configure: Auto disabling of libtool due to broken toolchain support (bug #1257099) See https://bugs.launchpad.net/bugs/1257099 On RHEL5 GCC with libtool and PIE, you get 'relocation R_X86_64_PC32' errors from ld. So disable libtool which disables smartcard-nss (aka nss) if this is true. Signed-off-by: Don Slutz --- configure | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/configure b/configure index 0666228..5e34095 100755 --- a/configure +++ b/configure @@ -1310,6 +1310,33 @@ if compile_prog "-Werror -fno-gcse" "" ; then TRANSLATE_OPT_CFLAGS=-fno-gcse fi +# check for broken GCC in RHEL5 with PIE +if test -n "$libtool" -a "$pie" = "" ; then + cat > $TMPC << EOF + +void *f(unsigned char *buf, int len); +void *g(unsigned char *buf, int len); + +void * +f(unsigned char *buf, int len) +{ + return (void*)0L; +} + +void * +g(unsigned char *buf, int len) +{ + return f(buf, len); +} + +EOF + if ! compile_prog "-shared -fPIE -fPIC" ""; then + echo "Disabling libtool due to broken toolchain support" + echo "Defaulting to --disable-smartcard-nss" + libtool= + fi +fi + if test "$static" = "yes" ; then if test "$pie" = "yes" ; then error_exit "static and pie are mutually incompatible" -- 1.8.2.1 -Don Slutz