File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -985,8 +985,12 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
985
985
encodeForceLoadSymbolName (buf, linkLib.getName ());
986
986
auto ForceImportThunk =
987
987
Module.getOrInsertFunction (buf, llvm::FunctionType::get (VoidTy, false ));
988
- ApplyIRLinkage (IRLinkage::ExternalWeakImport)
989
- .to (cast<llvm::GlobalValue>(ForceImportThunk));
988
+
989
+ const IRLinkage IRL =
990
+ llvm::Triple (Module.getTargetTriple ()).isOSBinFormatCOFF ()
991
+ ? IRLinkage::ExternalImport
992
+ : IRLinkage::ExternalWeakImport;
993
+ ApplyIRLinkage (IRL).to (cast<llvm::GlobalValue>(ForceImportThunk));
990
994
991
995
buf += " _$" ;
992
996
appendEncodedName (buf, IRGen.Opts .ModuleName );
Original file line number Diff line number Diff line change 13
13
// RUN: %target-swift-frontend -emit-module -parse-stdlib -o %t -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load
14
14
// RUN: %target-swift-frontend -emit-ir -lmagic %s -I %t > %t/force-load.txt
15
15
// RUN: %FileCheck %s < %t/force-load.txt
16
- // RUN: %FileCheck -check-prefix= FORCE-LOAD-CLIENT %s < %t/force-load.txt
16
+ // RUN: %FileCheck -check-prefix FORCE-LOAD-CLIENT -check-prefix FORCE-LOAD-CLIENT-%target-object-format %s < %t/force-load.txt
17
17
18
18
// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift | %FileCheck --check-prefix=NO-FORCE-LOAD %s
19
19
// RUN: %target-swift-frontend -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load | %FileCheck --check-prefix=FORCE-LOAD %s
@@ -46,5 +46,6 @@ import someModule
46
46
// FORCE-LOAD-CLIENT: @llvm.used = appending global [{{[0-9]+}} x i8*] [
47
47
// FORCE-LOAD-CLIENT: i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_module_$_autolinking" to i8*)
48
48
// FORCE-LOAD-CLIENT: ], section "llvm.metadata"
49
- // FORCE-LOAD-CLIENT: declare extern_weak {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
49
+ // FORCE-LOAD-CLIENT-MACHO: declare extern_weak {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
50
+ // FORCE-LOAD-CLIENT-COFF: declare extern {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
50
51
You can’t perform that action at this time.
0 commit comments