This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -ftls-model docs/implementation inconsistency
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 19 Jul 2013 17:41:05 +0200
- Subject: Re: -ftls-model docs/implementation inconsistency
- References: <alpine dot LNX dot 2 dot 00 dot 1307191846470 dot 1061 at monopod dot intra dot ispras dot ru>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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