Bug 164811 - cannot link librpcsvc.a into a shared object on x86_64
Summary: cannot link librpcsvc.a into a shared object on x86_64
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc   
(Show other bugs)
Version: 4.0
Hardware: All Linux
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On: 149284
Blocks: 156322
TreeView+ depends on / blocked
Reported: 2005-08-01 16:08 UTC by Elena Zannoni
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

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

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:678 qe-ready SHIPPED_LIVE glibc bug fix update 2005-10-05 04:00:00 UTC

Description Elena Zannoni 2005-08-01 16:08:28 UTC
+++ 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),
                   (xdrproc_t) xdr_getquota_args, (char *) &gq_args,
                   (xdrproc_t) xdr_getquota_rslt, (char *) &gq_rslt,
    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
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):


How reproducible:

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 16:41:53 UTC
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.


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