From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpHvb-0002pM-CQ for qemu-devel@nongnu.org; Sat, 07 Dec 2013 08:28:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpHvO-0004Ex-LH for qemu-devel@nongnu.org; Sat, 07 Dec 2013 08:28:15 -0500 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:20865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpHvO-0004Eb-G8 for qemu-devel@nongnu.org; Sat, 07 Dec 2013 08:28:02 -0500 From: Don Slutz Message-ID: <52A32257.2000001@terremark.com> Date: Sat, 7 Dec 2013 08:27:51 -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> In-Reply-To: <52A09933.5090302@redhat.com> 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: Paolo Bonzini Cc: xen-devel@lists.xensource.com, Ian Campbell , Stefano Stabellini , 1257099@bugs.launchpad.net, Don Slutz , qemu-devel@nongnu.org On 12/05/13 10:18, Paolo Bonzini wrote: > Il 04/12/2013 02:32, Don Slutz ha scritto: >> Any hints or pointers about the bug in RHEL5 binutils? I can try and >> make a patch to auto detect this. > Actually it's RHEL5 GCC: > > $ cat f.c > void * > f(unsigned char *buf, int len) > { > return (void*)0L; > } > > > void * > g(unsigned char *buf, int len) > { > return f(buf, len); > } > $ 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 > > On RHEL5: > $ gcc -S -o - f.c -fPIE -fPIC |grep call > call f > > On RHEL6: > $ gcc -S -o - f.c -fPIE -fPIC |grep call > call f@PLT > > Paolo RHEL5 also "works" if you add -pie: dcs-xen-53:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC /usr/bin/ld: /tmp/cc6pp1n2.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 dcs-xen-53:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC -pie dcs-xen-53:~/tmp>gcc -S -o - f.c -fPIE -pie|grep call call f I have not figured out a way to take advantage of this. I just checked and Fedora 17 has the same issue with gcc: FC17: dcs-xen-52:~/tmp>gcc -S -o - f.c -fPIE -fPIC |grep call call f dcs-xen-52:~/tmp>gcc -shared -o f.so f.c -fPIE -fPIC /usr/bin/ld: /tmp/ccUlVgMP.o: relocation R_X86_64_PC32 against symbol `f' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status However QEMU builds just fine. So it is looking like libtool is also part of the problem. -Don Slutz