[CMAKE:GCC] Produce RosSym data even when building with separate debug symbols

This commit is contained in:
Jérôme Gardou 2021-06-22 15:31:18 +02:00 committed by Jérôme Gardou
parent 79c2972035
commit 54ecf703f2
2 changed files with 23 additions and 19 deletions

View file

@ -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)

View file

@ -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)")