diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c8e4e521ae70..6dad918106814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,7 +268,9 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING # SWIFT_VERSION is deliberately /not/ cached so that an existing build directory # can be reused when a new version of Swift comes out (assuming the user hasn't # manually set it as part of their own CMake configuration). -set(SWIFT_VERSION "5.9") +set(SWIFT_VERSION_MAJOR 5) +set(SWIFT_VERSION_MINOR 9) +set(SWIFT_VERSION "${SWIFT_VERSION_MAJOR}.${SWIFT_VERSION_MINOR}") set(SWIFT_VENDOR "" CACHE STRING "The vendor name of the Swift compiler") diff --git a/include/swift/Runtime/CMakeConfig.h.in b/include/swift/Runtime/CMakeConfig.h.in index e24e5c3fe7db8..4f31705582890 100644 --- a/include/swift/Runtime/CMakeConfig.h.in +++ b/include/swift/Runtime/CMakeConfig.h.in @@ -7,4 +7,7 @@ #cmakedefine01 SWIFT_BNI_OS_BUILD #cmakedefine01 SWIFT_BNI_XCODE_BUILD +#cmakedefine SWIFT_VERSION_MAJOR "@SWIFT_VERSION_MAJOR@" +#cmakedefine SWIFT_VERSION_MINOR "@SWIFT_VERSION_MINOR@" + #endif diff --git a/stdlib/public/CompatibilityOverride/CompatibilityOverride.h b/stdlib/public/CompatibilityOverride/CompatibilityOverride.h index 527a3586de7f8..e56eb37d15327 100644 --- a/stdlib/public/CompatibilityOverride/CompatibilityOverride.h +++ b/stdlib/public/CompatibilityOverride/CompatibilityOverride.h @@ -85,6 +85,7 @@ #include "swift/Runtime/Concurrency.h" #include "swift/Runtime/Metadata.h" #include "swift/Runtime/Once.h" +#include "swift/Runtime/CMakeConfig.h" #include namespace swift { @@ -153,8 +154,17 @@ namespace swift { // Override section name computation. `COMPATIBILITY_OVERRIDE_SECTION_NAME` will // resolve to string literal containing the appropriate section name for the // current library. -#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime "__swift58_hooks" -#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency "__s58async_hook" +// Turns into '__swift_hooks' +#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime "__swift" \ + SWIFT_VERSION_MAJOR \ + SWIFT_VERSION_MINOR \ + "_hooks" + +// Turns into '__sasync_hook' +#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency "__s" \ + SWIFT_VERSION_MAJOR \ + SWIFT_VERSION_MINOR \ + "async_hook" #define COMPATIBILITY_OVERRIDE_SECTION_NAME \ COMPATIBILITY_CONCAT(COMPATIBILITY_OVERRIDE_SECTION_NAME_, \ diff --git a/unittests/runtime/CompatibilityOverrideConcurrency.cpp b/unittests/runtime/CompatibilityOverrideConcurrency.cpp index b6fc271ab27c1..51c283e8e93f9 100644 --- a/unittests/runtime/CompatibilityOverrideConcurrency.cpp +++ b/unittests/runtime/CompatibilityOverrideConcurrency.cpp @@ -55,7 +55,7 @@ struct OverrideSection { }; OverrideSection ConcurrencyOverrides - __attribute__((section("__DATA,__s58async_hook"))) = { + __attribute__((section("__DATA," COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency))) = { 0, #define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \ name##Override, diff --git a/unittests/runtime/CompatibilityOverrideRuntime.cpp b/unittests/runtime/CompatibilityOverrideRuntime.cpp index 070b5b5b2fb32..90a1bafbc6b16 100644 --- a/unittests/runtime/CompatibilityOverrideRuntime.cpp +++ b/unittests/runtime/CompatibilityOverrideRuntime.cpp @@ -62,7 +62,7 @@ struct OverrideSection { }; OverrideSection RuntimeOverrides - __attribute__((section("__DATA,__swift58_hooks"))) = { + __attribute__((section("__DATA," COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime))) = { 0, #define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \ name ## Override,