This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/80881] Implement Windows native TLS
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 01 Dec 2017 08:57:53 +0000
- Subject: [Bug target/80881] Implement Windows native TLS
- Auto-submitted: auto-generated
- References: <bug-80881-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[7/8 Regression] null |Implement Windows native
|pointer access in libgomp.h |TLS
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to jyong from comment #14)
> Doing some simple testcases, looks like generates:
>
> movl %gs:0, %eax
> movl _a@ntpoff(%eax), %eax
>
> While MSVC does (Intel syntax):
> mov ecx, DWORD PTR __tls_index
> mov eax, DWORD PTR fs:__tls_array
> mov eax, DWORD PTR [eax+ecx*4]
> mov eax, DWORD PTR _a[eax]
>
> For a statement "return a;" where a is a thread local integer.
> I'm not sure how to modify the machine definition to emit this.
Do Windows/mingw have multiple TLS models, e.g. different for shared libraries
vs. executables, and different cases for static vs. exported variables, or is
everything done the same way, the &{fs/gs}:__tls_array[__tls_index] computation
sufficient to be done once in the whole function that needs TLS and that
returns a pointer to what use the .tls section relative symbols.
All I could find quickly is:
http://lists.llvm.org/pipermail/llvm-dev/2011-December/045886.html
http://www.nynaeve.net/?p=185
In any case, to implement it I think you'd want TARGET_WIN_TLS (or some better
name next to TARGET_SUN_TLS, TARGET_GNU_TLS and TARGET_GNU2_TLS), associated
command line switches and option handling setting the default, and then do
something with it in legitimize_tls_address and ix86_delegitimize_tls_address.
I also fail to see why this is tracked as 7/8 Regression, given that the
Windows TLS really isn't implemented, --enable-tls is just a user error, this
can be turned into an enhancement request to implement Windows TLS.
In any case, I fail to