Alex Rivera | Logout

How can I tell, with something like objdump, if an object file has been built with -fPIC?

Asked 2009-08-27T11:15:11.680
82

How can I tell, with something like objdump, if an object file has been built with -fPIC?

Edit
Report

1 Answer

87

The answer depends on the platform. On most platforms, if output from

readelf --relocs foo.o | egrep '(GOT|PLT|JU?MP_SLOT)'

is empty, then either foo.o was not compiled with -fPIC, or foo.o doesn't contain any code where -fPIC matters.

answered 2009-08-29T16:02:50.103

Your Answer