Skip to content

Commit 9581562

Browse files
authored
Merge pull request ClickHouse#78668 from azat/optimize-strip
build: optimize strip by using -o over extra cp
2 parents 88682bc + 967e8a1 commit 9581562

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmake/split_debug_symbols.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ macro(clickhouse_split_debug_symbols)
2020
add_custom_command(TARGET ${STRIP_TARGET} POST_BUILD
2121
COMMAND mkdir -p "${STRIP_DESTINATION_DIR}/lib/debug/bin"
2222
COMMAND mkdir -p "${STRIP_DESTINATION_DIR}/bin"
23-
COMMAND cp "${STRIP_BINARY_PATH}" "${STRIP_DESTINATION_DIR}/bin/${STRIP_TARGET}"
2423
# Splits debug symbols into separate file, leaves the binary untouched:
25-
COMMAND "${OBJCOPY_PATH}" --only-keep-debug "${STRIP_DESTINATION_DIR}/bin/${STRIP_TARGET}" "${STRIP_DESTINATION_DIR}/lib/debug/bin/${STRIP_TARGET}.debug"
24+
COMMAND "${OBJCOPY_PATH}" --only-keep-debug "${STRIP_BINARY_PATH}" "${STRIP_DESTINATION_DIR}/lib/debug/bin/${STRIP_TARGET}.debug"
2625
COMMAND chmod 0644 "${STRIP_DESTINATION_DIR}/lib/debug/bin/${STRIP_TARGET}.debug"
2726
# Strips binary, sections '.note' & '.comment' are removed in line with Debian's stripping policy: www.debian.org/doc/debian-policy/ch-files.html, section '.clickhouse.hash' is needed for integrity check.
2827
# Also, after we disabled the export of symbols for dynamic linking, we still to keep a static symbol table for good stack traces.
29-
COMMAND "${STRIP_PATH}" --strip-debug --remove-section=.comment --remove-section=.note "${STRIP_DESTINATION_DIR}/bin/${STRIP_TARGET}"
28+
COMMAND "${STRIP_PATH}" --strip-debug --remove-section=.comment --remove-section=.note "${STRIP_BINARY_PATH}" -o "${STRIP_DESTINATION_DIR}/bin/${STRIP_TARGET}"
3029
# Associate stripped binary with debug symbols:
3130
COMMAND "${OBJCOPY_PATH}" --add-gnu-debuglink "${STRIP_DESTINATION_DIR}/lib/debug/bin/${STRIP_TARGET}.debug" "${STRIP_DESTINATION_DIR}/bin/${STRIP_TARGET}"
3231
COMMENT "Stripping clickhouse binary" VERBATIM

0 commit comments

Comments
 (0)