Bug 164811 - cannot link librpcsvc.a into a shared object on x86_64
cannot link librpcsvc.a into a shared object on x86_64
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc (Show other bugs)
4.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On: 149284
Blocks: 156322
  Show dependency treegraph
 
Reported: 2005-08-01 12:08 EDT by Elena Zannoni
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2005-678
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-05 12:41:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Elena Zannoni 2005-08-01 12:08:28 EDT
+++ 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
Comment 2 Red Hat Bugzilla 2005-10-05 12:41:53 EDT
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

Note You need to log in before you can comment on or make changes to this bug.