Hi, everyone:<div>   I am very sorry to trouble you, but I need your help about my problem about ThreadLocalImpl in llvm of 2.8 version. I have compiled it in Windows xp with mingw, and have compiled skyeye(an open source project about simulator) as it uses llvm. But when I run a testcase ---- arm_hello, it came out segment fault. I used gdb.exe to trace it, it gave the following infomation:</div>
<div><br></div><div><div>$ gdb.exe /opt/skyeye/bin/skyeye</div><div>GNU gdb 6.8</div><div>Copyright (C) 2008 Free Software Foundation, Inc.</div><div>License GPLv3+: GNU GPL version 3 or later <<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>></div>
<div>This is free software: you are free to change and redistribute it.</div><div>There is NO WARRANTY, to the extent permitted by law.  Type "show copying"</div><div>and "show warranty" for details.</div>
<div>This GDB was configured as "i686-pc-mingw32"...</div><div>(gdb) set args -n -e arm_hello</div><div>(gdb) run</div><div>Starting program: C:/msys/1.0/opt/skyeye/bin/skyeye.exe -n -e arm_hello</div><div>[New thread 1696.0xec]</div>
<div><br></div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>0x7c809f42 in KERNEL32!IsBadWritePtr () from C:\WINDOWS\system32\kernel32.dll</div><div>(gdb) bt</div><div>#0  0x7c809f42 in KERNEL32!IsBadWritePtr ()</div>
<div>   from C:\WINDOWS\system32\kernel32.dll</div><div>#1  0x00000001 in ?? ()</div><div>#2  0xbaadf00d in ?? ()</div><div>#3  0x0002020b in ?? ()</div><div>#4  0x0022f904 in ?? ()</div><div>#5  0x0022f8b4 in ?? ()</div>
<div>#6  0x7c9301c0 in ntdll!RtlAppendStringToString ()</div><div>   from C:\WINDOWS\system32\ntdll.dll</div><div>#7  0x0022fb08 in ?? ()</div><div>#8  0x7c839ac0 in ValidateLocale () from C:\WINDOWS\system32\kernel32.dll</div>
<div>#9  0x71065fd0 in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll</div><div>#10 0x71066000 in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll</div><div>#11 0x71066c5a in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll</div>
<div>#12 0x7104129a in pthread_key_create () from C:\msys\1.0\bin\msys-1.0.dll</div><div><font color="#ff6666">#13 0x66594055 in llvm::sys::ThreadLocalImpl::ThreadLocalImpl ()</font></div></div><div><div><font color="#ff6666">   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll</font></div>
<div>#14 0x77c04ee5 in msvcrt!__doserrno () from C:\WINDOWS\system32\msvcrt.dll</div><div>#15 0x66081133 in atexit () from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll</div><div>#16 0x660810e1 in DllMainCRTStartup@12 ()</div>
<div>   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll</div><div>#17 0x7c92118a in ntdll!LdrSetAppCompatDllRedirectionCallback ()</div><div>   from C:\WINDOWS\system32\ntdll.dll</div><div>#18 0x66080000 in ?? ()</div><div>
#19 0x00000001 in ?? ()</div><div>#20 0x66081060 in __dll_exit ()</div><div>   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll</div><div>#21 0x7c93c4da in ntdll!LdrHotPatchRoutine ()</div><div>   from C:\WINDOWS\system32\ntdll.dll</div>
<div>#22 0x7c941194 in ntdll!RtlMapGenericMask ()</div><div>   from C:\WINDOWS\system32\ntdll.dll</div><div>#23 0x7c94108f in ntdll!RtlMapGenericMask ()</div><div>   from C:\WINDOWS\system32\ntdll.dll</div><div>#24 0x7c92e437 in ntdll!LdrCreateOutOfProcessImage ()</div>
<div>   from C:\WINDOWS\system32\ntdll.dll</div><div>(gdb)</div></div><div><div><br></div><div>At last, I print some information in ThreadLocalImpl function: </div><div><div> 44 ThreadLocalImpl::ThreadLocalImpl() : data(0) {</div>
<div> 45   pthread_key_t* key = new pthread_key_t;</div><div> 46   printf("IN %s, line = %d key: 0x%x\n", __FUNCTION__, __LINE__, key);</div><div> 47   int errorcode = pthread_key_create(key, NULL);</div><div> 48   printf("In %s, line = %d\n", __FUNCTION__, __LINE__);</div>
<div> 49   assert(errorcode == 0);</div><div> 50   (void) errorcode;</div><div> 51   data = (void*)key;</div><div> 52 }</div></div><div><br></div><div><br></div><div>It print the following information:</div><div><br></div>
<div><div>$ /opt/skyeye/bin/skyeye.exe -n -e arm_hello</div><div><font color="#ff6666">IN ThreadLocalImpl, line = 46 key: 0x3e2c68</font></div></div>-- <br>ADDRESS:Ç廪´óѧFITÂ¥4-308<div>TEL£º 156-1166-2737</div><br>
</div>