problem of non-pic code due to asm code.

Ian Lance Taylor
Sat Aug 22 00:06:00 GMT 2009

Hector Oron <> writes:

>   Is there a common way to detect (maybe with binutils) if a shared
>   library has been compiled with -fPIC?

I don't know a way that works for all targets.  In most cases, readelf
-r | grep 'GOT|PLT' will work--if the grep finds anything, the code was
compiled with -fPIC.

Of course some code is the same with and without -fPIC, and there is no
way to detect -fPIC in such a case.


More information about the Gcc-help mailing list