kdeinit (was: Summary from Buildsystem BoF at Desktop Summit)
matz at kde.org
Wed Aug 17 14:10:07 BST 2011
On Wed, 17 Aug 2011, Thiago Macieira wrote:
> > Can you think of any other example where PIE would differ from PIC?
> One idea is that variables are moved and the compiler uses a simpler,
> 32-bit PC-relative relocation to access them, as opposed to a 64-bit
> indirect as would be expected.
> Another, and far more likely, is that the compiler and linker expect
> that none of the symbols in the executable be overridden by any library.
> That is, it probably applies -Bsymbolic or something equivalent. If you
> have an application or library that expects to be able to override
> non-weak symbols by interposition, this could cause issues. Fortunately,
> this is very rare and frowned upon.
<advancing from the cave>
Speculations aside: the difference is that symbols defined in a DSO are
interposable with PIC (when also linked with -shared) and non-interposable
with PIE. There are no other differences. That happens to be the
semantics that symbol resolution during loading is given for the first
loaded DSO, which conventially is called 'executable', hence the name for
Note that linking with -shared also has the side effect of exporting all
global symbols from the DSO (appropriately filtered through symbol version
lists). It also is incompatible with -fPIE code, therefore by default a
PIE compiled/linked executable doesn't export any symbols. See
--dynamic-list. Again, that's just a side effect, the only real
difference between PIC and PIE is the one above.
More information about the kde-core-devel