Skip to content

Commit 4637f2b

Browse files
authored
Merge pull request #26072 from jimingham/no-force-load
Merge pull request #25966 from jimingham/master
2 parents 37b0ce8 + 8320356 commit 4637f2b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,12 @@ llvm::SmallString<32> getTargetDependentLibraryOption(const llvm::Triple &T,
996996
void IRGenModule::addLinkLibrary(const LinkLibrary &linkLib) {
997997
llvm::LLVMContext &ctx = Module.getContext();
998998

999+
// The debugger gets the autolink information directly from
1000+
// the LinkLibraries of the module, so there's no reason to
1001+
// emit it into the IR of debugger expressions.
1002+
if (Context.LangOpts.DebuggerSupport)
1003+
return;
1004+
9991005
switch (linkLib.getKind()) {
10001006
case LibraryKind::Library: {
10011007
llvm::SmallString<32> opt =

test/Serialization/autolinking.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// RUN: %FileCheck %s < %t/force-load.txt
1616
// RUN: %FileCheck -check-prefix FORCE-LOAD-CLIENT -check-prefix FORCE-LOAD-CLIENT-%target-object-format %s < %t/force-load.txt
1717

18+
// RUN: %target-swift-frontend -runtime-compatibility-version none -emit-ir -debugger-support %s -I %t > %t/force-load.txt
19+
// RUN: %FileCheck -check-prefix NO-FORCE-LOAD-CLIENT %s < %t/force-load.txt
20+
1821
// RUN: %target-swift-frontend -disable-autolinking-runtime-compatibility-dynamic-replacements -runtime-compatibility-version none -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift | %FileCheck --check-prefix=NO-FORCE-LOAD %s
1922
// RUN: %target-swift-frontend -runtime-compatibility-version none -emit-ir -parse-stdlib -module-name someModule -module-link-name module %S/../Inputs/empty.swift -autolink-force-load | %FileCheck --check-prefix=FORCE-LOAD %s
2023
// RUN: %target-swift-frontend -runtime-compatibility-version none -emit-ir -parse-stdlib -module-name someModule -module-link-name 0module %S/../Inputs/empty.swift -autolink-force-load | %FileCheck --check-prefix=FORCE-LOAD-HEX %s
@@ -38,13 +41,16 @@ import someModule
3841
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!"-framework", !"someModule"}
3942

4043
// NO-FORCE-LOAD-NOT: FORCE_LOAD
44+
// NO-FORCE-LOAD-NOT -lmodule
45+
// NO-FORCE-LOAD-NOT -lmagic
4146
// FORCE-LOAD: define{{( dllexport)?}} void @"_swift_FORCE_LOAD_$_module"() {
4247
// FORCE-LOAD: ret void
4348
// FORCE-LOAD: }
4449
// FORCE-LOAD-HEX: define{{( dllexport)?}} void @"_swift_FORCE_LOAD_$306d6f64756c65"() {
4550
// FORCE-LOAD-HEX: ret void
4651
// FORCE-LOAD-HEX: }
4752

53+
// NO-FORCE-LOAD-CLIENT-NOT: FORCE_LOAD
4854
// FORCE-LOAD-CLIENT: @"_swift_FORCE_LOAD_$_module_$_autolinking" = weak_odr hidden constant void ()* @"_swift_FORCE_LOAD_$_module"
4955
// FORCE-LOAD-CLIENT: @llvm.used = appending global [{{[0-9]+}} x i8*] [
5056
// FORCE-LOAD-CLIENT: i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_module_$_autolinking" to i8*)

0 commit comments

Comments
 (0)