From 58552104851096e77d22c95787e5ebc5df241be7 Mon Sep 17 00:00:00 2001 From: Yuan Date: Tue, 30 Jun 2026 16:23:36 +0100 Subject: [PATCH] [VL] Refine the symbol exporting Signed-off-by: Yuan --- cpp/core/CMakeLists.txt | 3 +++ cpp/velox/CMakeLists.txt | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cpp/core/CMakeLists.txt b/cpp/core/CMakeLists.txt index 9530d603f5b..fc71292a622 100644 --- a/cpp/core/CMakeLists.txt +++ b/cpp/core/CMakeLists.txt @@ -162,6 +162,9 @@ add_dependencies(gluten jni_proto) if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") target_link_options( gluten PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) + # Strip the symbol table in Release builds to reduce binary size. + target_link_options(gluten PRIVATE + $<$>:-Wl,-s>) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) diff --git a/cpp/velox/CMakeLists.txt b/cpp/velox/CMakeLists.txt index 4ec3f9f0f2e..77d24b44918 100644 --- a/cpp/velox/CMakeLists.txt +++ b/cpp/velox/CMakeLists.txt @@ -258,10 +258,13 @@ if(GLUTEN_VELOX_ENABLE_PARQUET) message(STATUS "Propagating VELOX_ENABLE_PARQUET to Gluten Velox backend") endif() -if(ENABLE_GLUTEN_VCPKG AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") - # Hide some symbols to avoid conflict. +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + # Hide symbols not needed by JNI callers. target_link_options( velox PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) + # Strip the symbol table in Release builds to reduce binary size. + target_link_options(velox PRIVATE + $<$>:-Wl,-s>) endif() find_protobuf()