This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -ftls-model docs/implementation inconsistency


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]