Re: Force global-dynamic TLS model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/6/20 11:59 π.μ., Florian Weimer wrote:

* Nikos Dragazis:

For example, let's say we have an ELF executable that defines and
accesses a TLS variable. From gcc's man page, I read that, in this case,
gcc will use the initial-exec TLS model by default. My question is if we
can change that and, say, use the global-dynamic model. To this end, I
have tried the `-ftls-model=global-dynamic` option and the `tls_model`
gcc variable attribute. None of these worked.
Hi Florian,

Thanks for the quick reply! Some comments inline.
Try -ftls-model=global-dynamic -fpic.  This will prevent GCC from
performing relaxation.
I tried this and, indeed, it forces the compiler to avoid relaxations.
Also the "tls_model" variable attribute worked in my case.
   For many targets, the link editor still performs
relaxation.  To turn this off, you will have to link the executable with
-shared, I think, with some hackery to produce an executable that can
actually be run.
You are right. This is what is happening in my case. So, the problem is
not the compiler, is the static linker. And there is no option that can
turn off relaxations on the static linker.

Thanks again,
Nikos

Thanks,
Florian




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux