Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions include/swift/Runtime/CMakeConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 12 additions & 2 deletions stdlib/public/CompatibilityOverride/CompatibilityOverride.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <type_traits>

namespace swift {
Expand Down Expand Up @@ -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<major><minor>_hooks'
#define COMPATIBILITY_OVERRIDE_SECTION_NAME_swiftRuntime "__swift" \
SWIFT_VERSION_MAJOR \
SWIFT_VERSION_MINOR \
"_hooks"

// Turns into '__s<major><minor>async_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_, \
Expand Down
2 changes: 1 addition & 1 deletion unittests/runtime/CompatibilityOverrideConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion unittests/runtime/CompatibilityOverrideRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down