Question about the tls_model attribute

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

 



Hi,

I have a question about the semantics of the tls_model attribute in GCC.

For code such as this:

  static __thread int __attribute((tls_model("global-dynamic"))) x;
  int *f() { return &x; }

GCC will generate code using the global-dynamic model, also when
compiled without -fpic.

It does this even though it would be safe to use the faster local-exec
model, and the static linker will probably change the code to
local-exec anyway.

Is there a reason for this? The tls_model attribute was added in [1]
by Jakub, and it looks like that patch did go out of its way also to
support e.g. global-dynamic in non-pic code.

The reason I'm asking is that I'm adding support for this attribute in
LLVM, and we're discussing [2] what the semantics should be.

Thanks,
Hans

[1]. http://gcc.gnu.org/ml/gcc-patches/2002-09/msg00668.html
[2]. http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050597.html


[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