Skip to content

Commit b0627e2

Browse files
committed
stdlib: Build with -previous-module-installname-map-file on Apple platforms
1 parent 57872b1 commit b0627e2

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,19 @@ if(SWIFT_STDLIB_HAS_COMMANDLINE)
347347
list(APPEND swift_core_incorporate_object_libraries swiftCommandLineSupport)
348348
endif()
349349

350+
# Backward deployment of Span on Apple platforms is implemented via the
351+
# libswiftCompatibilitySpan.dylib shim.
352+
#
353+
# This flag ensures we emit the correct $ld$previous$ symbols in the standard
354+
# library. When building a binary for an older deployment target, we
355+
# pretend certain symbols are actually in libswiftCompatibilitySpan.dylib.
356+
#
357+
# Further discussion of libswiftCompatibilitySpan.dylib appears below.
358+
#
359+
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
360+
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-previous-module-installname-map-file" "-Xfrontend" "${CMAKE_CURRENT_SOURCE_DIR}/PreviousModuleInstallName.json")
361+
endif()
362+
350363
set(swiftCore_common_options
351364
IS_STDLIB IS_STDLIB_CORE
352365
${SWIFTLIB_SOURCES}
@@ -424,9 +437,6 @@ add_swift_target_library(swiftCore
424437
zippered
425438
)
426439

427-
# Backward deployment of Span on Apple platforms is implemented via the
428-
# libswiftCompatibilitySpan.dylib shim.
429-
#
430440
# When a binary built with an older deployment target is run with a new
431441
# standard library, the symbols that were previously in the backward
432442
# compatibility shim are now in the standard library. To ensure the
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"module": "CompatibilitySpan",
4+
"install_name": "/usr/lib/swift/libswiftCompatibilitySpan.dylib"
5+
}
6+
]

0 commit comments

Comments
 (0)