On Fri, Jul 19, 2013 at 07:34:30PM +0400, Alexander Monakov wrote:
> Suppose a user builds a non-PIC shared object for x86 target with gcc by
> passing -shared but not -fPIC.  This works, but internally GCC will not set
> flag_shlib (as flag_shlib == flag_pic && !flag_pie).  

Usually it doesn't (on many targets the linker will just fail to link it),
on others it is highly undesirable and various security policies might
refuse to load such DT_TEXTREL shared libraries.
Furthermore, on Linux you can dlopen even libraries with initial-exec TLS
model in it (as long as they don't use too big TLS sections).

So the short answer is, don't do this, especially if you are using TLS.

        Jakub

Reply via email to