So everything in Rawhide must be compiled with -fPIC?

Jakub Jelinek jakub at
Thu Feb 19 09:22:03 UTC 2015

On Thu, Feb 19, 2015 at 09:14:32AM +0000, Richard W.M. Jones wrote:
> Basically everything in Rawhide which uses the normal RPM
> opt flags will now have to be compiled with -fPIC, otherwise
> you get errors like:
> /usr/bin/ld: /tmp/ccqyK5ia.o: relocation R_X86_64_32S against `virConnectOpen' can not be used when making a shared object; recompile with -fPIC
> This is somewhat surprising ..

Of course not.  But, anything you link with
has to be compiled with
The latter will supply -fPIE by default if you don't specify
-fno-pic/-fpic/-fPIC/-fpie/-fPIE explicitly on the command line,
similarly to how redhat-hardened-ld supplies -pie if -shared is not given.
The rule is simple, objects to be linked into shared libraries
have to be compiled with -fpic or -fPIC.
Objects linked into position independent binaries have to be compiled
with -fpie or -fPIE or -fpic or -fPIC (the latter two being less efficient
for PIEs, on the other side can be linked into shared libraries too).
Objects linked into position dependent binaries can be compiled with any of
-fno-pic/-fpic/-fPIC/-fpie/-fPIE (-fno-pic is the default if you don't use
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 and is the most efficient
-flag for position dependent binaries).


More information about the devel mailing list