Skip to content

Commit 00af28c

Browse files
authored
Merge pull request #63705 from etcwilde/ewilde/swift5ever-compat-override-sections
2 parents 7d690a4 + aa34d98 commit 00af28c

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
268268
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
269269
# can be reused when a new version of Swift comes out (assuming the user hasn't
270270
# manually set it as part of their own CMake configuration).
271-
set(SWIFT_VERSION "5.9")
271+
set(SWIFT_VERSION_MAJOR 5)
272+
set(SWIFT_VERSION_MINOR 9)
273+
set(SWIFT_VERSION "${SWIFT_VERSION_MAJOR}.${SWIFT_VERSION_MINOR}")
272274

273275
set(SWIFT_VENDOR "" CACHE STRING
274276
"The vendor name of the Swift compiler")

include/swift/Runtime/CMakeConfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@
77
#cmakedefine01 SWIFT_BNI_OS_BUILD
88
#cmakedefine01 SWIFT_BNI_XCODE_BUILD
99

10+
#cmakedefine SWIFT_VERSION_MAJOR "@SWIFT_VERSION_MAJOR@"
11+
#cmakedefine SWIFT_VERSION_MINOR "@SWIFT_VERSION_MINOR@"
12+
1013
#endif

stdlib/public/CompatibilityOverride/CompatibilityOverride.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
#include "swift/Runtime/Concurrency.h"
8686
#include "swift/Runtime/Metadata.h"
8787
#include "swift/Runtime/Once.h"
88+
#include "swift/Runtime/CMakeConfig.h"
8889
#include <type_traits>
8990

9091
namespace swift {
@@ -153,8 +154,17 @@ namespace swift {
153154
// Override section name computation. `COMPATIBILITY_OVERRIDE_SECTION_NAME` will
154155
// resolve to string literal containing the appropriate section name for the
155156
// current library.
156-
#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime "__swift58_hooks"
157-
#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency "__s58async_hook"
157+
// Turns into '__swift<major><minor>_hooks'
158+
#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime "__swift" \
159+
SWIFT_VERSION_MAJOR \
160+
SWIFT_VERSION_MINOR \
161+
"_hooks"
162+
163+
// Turns into '__s<major><minor>async_hook'
164+
#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency "__s" \
165+
SWIFT_VERSION_MAJOR \
166+
SWIFT_VERSION_MINOR \
167+
"async_hook"
158168

159169
#define COMPATIBILITY_OVERRIDE_SECTION_NAME \
160170
COMPATIBILITY_CONCAT(COMPATIBILITY_OVERRIDE_SECTION_NAME_, \

unittests/runtime/CompatibilityOverrideConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct OverrideSection {
5555
};
5656

5757
OverrideSection ConcurrencyOverrides
58-
__attribute__((section("__DATA,__s58async_hook"))) = {
58+
__attribute__((section("__DATA," COMPATIBILITY_OVERRIDE_SECTION_NAME_swift_Concurrency))) = {
5959
0,
6060
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
6161
name##Override,

unittests/runtime/CompatibilityOverrideRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct OverrideSection {
6262
};
6363

6464
OverrideSection RuntimeOverrides
65-
__attribute__((section("__DATA,__swift58_hooks"))) = {
65+
__attribute__((section("__DATA," COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime))) = {
6666
0,
6767
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
6868
name ## Override,

0 commit comments

Comments
 (0)