Anonymous | Login | Signup for a new account | 2023-06-10 19:35 CEST |
Main | My View | View Issues |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | |||||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
0000041 | [libFirm] backend | minor | always | 2009-03-03 01:34 | 2017-05-08 16:14 | |||||||
Reporter | moritz | View Status | public | |||||||||
Assigned To | ||||||||||||
Priority | normal | Resolution | open | |||||||||
Status | confirmed | Product Version | 1.16.0 | |||||||||
Summary | 0000041: TLS does not work on Cygwin | |||||||||||
Description | In MinGW mode, libFirm generates invalid assembler code for testcase firm_testsuite/opt/thread.c which uses "__thread" modifiers (invalid section declaration: '.section .tbss,"awT",@nobits'). | |||||||||||
Additional Information |
Just removing ",@nobits" results in the GAS warning "unknown section attribute 'T'". The generated code tries to get a TLS pointer from gs:[0] which is simply not valid on Windows. Trying to build this testcase with gcc 3.4.4 on Cygwin results in this error messages: opt/thread.c:5: error: thread-local storage not supported for this target opt/thread.c:6: error: thread-local storage not supported for this target |
|||||||||||
Tags | No tags attached. | |||||||||||
Attached Files | ||||||||||||
|
![]() |
|
(0000061) Matze (administrator) 2009-03-03 21:16 |
so what's the correct solution, disallowing thread local storage on mingw target? |
(0000066) moritz (manager) 2009-03-04 12:26 |
Looking at how Visual C compiles thread.c it uses a special .tls PE section: PUBLIC _tls_i PUBLIC _tls_j _TLS SEGMENT _tls_i DD 0aH DUP (?) _tls_j DD 05H _TLS ENDS PUBLIC _test EXTRN __tls_array:DWORD EXTRN __tls_index:DWORD [...] ; 9 : tls_j = i; mov eax, DWORD PTR __tls_index mov ecx, DWORD PTR fs:__tls_array mov edx, DWORD PTR [ecx+eax*4] mov eax, DWORD PTR _i$[ebp] mov DWORD PTR _tls_j[edx], eax More info on this can be found at: http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx [^] According to http://sourceware.org/ml/binutils/2003-10/msg00369.html [^] and http://gcc.gnu.org/ml/gcc/2006-06/msg00324.html [^] binutils already have some support for the .tls table ("Fortunately, the linker already supports setting the TLS directory entry in the PE header if a symbol named "__tls_used" exists."). Sadly I didn't find a proper example on how an according .s file should look like. Trying [...] .section .tls .globl __tls_used .long 2 .globl _tls_i .p2align 2 _tls_i: .space 40 .globl _tls_j .p2align 2 _tls_j: .long 0x00000005 causes an segmentation fault in ld... |
(0000067) moritz (manager) 2009-03-04 17:11 |
The definition of __tls_used was missing. I fixed the bug in ld nonetheless (http://sourceware.org/bugzilla/show_bug.cgi?id=9923). [^] Now __tls_used must only be filled with some sensible data (IMAGE_TLS_DIRECTORY). A C example can be found here: http://sourceware.org/ml/binutils/2003-10/msg00369.html [^] |
(0000288) travm1 (reporter) 2017-04-07 05:49 |
The wiki page for Cygwin has some interesting points: https://www.everipedia.com/Cygwin/ [^] |
(0000293) waldgrasgeniesser (reporter) 2017-05-08 16:14 |
I don't care that you broke your elbow. |
Mantis 1.1.5[^] Copyright © 2000 - 2008 Mantis Group |