This is an automated email from the ASF dual-hosted git repository.

liuneng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 920bd8cb78 [CH] Support separate debug symbols from so file #8083
920bd8cb78 is described below

commit 920bd8cb7803fc82c2e49cca26ebeb482fcfc9f2
Author: LiuNeng <[email protected]>
AuthorDate: Sat Nov 30 17:29:11 2024 +0800

    [CH] Support separate debug symbols from so file #8083
    
    What changes were proposed in this pull request?
    support separate debug symbols
    
    How was this patch tested?
    manual tests
    
    image
    
    (If this patch involves UI changes, please attach a screenshot; otherwise, 
remove this)
---
 cpp-ch/local-engine/CMakeLists.txt | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/cpp-ch/local-engine/CMakeLists.txt 
b/cpp-ch/local-engine/CMakeLists.txt
index 4392b55008..4b1c643636 100644
--- a/cpp-ch/local-engine/CMakeLists.txt
+++ b/cpp-ch/local-engine/CMakeLists.txt
@@ -174,6 +174,26 @@ else()
   set(LOCALENGINE_SHARED_LIB_NAME "libch.so")
 endif()
 
+option(ENABLE_SEPARATE_SYMBOLS "support separate debug symbols from so" OFF)
+if(ENABLE_SEPARATE_SYMBOLS)
+  set(SYMBOL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/debug_symbols)
+  file(MAKE_DIRECTORY ${SYMBOL_OUTPUT_DIRECTORY})
+  function(separate_symbols target)
+    add_custom_command(
+      TARGET ${target}
+      POST_BUILD
+      COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $<TARGET_FILE:${target}>
+              ${SYMBOL_OUTPUT_DIRECTORY}/$<TARGET_FILE_NAME:${target}>.debug
+      COMMAND ${CMAKE_OBJCOPY} --strip-debug $<TARGET_FILE:${target}>
+      COMMAND
+        ${CMAKE_OBJCOPY}
+        
--add-gnu-debuglink=${SYMBOL_OUTPUT_DIRECTORY}/$<TARGET_FILE_NAME:${target}>.debug
+        $<TARGET_FILE:${target}>
+      COMMENT "Separating debug symbols for target: ${target}")
+  endfunction()
+  separate_symbols(${LOCALENGINE_SHARED_LIB})
+endif()
+
 add_custom_command(
   OUTPUT ${LOCALENGINE_SHARED_LIB_NAME}
   COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${LOCALENGINE_SHARED_LIB}>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to