Skip to content

Commit 9dbdd5e

Browse files
committed
Merge pull request #68799 from al45tair/eng/PR-116105222-5.9
[Linux] Make the backtracing symbol reference conditional.
1 parent 52ca037 commit 9dbdd5e

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

stdlib/public/runtime/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ set(LLVM_OPTIONAL_SOURCES
9999
${swift_runtime_leaks_sources}
100100
${swift_runtime_backtracing_sources})
101101

102+
set(swift_enable_backtracing)
102103
if(SWIFT_ENABLE_BACKTRACING)
103104
list(APPEND swift_runtime_sources ${swift_runtime_backtracing_sources})
105+
set(swift_enable_backtracing -DSWIFT_ENABLE_BACKTRACING)
104106
endif()
105107

106108
set(swift_runtime_library_compile_flags ${swift_runtime_compile_flags})
@@ -159,7 +161,9 @@ endforeach()
159161
add_swift_target_library(swiftImageRegistrationObjectELF
160162
OBJECT_LIBRARY IS_STDLIB IS_STDLIB_CORE
161163
SwiftRT-ELF.cpp
162-
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS}
164+
C_COMPILE_FLAGS
165+
${SWIFT_RUNTIME_CORE_CXX_FLAGS}
166+
${swift_enable_backtracing}
163167
C_COMPILE_FLAGS_LINUX -fno-lto
164168
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
165169
TARGET_SDKS ${ELFISH_SDKS}
@@ -170,7 +174,9 @@ add_swift_target_library(swiftImageRegistrationObjectELF
170174
add_swift_target_library(swiftImageRegistrationObjectCOFF
171175
OBJECT_LIBRARY IS_STDLIB IS_STDLIB_CORE
172176
SwiftRT-COFF.cpp
173-
C_COMPILE_FLAGS ${SWIFT_RUNTIME_CORE_CXX_FLAGS}
177+
C_COMPILE_FLAGS
178+
${SWIFT_RUNTIME_CORE_CXX_FLAGS}
179+
${swift_enable_backtracing}
174180
LINK_FLAGS ${SWIFT_RUNTIME_CORE_LINK_FLAGS}
175181
TARGET_SDKS ${COFF_SDKS}
176182
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}

stdlib/public/runtime/SwiftRT-ELF.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919

2020
extern "C" const char __dso_handle[];
2121

22+
#if SWIFT_ENABLE_BACKTRACING
2223
// Drag in a symbol from the backtracer, to force the static linker to include
2324
// the code.
2425
static const void *__backtraceRef __attribute__((used))
2526
= (const void *)swift::runtime::backtrace::_swift_backtrace_isThunkFunction;
27+
#endif
2628

2729
// Create empty sections to ensure that the start/stop symbols are synthesized
2830
// by the linker. Otherwise, we may end up with undefined symbol references as

test/lit.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,6 @@ config.substitutions.append( ('%llvm_obj_root', config.llvm_obj_root) )
557557
config.substitutions.append( ('%swift-lib-dir', config.swift_lib_dir) )
558558
config.substitutions.append( ('%swift-host-lib-dir', config.swift_host_lib_dir))
559559
config.substitutions.append( ('%swift-libexec-dir', config.swift_lib_dir) )
560-
config.substitutions.append( ('%swift-plugin-dir', config.swift_plugin_dir) )
561-
562560
config.substitutions.append( ('%llvm_src_root', config.llvm_src_root) )
563561
config.substitutions.append( ('%swift_obj_root', config.swift_obj_root) )
564562
config.substitutions.append( ('%swift_src_root', config.swift_src_root) )

0 commit comments

Comments
 (0)