Skip to content

Commit 5c35136

Browse files
committed
When compiling with lto enabled, use -gline-tables-only instead of -g when debugging is enabled.
-g uses too much memory. -g-line-stables at least lets you get stack traces, etc. This is also what clang does IIRC.
1 parent 767d9ca commit 5c35136

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ function(_add_variant_c_compile_flags)
136136

137137
is_build_type_with_debuginfo("${CFLAGS_BUILD_TYPE}" debuginfo)
138138
if(debuginfo)
139-
list(APPEND result "-g")
139+
if(SWIFT_ENABLE_LTO)
140+
list(APPEND result "-gline-tables-only")
141+
else()
142+
list(APPEND result "-g")
143+
endif()
140144
else()
141145
list(APPEND result "-g0")
142146
endif()

0 commit comments

Comments
 (0)