Re: How to tell if a ELF library/executable was built with -fpic versus -fPIC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Tom Kacvinsky via Gcc-help:

> Perhaps this belongs on the binutils list, but I'd like to know how if an ELF
> library/executable was built with -fpic versus -fPIC.  I know each makes PIC
> object code, with the difference being the size of the data model:
>
> -msmall-data (-fpic)
> -mlarge-data (-fPIC)
>
> but I have some shared libraries I am linking against such that I don't know
> which PIC option was used to build it.  Is there an ELF header I can check?

It depends on the the concrete target.  For a fully linked executable,
you'd have to disassemble it and check what is used for GOT access.  For
relocatable object files, you can look at the relocations.  There should
be an architecture-specific subset that can only handle a limited range,
and that set corresponds to -fpic.

There might be other options that affect the code model, with similar
consequences as the -fpic/-fPIC distinction.

Thanks,
Florian




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux