Skip to content

Commit 354602e

Browse files
authored
Merge pull request #74077 from kubamracek/embedded-autolink1
[embedded] In -emit-empty-object-file mode, don't emit autolink entries
2 parents d536ffa + 1618341 commit 354602e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,11 @@ static llvm::GlobalObject *createForceImportThunk(IRGenModule &IGM) {
18651865
}
18661866

18671867
void IRGenModule::emitAutolinkInfo() {
1868+
if (getSILModule().getOptions().StopOptimizationAfterSerialization) {
1869+
// We're asked to emit an empty IR module
1870+
return;
1871+
}
1872+
18681873
auto Autolink =
18691874
AutolinkKind::create(TargetInfo, Triple, IRGen.Opts.LLVMLTOKind);
18701875

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -enable-experimental-feature Embedded -c -I%t -parse-as-library %t/MyModuleA.swift -o %t/MyModuleA.o -emit-module -emit-module-path %t/MyModuleA.swiftmodule -emit-empty-object-file
5+
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -enable-experimental-feature Embedded -c -I%t -parse-as-library %t/MyModuleB.swift -o %t/MyModuleB.o -emit-module -emit-module-path %t/MyModuleB.swiftmodule -emit-empty-object-file
6+
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -enable-experimental-feature Embedded -c -I%t -parse-as-library %t/MyModuleC.swift -o %t/MyModuleC.o -emit-module -emit-module-path %t/MyModuleC.swiftmodule -emit-empty-object-file
7+
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -enable-experimental-feature Embedded -c -I%t %t/Main.swift -o %t/Main.o
8+
// RUN: %target-clang %t/Main.o %t/MyModuleA.o %t/MyModuleB.o %t/MyModuleC.o -o %t/a.out
9+
10+
// REQUIRES: swift_in_compiler
11+
// REQUIRES: OS=macosx || OS=linux-gnu
12+
// REQUIRES: CODEGENERATOR=ARM
13+
14+
//--- MyModuleA.swift
15+
16+
public func a() {}
17+
18+
//--- MyModuleB.swift
19+
20+
import MyModuleA
21+
22+
public func b() {}
23+
24+
//--- MyModuleC.swift
25+
26+
import MyModuleB
27+
28+
public func c() {}
29+
30+
//--- Main.swift
31+
32+
import MyModuleA
33+
import MyModuleB
34+
import MyModuleC
35+
36+
a()
37+
b()
38+
c()

0 commit comments

Comments
 (0)