[Lldb-commits] [lldb] [lldb][unittests] Add LLDB_UNITTEST_STRIP_DEBUG_INFO to cut unittest link time (PR #203274)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 12 04:27:57 PDT 2026


================
@@ -41,6 +46,23 @@ function(add_lldb_unittest test_name)
     COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Inputs)
 
   target_link_libraries(${test_name} PRIVATE ${ARG_LINK_LIBS})
+
+  if (LLDB_UNITTEST_STRIP_DEBUG_INFO)
+    if (MSVC)
+      target_link_options(${test_name} PRIVATE
+        "LINKER:/DEBUG:NONE"
+        "LINKER:/INCREMENTAL:NO"
+        "LINKER:/OPT:REF"
+        "LINKER:/OPT:ICF")
+    else()
+      target_compile_options(${test_name} PRIVATE -g0)
+      if (APPLE)
+        target_link_options(${test_name} PRIVATE "LINKER:-S")
----------------
adrian-prantl wrote:

I wouldn't even implement this for non-Windows; there is really no situation where this would be useful.

https://github.com/llvm/llvm-project/pull/203274


More information about the lldb-commits mailing list