Re: When to generate PIC?

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

 



Erik Leunissen <e.leunissen@xxxxxxxxx> writes:

> I am developing a library that needs to be dynamically loaded into an
> application.
> 
> I am unsure whether or not to generate position independent code for
> this library. I just don't know which considerations are relevant for
> such a decision.
> 
> Could anybody enlighten me (or point me to information where I could
> enlighten myself)?

It is normally more efficient to use -fPIC when compiling any code
that is going to be linked into any shared library.  So you should use
-fPIC.

It is more efficient because with -fPIC code the dynamic linker
(including dlopen) has to apply fewer dynamic relocations at run time.

Ian

[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