Skip to content

Commit af58e6e

Browse files
authored
Merge pull request #77566 from etcwilde/ewilde/stdlib-rebuild-all-the-defines
[CMake] Cleaning up macOS symbol list
2 parents 391277c + d87a293 commit af58e6e

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

Runtimes/Core/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828
# Catalyst Support
2929
# -- Will need shadow invocations to generate swiftmodules for Swift parts
3030
# Install *.abi.json, swiftdoc, and swiftsourceinfo
31+
# Pointer bounds (SWIFT_ENABLE_EXPERIMENTAL_POINTER_BOUNDS)
3132

3233
cmake_minimum_required(VERSION 3.26...3.29)
3334

35+
set(CMAKE_C_VISIBILITY_PRESET "hidden")
36+
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
37+
3438
set(SwiftCore_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
3539
list(APPEND CMAKE_MODULE_PATH ${SwiftCore_CMAKE_MODULES_DIR})
40+
3641
include(CMakeWorkarounds)
3742
project(SwiftCore LANGUAGES C CXX Swift VERSION 6.1)
3843

@@ -74,22 +79,42 @@ defaulted_option(SwiftCore_ENABLE_VECTOR_TYPES "Enable vector support")
7479
defaulted_option(SwiftCore_ENABLE_REFLECTION "Enable runtime support for mirrors and reflection support")
7580
defaulted_option(SwiftCore_ENABLE_COMMANDLINE_SUPPORT "Enable command line argument support")
7681
defaulted_option(SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS "Enable runtime function counter support")
82+
defaulted_option(SwiftCore_ENABLE_STDIN "Enable functions that use stdin support")
83+
defaulted_option(SwiftCore_ENABLE_ENVIRONMENT "Enable environment variable support")
84+
defaulted_option(SwiftCore_ENABLE_OVERRIDABLE_RETAIN_RELEASE "Enable override hooks for retain/release")
85+
defaulted_option(SwiftCore_ENABLE_MALLOC_TYPE "Enable malloc type information")
86+
defaulted_option(SwiftCore_ENABLE_RUNTIME_OS_VERSIONING "Enable runtime OS version detection")
87+
defaulted_option(SwiftCore_ENABLE_STATIC_PRINT "Disable full print")
88+
defaulted_option(SwiftCore_ENABLE_UNICODE_DATA "Embed Unicode info in Swift Core")
89+
defaulted_option(SwiftCore_ENABLE_COMPACT_ABSOLUTE_FUNCTION_POINTERS "Resolve absolute function pointer as identity")
90+
defaulted_option(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT "Add symbols for runtime backdeployment")
7791

7892
defaulted_option(SwiftCore_ENABLE_BACKTRACING "Enable backtracing runtime support")
7993
defaulted_set(SwiftCore_BACKTRACER_PATH STRING "Set a fixed path to the Swift backtracer")
8094

8195
option(SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS "" OFF)
8296
option(SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER "" OFF)
97+
option(SwiftCore_ENABLE_INTERNAL_CHECKS "" OFF)
8398

8499
defaulted_set(SwiftCore_OBJECT_FORMAT STRING "Object format: ELF COFF")
85100

101+
# TODO: Most of these should be attached to specific targets rather than applied
102+
# globally. They can be applied as part of the library interface if they
103+
# affect the behavior of libraries that build against a given target.
86104
add_compile_definitions(
87105
$<$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>:-DSWIFT_OBJC_INTEROP>
88106
$<$<BOOL:${SwiftCore_ENABLE_LIBRARY_EVOLUTION}>:-DSWIFT_LIBRARY_EVOLUTION>
89107
$<$<BOOL:${SwiftCore_ENABLE_CRASH_REPORTER_CLIENT}>:-DSWIFT_HAVE_CRASHREPORTERCLIENT>
90108
$<$<BOOL:${SwiftCore_ENABLE_VECTOR_TYPES}>:-DSWIFT_STDLIB_ENABLE_VECTOR_TYPES>
91109
$<$<BOOL:${SwiftCore_ENABLE_REFLECTION}>:-DSWIFT_ENABLE_REFLECTION>
92110
$<$<BOOL:${SwiftCore_ENABLE_RUNTIME_FUNCTION_COUNTERS}>:-DSWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS>
111+
$<$<BOOL:${SwiftCore_ENABLE_STDIN}>:-DSWIFT_STDLIB_HAS_STDIN> # core + stubs
112+
$<$<BOOL:${SwiftCore_ENABLE_RUNTIME_OS_VERSIONING}>:-DSWIFT_RUNTIME_OS_VERSIONING> # core + stubs
113+
$<$<BOOL:${SwiftCore_ENABLE_INTERNAL_CHECKS}>:-DINTERNAL_CHECKS_ENABLED> # core
114+
$<$<BOOL:${SwiftCore_ENABLE_STATIC_PRINT}>:-DSWIFT_STDLIB_STATIC_PRINT> # core + concurrency
115+
$<$<BOOL:${SwiftCore_ENABLE_UNICODE_DATA}>:-DSWIFT_STDLIB_ENABLE_UNICODE_DATA> # Stubs
116+
$<$<BOOL:${SwiftCore_ENABLE_ENVIRONMENT}>:-DSWIFT_STDLIB_HAS_ENVIRON> # Concurrency, runtime, shims, platform overlay
117+
$<$<BOOL:${SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT}>:-DSWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT> # Concurrency, Compatibility override, magic symbols
93118
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_ENABLE_LEAK_CHECKER=$<BOOL:${SwiftCore_ENABLE_RUNTIME_LEAK_CHECKER}>>
94119
$<$<COMPILE_LANGUAGE:C,CXX>:-DSWIFT_RUNTIME_CLOBBER_FREED_OBJECTS=$<BOOL:${SwiftCore_ENABLE_CLOBBER_FREED_OBJECTS}>>)
95120

Runtimes/Core/cmake/modules/DefaultSettings.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
set(SwiftCore_ENABLE_BACKTRACING_default OFF) # TODO: enable this by default
99
set(SwiftCore_ENABLE_COMMANDLINE_SUPPORT_default OFF) # TODO: enable this by default
1010

11+
set(SwiftCore_ENABLE_STDIN_default ON)
1112
set(SwiftCore_ENABLE_TYPE_PRINTING_default ON)
1213

1314
set(SwiftCore_BACKTRACER_PATH_default "")
@@ -36,6 +37,8 @@ if(APPLE)
3637
set(SwiftCore_ENABLE_CRASH_REPORTER_CLIENT_default ON)
3738
set(SwiftCore_ENABLE_OBJC_INTEROP_default ON)
3839
set(SwiftCore_ENABLE_REFLECTION_default ON)
40+
set(SwiftCore_ENABLE_RUNTIME_OS_VERSIONING ON)
41+
set(SwiftCore_ENABLE_OVERRIDABLE_RETAIN_RELEASE ON)
3942
elseif(CMAKE_SYSTEM_NAME STREQUAL "WASM")
4043
set(SwiftCore_OBJECT_FORMAT_default "elf")
4144
elseif(LINUX OR ANDROID OR BSD)

Runtimes/Core/core/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ target_compile_options(swiftCore PRIVATE
299299
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xllvm -sil-partial-specialization>")
300300

301301
target_compile_definitions(swiftCore PRIVATE
302-
$<$<BOOL:${SwiftCore_ENABLE_REFLECTION}>:-DSWIFT_ENABLE_REFLECTION>)
302+
$<$<BOOL:${SwiftCore_ENABLE_REFLECTION}>:-DSWIFT_ENABLE_REFLECTION>
303+
$<$<BOOL:${SwiftCore_ENABLE_COMPACT_ABSOLUTE_FUNCTION_POINTERS}>:-DSWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER>
304+
$<$<COMPILE_LANGUAGE:C,CX>:-DSWIFT_TARGET_LIBRARY_NAME=swiftCore>)
303305
target_compile_options(swiftCore PRIVATE
304306
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xcc -DswiftCore_EXPORTS>")
305307

Runtimes/Core/runtime/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ target_compile_definitions(swiftRuntime
8080
-DSWIFT_RUNTIME
8181
-DSWIFT_TARGET_LIBRARY_NAME=swiftRuntime
8282
$<$<BOOL:${SwiftCore_ENABLE_BACKTRACING}>:-DSWIFT_ENABLE_BACKTRACING>
83+
$<$<BOOL:${SwiftCore_ENABLE_OVERRIDABLE_RETAIN_RELEASE}>:-DSWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE>
84+
$<$<BOOL:${SwiftCore_ENABLE_MALLOC_TYPE}>:-DSWIFT_STDLIB_HAS_MALLOC_TYPE>
8385
$<$<BOOL:${SwiftCore_BACKTRACER_PATH}>:-DSWIFT_RUNTIME_FIXED_BACKTRACER_PATH="${SwiftCore_BACKTRACER_PATH}">)
8486

8587
target_include_directories(swiftRuntime PRIVATE

stdlib/public/runtime/HeapObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ WeakReference *swift::swift_weakTakeAssign(WeakReference *dest,
11131113
return dest;
11141114
}
11151115

1116-
#ifndef NDEBUG
1116+
#ifndef NDEBUG // "not not debug", or "debug-able configurations"
11171117

11181118
/// Returns true if the "immutable" flag is set on \p object.
11191119
///

0 commit comments

Comments
 (0)