https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83074

--- Comment #7 from Stefan Vargyas <stvar at yahoo dot com> ---
> 
> libc.so.6 is a shared library, not a PIE.  It is normally linked with -shared,
> just arranged to have .interp section and a meaningful e_entry in Ehdr.
> PIE is something significantly different, in particular it is the executable,
> albeit position independent, e.g. required to be the first in symbol search
> scope so that its symbols bind locally.
> 

Jakub, thank you very much for your deeply insightful info.

I should have had a look at glibc prior to using the `-pie' hackery
for to achive the desired result of running 'foo.so' by itself.

The right solution (at least on GNU/Linux ELF platforms) is to rely on
`-shared', `-Wl,--entry' and a proper '.interp' section in the ELF file
built. (E.g. one cannot get rid of the issues seen above implied by
'__libc_csu_{init,fini}'.)

Reply via email to