Index: lib/Target/AArch64/AArch64ISelLowering.cpp =================================================================== --- lib/Target/AArch64/AArch64ISelLowering.cpp +++ lib/Target/AArch64/AArch64ISelLowering.cpp @@ -3890,9 +3890,6 @@ TLSModel::Model Model = getTargetMachine().getTLSModel(GA->getGlobal()); - if (DAG.getTarget().Options.EmulatedTLS) - return LowerToTLSEmulatedModel(GA, DAG); - if (!EnableAArch64ELFLocalDynamicTLSGeneration) { if (Model == TLSModel::LocalDynamic) Model = TLSModel::GeneralDynamic; @@ -4026,6 +4023,10 @@ SDValue AArch64TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const { + const GlobalAddressSDNode *GA = cast(Op); + if (DAG.getTarget().Options.EmulatedTLS) + return LowerToTLSEmulatedModel(GA, DAG); + if (Subtarget->isTargetDarwin()) return LowerDarwinGlobalTLSAddress(Op, DAG); if (Subtarget->isTargetELF()) Index: lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp =================================================================== --- lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp +++ lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp @@ -104,6 +104,11 @@ AArch64MCAsmInfoCOFF::AArch64MCAsmInfoCOFF() { PrivateGlobalPrefix = ".L"; PrivateLabelPrefix = ".L"; + + Data16bitsDirective = "\t.hword\t"; + Data32bitsDirective = "\t.word\t"; + Data64bitsDirective = "\t.xword\t"; + AlignmentIsInBytes = false; SupportsDebugInformation = true; CodePointerSize = 8; Index: test/CodeGen/AArch64/emutls_generic.ll =================================================================== --- test/CodeGen/AArch64/emutls_generic.ll +++ test/CodeGen/AArch64/emutls_generic.ll @@ -4,6 +4,8 @@ ; RUN: | FileCheck -check-prefix=ARM_64 %s ; RUN: llc < %s -emulated-tls -mtriple=aarch64-linux-android -O3 \ ; RUN: | FileCheck -check-prefix=ARM_64 %s +; RUN: llc < %s -emulated-tls -mtriple=aarch64-windows-gnu -O3 \ +; RUN: | FileCheck -check-prefix=ARM_64 %s ; Make sure that TLS symbols are emitted in expected order. @@ -46,7 +48,7 @@ ; ARM_64-NEXT: .xword 0 ; ARM_64-NEXT: .xword __emutls_t.external_y ; ARM_64-NOT: __emutls_v.external_x: -; ARM_64: .section .rodata, +; ARM_64: .section .r{{o?}}data, ; ARM_64-LABEL: __emutls_t.external_y: ; ARM_64-NEXT: .byte 7 ; ARM_64: .data{{$}} @@ -57,6 +59,6 @@ ; ARM_64-NEXT: .xword 16 ; ARM_64-NEXT: .xword 0 ; ARM_64-NEXT: .xword __emutls_t.internal_y -; ARM_64: .section .rodata, +; ARM_64: .section .r{{o?}}data, ; ARM_64-LABEL: __emutls_t.internal_y: ; ARM_64-NEXT: .xword 9