Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-23 Thread Kai Tietz
Btw for those having interest in testing this also for 64-bit, use the following small testcase port: .section .text.startup,"x" .globl main .def main; .scl 2; .type 32; .endef main: subq $40, %rsp movl _tls_index, %eax movq %gs:88, %rcx shlq $3, %rax addq %rax, %rcx movq (%rcx), %rcx movl _tlsVar

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-23 Thread Kai Tietz
So, yes. we need to remove the +1 for tls_start. The issue is here - beside some nits in .sc files in binutils - that the initialization code treates those fields as given, so later accesses would need actual a plus sizeof (void *) offset of the .tls$AAA field. That the .tls$ZZZ is also part of

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-21 Thread David Nadlinger
On Thu, Feb 21, 2013 at 2:35 PM, Kai Tietz wrote: > Well, I am right now playing with your test-case. I think we should > approach it differently. How? > As by your code the TLS-region contains > always one element. "As by your code" - you mean as by the current tlssup.c implementation? As lo

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-21 Thread David Nadlinger
On Thu, Feb 21, 2013 at 1:47 PM, NightStrike wrote: > On Tue, Feb 19, 2013 at 2:41 AM, David Nadlinger wrote: >> Hi all, >> >> please find two patches to fix/improve TLS support in mingw-w64-crt attached. > > Do you have commit rights? No. >> Also, please let me know if there is another preferr

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-21 Thread Kai Tietz
Well, I am right now playing with your test-case. I think we should approach it differently. As by your code the TLS-region contains always one element. I just noticed that in pe.sc some weird position for .tls$AAA vs .tls$ZZZ is used. So indeed offsets look to me pretty much away from that w

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-21 Thread NightStrike
On Tue, Feb 19, 2013 at 2:41 AM, David Nadlinger wrote: > Hi all, > > please find two patches to fix/improve TLS support in mingw-w64-crt attached. Do you have commit rights? > Also, please let me know if there is another preferred method to submit > patches. This works. We can also make you

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-19 Thread David Nadlinger
Hi Kai, On Tue, Feb 19, 2013 at 7:27 PM, Kai Tietz wrote: > - (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, > + (ULONG_PTR) &_tls_start, (ULONG_PTR) &_tls_end, > > looks to me wrong due we always have one pointer-size allocated in TLS. > > shouldn't be the required fix as the following here

Re: [Mingw-w64-public] [PATCH] TLS support fixes

2013-02-19 Thread Kai Tietz
Hi, well, - (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, + (ULONG_PTR) &_tls_start, (ULONG_PTR) &_tls_end, looks to me wrong due we always have one pointer-size allocated in TLS. shouldn't be the required fix as the following here? - (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, +

[Mingw-w64-public] [PATCH] TLS support fixes

2013-02-19 Thread David Nadlinger
Hi all, please find two patches to fix/improve TLS support in mingw-w64-crt attached. The first diff is an actual bug fix; it corrects the TLS start address written to the TLS dictionary (_tls_used). It is used to determine the size and initial contents of the TLS area for new threads. If it does