sandeep
sandeep

Reputation: 513

Is there a way to find out the compiler options that were used when a .so library was compiled on Linux?

I need to know how the library I have has been compiled, i.e. which compiler options were used? Specifically, whether it was compiled with optimization or not, and few other options.

Is there any way to extract this information on linux, x86_64 platform?

Upvotes: 4

Views: 1272

Answers (2)

jofel
jofel

Reputation: 3415

If the library is coming from the Linux distribution you use, you can look at the source of the package, e.g. for Debian based systems: apt-get source PACKAGENAME, to get the build parameters.

Upvotes: 1

IneQuation
IneQuation

Reputation: 1264

I don't believe it's possible to automatically detect compiler options; at least not in a portable way.

What you could do instead is change your build scripts (e.g. your Makefile) to automatically append a define together with the optimization argument (the -D flag).

Upvotes: 2

Related Questions