Skip to content

Commit b2225b2

Browse files
authored
Merge pull request swiftlang#78490 from edymtt/edymtt/set-swift-inline-namespace-for-core
[CMake] Use separate namespace for demangling symbols used by runtime
2 parents 550ac9f + d546222 commit b2225b2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Runtimes/Core/Demangling/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ target_compile_definitions(swiftDemangling PRIVATE
1616
$<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>
1717
$<$<BOOL:${SwiftCore_HAS_ASL}>:-DSWIFT_STDLIB_HAS_ASL>)
1818

19+
# Target libraries that include libDemangling must define the name to use for
20+
# the inline namespace to distinguish symbols from those built for the
21+
# compiler, in order to avoid possible ODR violations if both are statically
22+
# linked into the same binary. (see also commit message for 5b1daa9055c99904c84862ecc313641fd9b26e63)
23+
target_compile_definitions(swiftDemangling PUBLIC
24+
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_INLINE_NAMESPACE=__runtime>)
25+
1926
target_include_directories(swiftDemangling
2027
PRIVATE
2128
"${SwiftCore_SWIFTC_SOURCE_DIR}/include"

Runtimes/Core/runtime/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ target_include_directories(swiftRuntime PRIVATE
108108

109109
target_link_libraries(swiftRuntime PRIVATE
110110
$<$<PLATFORM_ID:Windows>:User32>
111-
swiftShims)
111+
swiftShims
112+
swiftDemangling)
112113

113114
# FIXME: Refactor so that we're not pulling sources from the compiler files
114115
target_sources(swiftRuntime PRIVATE

0 commit comments

Comments
 (0)