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 @@ -981,8 +981,12 @@ void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
981
981
encodeForceLoadSymbolName (buf, linkLib.getName ());
982
982
auto ForceImportThunk =
983
983
Module.getOrInsertFunction (buf, llvm::FunctionType::get (VoidTy, false ));
984
- ApplyIRLinkage (IRLinkage::ExternalWeakImport)
985
- .to (cast<llvm::GlobalValue>(ForceImportThunk));
984
+
985
+ const IRLinkage IRL =
986
+ llvm::Triple (Module.getTargetTriple ()).isOSBinFormatCOFF ()
987
+ ? IRLinkage::ExternalImport
988
+ : IRLinkage::ExternalWeakImport;
989
+ ApplyIRLinkage (IRL).to (cast<llvm::GlobalValue>(ForceImportThunk));
986
990
987
991
buf += " _$" ;
988
992
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
@@ -49,5 +49,6 @@ import someModule
49
49
// FORCE-LOAD-CLIENT: @llvm.used = appending global [{{[0-9]+}} x i8*] [
50
50
// FORCE-LOAD-CLIENT: i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_module_$_autolinking" to i8*)
51
51
// FORCE-LOAD-CLIENT: ], section "llvm.metadata"
52
- // FORCE-LOAD-CLIENT: declare extern_weak {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
52
+ // FORCE-LOAD-CLIENT-MACHO: declare extern_weak {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
53
+ // FORCE-LOAD-CLIENT-COFF: declare extern {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
53
54
You can’t perform that action at this time.
0 commit comments