Skip to content

[swiftc] Fixed for Cygwin #3841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,10 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "FREEBSD")
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "CYGWIN")

# set(CMAKE_EXECUTABLE_FORMAT "ELF")
set(SWIFT_HOST_VARIANT "windows" CACHE STRING
"Deployment OS for Swift host tools (the compiler) [windows].")
set(SWIFT_HOST_VARIANT "cygwin" CACHE STRING
"Deployment OS for Swift host tools (the compiler) [cygwin].")

configure_sdk_unix(CYGWIN "Cygwin" "windows" "cygwin" "windows" "x86_64-unknown-windows-cygnus" "/")
configure_sdk_unix(CYGWIN "Cygwin" "cygwin" "cygwin" "x86_64" "x86_64-unknown-windows-cygnus" "/")
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")

Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/Concurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdint.h>
#include "llvm/Support/Allocator.h"

#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__CYGWIN__)
#include <stdio.h>
#endif

Expand Down
12 changes: 11 additions & 1 deletion lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
case llvm::Triple::FreeBSD:
return "freebsd";
case llvm::Triple::Win32:
return "windows";
switch (triple.getEnvironment()) {
case llvm::Triple::Cygnus:
return "cygwin";
case llvm::Triple::GNU:
return "mingw";
case llvm::Triple::MSVC:
case llvm::Triple::Itanium:
return "windows";
default:
llvm_unreachable("unsupported Windows environment");
}
case llvm::Triple::PS4:
return "ps4";
}
Expand Down
12 changes: 6 additions & 6 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ void IRGenModule::emitVTableStubs() {
// For each eliminated method symbol create an alias to the stub.
auto *alias = llvm::GlobalAlias::create(llvm::GlobalValue::ExternalLinkage,
F.getName(), stub);
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
alias->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
}
}
Expand Down Expand Up @@ -1260,7 +1260,7 @@ getIRLinkage(IRGenModule &IGM, SILLinkage linkage, bool isFragile,

const auto ObjFormat = IGM.TargetInfo.OutputObjectFormat;
bool IsELFObject = ObjFormat == llvm::Triple::ELF;
bool IsCOFFObject = ObjFormat == llvm::Triple::COFF;
bool UseDLLStorage = IGM.useDllStorage();

// Use protected visibility for public symbols we define on ELF. ld.so
// doesn't support relative relocations at load time, which interferes with
Expand All @@ -1270,11 +1270,11 @@ getIRLinkage(IRGenModule &IGM, SILLinkage linkage, bool isFragile,
IsELFObject ? llvm::GlobalValue::ProtectedVisibility
: llvm::GlobalValue::DefaultVisibility;
llvm::GlobalValue::DLLStorageClassTypes ExportedStorage =
IsCOFFObject ? llvm::GlobalValue::DLLExportStorageClass
: llvm::GlobalValue::DefaultStorageClass;
UseDLLStorage ? llvm::GlobalValue::DLLExportStorageClass
: llvm::GlobalValue::DefaultStorageClass;
llvm::GlobalValue::DLLStorageClassTypes ImportedStorage =
IsCOFFObject ? llvm::GlobalValue::DLLImportStorageClass
: llvm::GlobalValue::DefaultStorageClass;
UseDLLStorage ? llvm::GlobalValue::DLLImportStorageClass
: llvm::GlobalValue::DefaultStorageClass;

if (isFragile) {
// Fragile functions/globals must be visible from outside, regardless of
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ void irgen::emitBlockHeader(IRGenFunction &IGF,
auto NSConcreteStackBlock =
IGF.IGM.getModule()->getOrInsertGlobal("_NSConcreteStackBlock",
IGF.IGM.ObjCClassStructTy);
if (IGF.IGM.Triple.isOSBinFormatCOFF())
if (IGF.IGM.useDllStorage())
cast<llvm::GlobalVariable>(NSConcreteStackBlock)
->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4035,7 +4035,7 @@ static void emitObjCClassSymbol(IRGenModule &IGM,
metadata->getLinkage(),
classSymbol.str(), metadata,
IGM.getModule());
if (IGM.TargetInfo.OutputObjectFormat == llvm::Triple::COFF)
if (IGM.useDllStorage())
alias->setDLLStorageClass(metadata->getDLLStorageClass());
}

Expand Down
11 changes: 7 additions & 4 deletions lib/IRGen/IRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,13 @@ swift::createTargetMachine(IRGenOptions &Opts, ASTContext &Ctx) {
}

// Create a target machine.
llvm::TargetMachine *TargetMachine
= Target->createTargetMachine(Triple.str(), CPU,
targetFeatures, TargetOpts, Reloc::PIC_,
CodeModel::Default, OptLevel);
auto cmodel = CodeModel::Default;
if (Triple.isWindowsCygwinEnvironment())
cmodel = CodeModel::Large;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the large code model?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DLL's are loaded above the max address for 32bit. (for example, cygswiftcore.dll is loaded at 0x459F40000).
Without large model, generated code had problems to reference the .data section of DLL's, and generated segment fault.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Thats something that I somehow did not hit. However, even for the MSVC environment, we should be using LARGEADDRESSAWARE mode. So, perhaps its best to just always enable the large code model. I think the selection can just be inlined via a ternary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't understand last sentence. 'via a ternary' means all MinGW, Cygwin, MSVC ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking more about it, do you have the code from an instance where this happens? The code generation issue that you sounds very much like a bug in LLVM. x86 has fully addressability, so within a 32-bit range should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I can show you the sample codes.

This is a line of LLVM of Hello.swift.

@_TZvOs11CommandLine5_argcVs5Int32 = external global %Vs5Int32, align 4

That is static Swift.CommandLine._argc : Swift.Int32,
and is a part of the standard library and declared in data section of cygswiftCore.dll,
so the application code should read/write the data section of the dll.

The generated assembly code is as follows.

In default model,
movl %edi, _TZvOs11CommandLine5_argcVs5Int32(%rip),

and in large model,
movabsq $_TZvOs11CommandLine5_argcVs5Int32, %rax
movl %ecx, (%rax).

In case of 64bit default memory model, since the DLL is located at higher memory (for example, cygswiftcore.dll is loaded at 0x459F40000 > maximum 32bit), and the generated code only references 32bit address, the executable file didn't work correctly.

If we link the static library instead of dll, it might be work correctly, so I think it is hard to say llvm has a bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, doesnt this problem exist beyond just cygwin? Perhaps it should be a 64-bit windows check here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, This will be same in case of MinGW 64bit and Windows MSVC 64bit.
What about 64bit Windows with different arch, such as ARM ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesnt 64-bit MSVC also have 2-GB limitations (PE+).


llvm::TargetMachine *TargetMachine =
Target->createTargetMachine(Triple.str(), CPU, targetFeatures, TargetOpts,
Reloc::PIC_, cmodel, OptLevel);
if (!TargetMachine) {
Ctx.Diags.diagnose(SourceLoc(), diag::no_llvm_target,
Triple.str(), "no LLVM target machine");
Expand Down
32 changes: 20 additions & 12 deletions lib/IRGen/IRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
return ClangCodeGen;
}

/// A helper for determining if the triple uses the DLL storage
static bool useDllStorage(const llvm::Triple &Triple) {
return Triple.isOSBinFormatCOFF() && !Triple.isOSCygMing();
}

IRGenModule::IRGenModule(IRGenerator &irgen,
std::unique_ptr<llvm::TargetMachine> &&target,
SourceFile *SF, llvm::LLVMContext &LLVMContext,
Expand Down Expand Up @@ -439,7 +444,7 @@ llvm::Constant *swift::getRuntimeFn(llvm::Module &Module,
if (auto fn = dyn_cast<llvm::Function>(cache)) {
fn->setCallingConv(cc);

if (llvm::Triple(Module.getTargetTriple()).isOSBinFormatCOFF() &&
if (::useDllStorage(llvm::Triple(Module.getTargetTriple())) &&
(fn->getLinkage() == llvm::GlobalValue::ExternalLinkage ||
fn->getLinkage() == llvm::GlobalValue::AvailableExternallyLinkage))
fn->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
Expand Down Expand Up @@ -519,7 +524,7 @@ llvm::Constant *swift::getWrapperFn(llvm::Module &Module,
auto *globalFnPtr = new llvm::GlobalVariable(
Module, fnPtrTy, false, llvm::GlobalValue::ExternalLinkage, nullptr,
symbol);
if (llvm::Triple(Module.getTargetTriple()).isOSBinFormatCOFF())
if (::useDllStorage(llvm::Triple(Module.getTargetTriple())))
globalFnPtr->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

// Forward all arguments.
Expand Down Expand Up @@ -638,7 +643,7 @@ llvm::Constant *IRGenModule::getEmptyTupleMetadata() {
EmptyTupleMetadata = Module.getOrInsertGlobal(
MANGLE_AS_STRING(METADATA_SYM(EMPTY_TUPLE_MANGLING)),
FullTypeMetadataStructTy);
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
cast<llvm::GlobalVariable>(EmptyTupleMetadata)
->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
return EmptyTupleMetadata;
Expand All @@ -652,7 +657,7 @@ llvm::Constant *IRGenModule::getObjCEmptyCachePtr() {
// struct objc_cache _objc_empty_cache;
ObjCEmptyCachePtr = Module.getOrInsertGlobal("_objc_empty_cache",
OpaquePtrTy->getElementType());
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
cast<llvm::GlobalVariable>(ObjCEmptyCachePtr)
->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
} else {
Expand Down Expand Up @@ -685,7 +690,7 @@ Address IRGenModule::getAddrOfObjCISAMask() {
assert(TargetInfo.hasISAMasking());
if (!ObjCISAMaskPtr) {
ObjCISAMaskPtr = Module.getOrInsertGlobal("swift_isaMask", IntPtrTy);
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
cast<llvm::GlobalVariable>(ObjCISAMaskPtr)
->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
}
Expand Down Expand Up @@ -851,7 +856,7 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
llvm::SmallString<64> buf;
encodeForceLoadSymbolName(buf, linkLib.getName());
auto symbolAddr = Module.getOrInsertGlobal(buf.str(), Int1Ty);
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
cast<llvm::GlobalVariable>(symbolAddr)
->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

Expand Down Expand Up @@ -916,9 +921,9 @@ void IRGenModule::emitAutolinkInfo() {
}),
AutolinkEntries.end());

if (TargetInfo.OutputObjectFormat == llvm::Triple::COFF ||
TargetInfo.OutputObjectFormat == llvm::Triple::MachO ||
Triple.isPS4()) {
if ((TargetInfo.OutputObjectFormat == llvm::Triple::COFF &&
!Triple.isOSCygMing()) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinGW can properly handle directives for export. Why are you disabling this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MinGW/Cygwin's ld recognizes .drectve section for export, but it is limited and is not same to MS Linker.
It generated the warning "Warning: .drectve OOOO unrecognized" for "-lFoo" option in the section. We can see a part of ld source here. (line 875883, 934950)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im familiar with the directive handling in binutils. That sounds like something else is going wrong. I know that the directives generated by LLVM should be properly handled by binutils linker. We should look at the generated object file and figure out what exactly prevents us from using that infrastructure. If its a bug in LLVM, we can fix that :-).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think LLVM should not emit '-lFoo' into .drectve since ld can not recognize it. (in case of Cygwin/MinGW)
Below is the output before patch.

$ ./swiftc -c Hello.swift

$ objdump -s -h --section=.drectve Hello.o

Hello.o:     file format pe-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  6 .drectve      00000025  0000000000000000  0000000000000000  00000314  2**0
                  CONTENTS, READONLY, DEBUGGING, EXCLUDE
Contents of section .drectve:
 0000 202d6c73 77696674 436f7265 202d6c73   -lswiftCore -ls
 0010 77696674 53776966 744f6e6f 6e655375  wiftSwiftOnoneSu
 0020 70706f72 74                          pport

$ ./swiftc Hello.swift
Warning: .drectve `-lswiftCore ' unrecognized
Warning: corrupt .drectve at end of def file
/tmp/Hello-a57504.o:(.text+0x5f): undefined reference to `_TTSgq5P____TFs27_allocateUninitializedArrayurFBwTGSax_Bp_'
collect2: error: ld returned 1 exit status
clang-3.7: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

$ ./swiftc Hello.swift -lswiftSwiftOnoneSupport
Warning: .drectve `-lswiftCore ' unrecognized
Warning: corrupt .drectve at end of def file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should use -defaultlib swiftCore.lib instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root cause of the incompatibility of .drectve is in its definition.
It defines embedding the linker options in the .drectve section of the object file, and generally used with MS Linker.
But, the MinGW linker ld, coming with the GNU binutils, has different linker options with MS linker. Generally, both linker can not accept each other linker's option format.
So, the object using .drectve which complies one linker, can not be compatible the other linker.

TargetInfo.OutputObjectFormat == llvm::Triple::MachO || Triple.isPS4()) {
llvm::LLVMContext &ctx = Module.getContext();

if (!LinkerOptions) {
Expand All @@ -935,8 +940,9 @@ void IRGenModule::emitAutolinkInfo() {
assert(FoundOldEntry && "Could not replace old linker options entry?");
}
} else {
assert(TargetInfo.OutputObjectFormat == llvm::Triple::ELF &&
"expected ELF output format");
assert((TargetInfo.OutputObjectFormat == llvm::Triple::ELF ||
Triple.isOSCygMing()) &&
"expected ELF output format or COFF format for Cygwin/MinGW");

// Merge the entries into null-separated string.
llvm::SmallString<64> EntriesString;
Expand Down Expand Up @@ -969,7 +975,7 @@ void IRGenModule::emitAutolinkInfo() {
llvm::GlobalValue::CommonLinkage,
llvm::Constant::getNullValue(Int1Ty),
buf.str());
if (Triple.isOSBinFormatCOFF())
if (useDllStorage())
symbol->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
}
}
Expand Down Expand Up @@ -1072,6 +1078,8 @@ void IRGenModule::error(SourceLoc loc, const Twine &message) {
message.toStringRef(buffer));
}

bool IRGenModule::useDllStorage() { return ::useDllStorage(Triple); }

void IRGenerator::addGenModule(SourceFile *SF, IRGenModule *IGM) {
assert(GenModules.count(SF) == 0);
GenModules[SF] = IGM;
Expand Down
2 changes: 2 additions & 0 deletions lib/IRGen/IRGenModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ class IRGenModule {
void fatal_unimplemented(SourceLoc, StringRef Message);
void error(SourceLoc loc, const Twine &message);

bool useDllStorage();

private:
Size PtrSize;
llvm::Type *FixedBufferTy; /// [N x i8], where N == 3 * sizeof(void*)
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/TypeLayoutVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ irgen::emitTypeLayoutVerifier(IRGenFunction &IGF,
/*var arg*/ false);
auto verifierFn = IGF.IGM.Module.getOrInsertFunction(
"_swift_debug_verifyTypeLayoutAttribute", verifierFnTy);
if (IGF.IGM.Triple.isOSBinFormatCOFF())
if (IGF.IGM.useDllStorage())
if (auto *F = dyn_cast<llvm::Function>(verifierFn))
F->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

Expand Down
3 changes: 2 additions & 1 deletion lib/LLVMPasses/ARCEntryPointBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class ARCEntryPointBuilder {
CheckUnowned = M.getOrInsertFunction("swift_checkUnowned", AttrList,
Type::getVoidTy(M.getContext()),
ObjectPtrTy, nullptr);
if (llvm::Triple(M.getTargetTriple()).isOSBinFormatCOFF())
if (llvm::Triple(M.getTargetTriple()).isOSBinFormatCOFF() &&
!llvm::Triple(M.getTargetTriple()).isOSCygMing())
if (auto *F = llvm::dyn_cast<llvm::Function>(CheckUnowned.get()))
F->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
return CheckUnowned.get();
Expand Down
18 changes: 18 additions & 0 deletions test/IRGen/autolink-coff-x86.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t

// RUN: %swift -target x86_64--windows-gnu -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
// RUN: %swift -target x86_64--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-GNU-IR
// RUN: %swift -target x86_64--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-GNU-ASM

// REQUIRES: CODEGENERATOR=X86

#if MAIN_MODULE
import module
#endif

// CHECK-GNU-IR: @_swift1_autolink_entries = private constant [9 x i8] c"-lmodule\00", section ".swift1_autolink_entries", align 8
// CHECK-GNU-IR: @llvm.used = appending global [{{.*}} x i8*] [{{.*}}i8* getelementptr inbounds ([9 x i8], [9 x i8]* @_swift1_autolink_entries, i32 0, i32 0){{.*}}], section "llvm.metadata", align 8

// CHECK-GNU-ASM: .section .swift1_autolink_entries{{.*}}
// CHECK-GNU-ASM: .asciz "-lmodule"
11 changes: 0 additions & 11 deletions test/IRGen/autolink-coff.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t

// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-GNU-IR
// RUN: %swift -target thumbv7--windows-gnu -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-GNU-ASM

// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -emit-module-path %t/module.swiftmodule -module-name module -module-link-name module %s
// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -emit-ir -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-IR
// RUN: %swift -target thumbv7--windows-itanium -parse-as-library -parse-stdlib -module-name autolink -I %t -D MAIN_MODULE -S -o - %s | %FileCheck %s -check-prefix CHECK-MSVC-ASM
Expand All @@ -19,13 +15,6 @@
import module
#endif

// CHECK-GNU-IR: !{{[0-9]+}} = !{i32 {{[0-9]+}}, !"Linker Options", [[NODE:![0-9]+]]}
// CHECK-GNU-IR: [[NODE]] = !{[[LIST:![0-9]+]]}
// CHECK-GNU-IR: [[LIST]] = !{!"-lmodule"}

// CHECK-GNU-ASM: .section .drectve
// CHECK-GNU-ASM: .ascii " -lmodule"

// CHECK-MSVC-IR: !{{[0-9]+}} = !{i32 {{[0-9]+}}, !"Linker Options", [[NODE:![0-9]+]]}
// CHECK-MSVC-IR: [[NODE]] = !{[[LIST:![0-9]+]]}
// CHECK-MSVC-IR: [[LIST]] = !{!"/DEFAULTLIB:module.lib"}
Expand Down
2 changes: 1 addition & 1 deletion utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ function set_build_options_for_host() {
USE_GOLD_LINKER=1
;;
cygwin-x86_64)
SWIFT_HOST_VARIANT="windows"
SWIFT_HOST_VARIANT="cygwin"
SWIFT_HOST_VARIANT_SDK="CYGWIN"
SWIFT_HOST_VARIANT_ARCH="x86_64"
;;
Expand Down