+++ This bug was initially created as a clone of Bug #149284 +++ Description of problem: This program will compile with -fPIE and link OK with -pie with FC4 glibc-2.3.4-10 on every architecture except x86_64: --- BEGIN x86_rpc_test.c: #include <sys/types.h> #include <unistd.h> #include <rpc/rpc.h> #include <rpc/pmap_prot.h> #include <rpcsvc/rquota.h> int main(int argc, char **argv, char **envp) { struct getquota_args gq_args; struct getquota_rslt gq_rslt; struct sockaddr_in bogus_addr; struct timeval timeout = {0, 500}; int socket = RPC_ANYSOCK; enum clnt_stat clnt_stat = clnt_call( clntudp_create(&bogus_addr, RQUOTAPROG, RQUOTAVERS, timeout, &socket), RQUOTAPROC_GETQUOTA, (xdrproc_t) xdr_getquota_args, (char *) &gq_args, (xdrproc_t) xdr_getquota_rslt, (char *) &gq_rslt, timeout ); return (int)clnt_stat; } --- END x86_rpc_test.c On every architecture except x86_64, you can do: $ gcc -fPIE -o x86_rpc_test.o -c x86_rpc_test.c $ gcc -pie -o x86_rpc_test x86_rpc_test -lrpcsvc In the /mnt/build/beehive/dist-fc4-build buildroot of 'dolly.build.redhat.com', the above steps give this error: # gcc -fPIE -o x86_rpc_test.o -c x86_rpc_test.c # gcc -pie -o x86_rpc_test x86_rpc_test.o -lrpcsvc /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../../lib64/librpcsvc.a(xrquota.o): relocation R_X86_64_PC32 against `xdr_string@@GLIBC_2.2.5' 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 No errors occur if you do not try to make a -pie executable. Exactly the same link error occurs if you compile x86_rpc_test.c with -fPIC, or -fpie, or -fpic, or without any -f options . Version-Release number of selected component (if applicable): glibc-2.3.4-10 How reproducible: 100% Steps to Reproduce: Try to compile above program into a -pie executable Actual results: Link error Expected results: a -pie executable
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2005-678.html