Skip to content

[CMake] Use separate namespace for demangling symbols used by runtime #78490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
7 changes: 7 additions & 0 deletions Runtimes/Core/Demangling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ target_compile_definitions(swiftDemangling PRIVATE
$<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>
$<$<BOOL:${SwiftCore_HAS_ASL}>:-DSWIFT_STDLIB_HAS_ASL>)

# Target libraries that include libDemangling must define the name to use for
# the inline namespace to distinguish symbols from those built for the
# compiler, in order to avoid possible ODR violations if both are statically
# linked into the same binary. (see also commit message for 5b1daa9055c99904c84862ecc313641fd9b26e63)
target_compile_definitions(swiftDemangling PUBLIC
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_INLINE_NAMESPACE=__runtime>)

target_include_directories(swiftDemangling
PRIVATE
"${SwiftCore_SWIFTC_SOURCE_DIR}/include"
Expand Down
3 changes: 2 additions & 1 deletion Runtimes/Core/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ target_include_directories(swiftRuntime PRIVATE

target_link_libraries(swiftRuntime PRIVATE
$<$<PLATFORM_ID:Windows>:User32>
swiftShims)
swiftShims
swiftDemangling)

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