Skip to content

Commit 1ef361e

Browse files
committed
Tell linker to strip unused Swift runtime functions
This allows us to remove the Swift runtime shims.
1 parent 5f1cf18 commit 1ef361e

File tree

2 files changed

+6
-39
lines changed

2 files changed

+6
-39
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ set(CMAKE_Swift_COMPILER
3838
"${swiftc_Path}"
3939
)
4040
set(CMAKE_Swift_FLAGS
41-
# Whole-module optimization is always required for Embedded Swift.
42-
"-enable-experimental-feature Embedded -wmo -target armv6m-none-none-eabi"
41+
# -wmo: Whole-module optimization is always required for Embedded Swift.
42+
# -Xfrontend -function-sections: enables dead stripping of unused runtime functions.
43+
"-target armv6m-none-none-eabi \
44+
-enable-experimental-feature Embedded \
45+
-wmo \
46+
-Xfrontend -function-sections"
4347
)
4448
# Disable CMake’s automatic Swift compiler check. The compiler check always
4549
# fails for Embedded Swift because it tries to compile a Swift program that
@@ -62,7 +66,6 @@ endif()
6266

6367
add_executable(SwiftPico
6468
main.c
65-
swift-shims.c
6669
)
6770

6871
add_subdirectory(SwiftLib)

swift-shims.c

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)