https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54ecf703f21001b58d8f7…
commit 54ecf703f21001b58d8f781c5043451de1733d9b
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Tue Jun 22 15:31:18 2021 +0200
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Tue Jun 29 11:49:20 2021 +0200
[CMAKE:GCC] Produce RosSym data even when building with separate debug symbols
---
boot/freeldr/freeldr/CMakeLists.txt | 13 +++++--------
sdk/cmake/gcc.cmake | 29 ++++++++++++++++++-----------
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt
index 880d949a780..678c20cafff 100644
--- a/boot/freeldr/freeldr/CMakeLists.txt
+++ b/boot/freeldr/freeldr/CMakeLists.txt
@@ -277,14 +277,11 @@ if(MSVC)
else()
target_link_options(freeldr_pe PRIVATE
-Wl,--exclude-all-symbols,--file-alignment,0x200,--section-alignment,0x200)
add_linker_script(freeldr_pe freeldr_gcc.lds)
- if (NOT SEPARATE_DBG)
- target_link_options(freeldr_pe PRIVATE -Wl,--strip-all)
- else()
- # Strip everything (more than objcopy --strip-debug does)
- add_custom_command(TARGET freeldr_pe
- POST_BUILD
- COMMAND ${CMAKE_STRIP} --strip-all
$<TARGET_FILE:freeldr_pe>)
- endif()
+ # Strip everything, including rossym data
+ add_custom_command(TARGET freeldr_pe
+ POST_BUILD
+ COMMAND ${CMAKE_STRIP} --remove-section=.rossym
$<TARGET_FILE:freeldr_pe>
+ COMMAND ${CMAKE_STRIP} --strip-all $<TARGET_FILE:freeldr_pe>)
endif()
set_image_base(freeldr_pe 0x10000)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index fec53361b08..af04f616761 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -194,27 +194,34 @@ if(SEPARATE_DBG)
else()
set(SYMBOL_FILE <TARGET>)
endif()
- set(OBJCOPY ${CMAKE_OBJCOPY})
+
+ if (NOT NO_ROSSYM)
+ get_target_property(RSYM native-rsym IMPORTED_LOCATION)
+ set(strip_debug "${RSYM} -s ${REACTOS_SOURCE_DIR} <TARGET>
<TARGET>")
+ else()
+ set(strip_debug "${CMAKE_STRIP} --strip-debug <TARGET>")
+ endif()
+
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS>
<OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
- "${OBJCOPY} --only-keep-debug <TARGET>
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
- "${OBJCOPY} --strip-debug <TARGET>")
+ "${CMAKE_STRIP} --only-keep-debug <TARGET> -o
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
+ ${strip_debug})
set(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>
<OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
- "${OBJCOPY} --only-keep-debug <TARGET>
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
- "${OBJCOPY} --strip-debug <TARGET>")
+ "${CMAKE_STRIP} --only-keep-debug <TARGET> -o
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
+ ${strip_debug})
set(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
- "${OBJCOPY} --only-keep-debug <TARGET>
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
- "${OBJCOPY} --strip-debug <TARGET>")
+ "${CMAKE_STRIP} --only-keep-debug <TARGET> -o
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
+ ${strip_debug})
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
- "${OBJCOPY} --only-keep-debug <TARGET>
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
- "${OBJCOPY} --strip-debug <TARGET>")
+ "${CMAKE_STRIP} --only-keep-debug <TARGET> -o
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
+ ${strip_debug})
set(CMAKE_RC_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
- "${OBJCOPY} --only-keep-debug <TARGET>
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
- "${OBJCOPY} --strip-debug <TARGET>")
+ "${CMAKE_STRIP} --only-keep-debug <TARGET> -o
${REACTOS_BINARY_DIR}/symbols/${SYMBOL_FILE}"
+ ${strip_debug})
elseif(NO_ROSSYM)
# Dwarf-based build
message(STATUS "Generating a dwarf-based build (no rsym)")