[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [Qemu-devel] [Bug 1257099] [NEW] QEMU fails to build on CentOS 5.10 with relocation R_X86_64_PC32 error
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 How about this as a patch: From 282fba086186ff3b8e2b2b15e647df2b58d082dd Mon Sep 17 00:00:00 2001 From: Don Slutz <dslutz@xxxxxxxxxxx> Date: Thu, 5 Dec 2013 18:50:18 +0000 Subject: [PATCH] configure: Auto disabling of PIE due to broken toolchain support (bug #1257099) See https://bugs.launchpad.net/bugs/1257099 On RHEL5 GCC, you can get 'relocation R_X86_64_PC32' errors from ld. So disable PIE is this is true. Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> --- configure | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/configure b/configure index cf8123b..a51a9dd 100755 --- a/configure +++ b/configure @@ -1339,23 +1339,50 @@ if test "$pie" != "no" ; then # define THREAD #endif +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); +} + +#ifdef PIE static THREAD int tls_var; int main(void) { return tls_var; } +#endif EOF - if compile_prog "-fPIE -DPIE" "-pie"; then - QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" - LDFLAGS="-pie $LDFLAGS" - pie="yes" - if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then - LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" + if compile_prog "-shared -fPIE -fPIC" ""; then + if compile_prog "-fPIE -DPIE" "-pie"; then + QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS" + LDFLAGS="-pie $LDFLAGS" + pie="yes" + if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then + LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS" + fi + else + if test "$pie" = "yes"; then + error_exit "PIE not available due to missing toolchain support" + else + echo "Disabling PIE due to missing toolchain support" + pie="no" + fi fi else if test "$pie" = "yes"; then - error_exit "PIE not available due to missing toolchain support" + error_exit "PIE not available due to broken toolchain support" else - echo "Disabling PIE due to missing toolchain support" + echo "Disabling PIE due to broken toolchain support" pie="no" fi fi -- 1.8.2.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |