mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
TLS support for MinGW targets.
MinGW is almost completely compatible to MSVC, with the exception of the _tls_array global not being available. Patch by David Nadlinger! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
87294b6547
commit
2ee4e428cc
@ -7834,7 +7834,7 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
|
||||
Chain.getValue(1));
|
||||
}
|
||||
|
||||
if (Subtarget->isTargetWindows()) {
|
||||
if (Subtarget->isTargetWindows() || Subtarget->isTargetMingw()) {
|
||||
// Just use the implicit TLS architecture
|
||||
// Need to generate someting similar to:
|
||||
// mov rdx, qword [gs:abs 58H]; Load pointer to ThreadLocalStorage
|
||||
@ -7854,18 +7854,19 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
|
||||
SDValue Chain = DAG.getEntryNode();
|
||||
|
||||
// Get the Thread Pointer, which is %fs:__tls_array (32-bit) or
|
||||
// %gs:0x58 (64-bit).
|
||||
// %gs:0x58 (64-bit). On MinGW, __tls_array is not available, so directly
|
||||
// use its literal value of 0x2C.
|
||||
Value *Ptr = Constant::getNullValue(Subtarget->is64Bit()
|
||||
? Type::getInt8PtrTy(*DAG.getContext(),
|
||||
256)
|
||||
: Type::getInt32PtrTy(*DAG.getContext(),
|
||||
257));
|
||||
|
||||
SDValue ThreadPointer = DAG.getLoad(getPointerTy(), dl, Chain,
|
||||
Subtarget->is64Bit()
|
||||
? DAG.getIntPtrConstant(0x58)
|
||||
: DAG.getExternalSymbol("_tls_array",
|
||||
getPointerTy()),
|
||||
SDValue TlsArray = Subtarget->is64Bit() ? DAG.getIntPtrConstant(0x58) :
|
||||
(Subtarget->isTargetMingw() ? DAG.getIntPtrConstant(0x2C) :
|
||||
DAG.getExternalSymbol("_tls_array", getPointerTy()));
|
||||
|
||||
SDValue ThreadPointer = DAG.getLoad(getPointerTy(), dl, Chain, TlsArray,
|
||||
MachinePointerInfo(Ptr),
|
||||
false, false, false, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user