From eae8fb34b8e21bd50499304ca43602560a3f3ee2 Mon Sep 17 00:00:00 2001 From: Zack Radisic <56137411+zackradisic@users.noreply.github.com> Date: Sat, 12 Jul 2025 17:13:34 -0700 Subject: [PATCH] Don't strip out debug symbols for lldb (#20874) Co-authored-by: CountBleck Co-authored-by: Jarred Sumner Co-authored-by: Michael H Co-authored-by: 190n Co-authored-by: Alistair Smith Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> Co-authored-by: Ciro Spaciari Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com> Co-authored-by: Kai Tamkun <13513421+heimskr@users.noreply.github.com> Co-authored-by: Claude Co-authored-by: Claude Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Meghan Denny --- cmake/targets/BuildBun.cmake | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmake/targets/BuildBun.cmake b/cmake/targets/BuildBun.cmake index ede0b6c305..664ed8e1dc 100644 --- a/cmake/targets/BuildBun.cmake +++ b/cmake/targets/BuildBun.cmake @@ -951,14 +951,22 @@ endif() if(APPLE) target_link_options(${bun} PUBLIC - -dead_strip - -dead_strip_dylibs -Wl,-ld_new -Wl,-no_compact_unwind -Wl,-stack_size,0x1200000 -fno-keep-static-consts -Wl,-map,${bun}.linker-map ) + + # don't strip in debug, this seems to be needed so that the Zig std library + # `*dbHelper` DWARF symbols (used by LLDB for pretty printing) are in the + # output executable + if(NOT DEBUG) + target_link_options(${bun} PUBLIC + -dead_strip + -dead_strip_dylibs + ) + endif() endif() if(LINUX) @@ -995,7 +1003,6 @@ if(LINUX) -Wl,-no-pie -Wl,-icf=safe -Wl,--as-needed - -Wl,--gc-sections -Wl,-z,stack-size=12800000 -Wl,--compress-debug-sections=zlib -Wl,-z,lazy @@ -1011,6 +1018,15 @@ if(LINUX) -Wl,--build-id=sha1 # Better for debugging than default -Wl,-Map=${bun}.linker-map ) + + # don't strip in debug, this seems to be needed so that the Zig std library + # `*dbHelper` DWARF symbols (used by LLDB for pretty printing) are in the + # output executable + if(NOT DEBUG) + target_link_options(${bun} PUBLIC + -Wl,--gc-sections + ) + endif() endif() # --- Symbols list ---