This is the mail archive of the gcc-bugs@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]

[Bug target/80881] Implement Windows native TLS


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

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