Kernel: Use our toolchain's c++filt tool for the kernel map

The host's version of c++filt might not work on some operating systems,
e.g. macOS.
This commit is contained in:
Gunnar Beutner 2021-07-29 08:48:47 +02:00 committed by Andreas Kling
parent a68d912dc0
commit b7ca269b4d
Notes: sideshowbarker 2024-07-18 07:56:12 +09:00
3 changed files with 4 additions and 2 deletions

View file

@ -175,6 +175,7 @@ else()
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
set(CMAKE_AR ${TOOLCHAIN_PREFIX}gcc-ar)
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
set(CMAKE_CXXFILT ${TOOLCHAIN_PREFIX}c++filt)
endif()
foreach(lang ASM C CXX OBJC OBJCXX)

View file

@ -451,7 +451,7 @@ add_dependencies(Kernel kernel_heap)
add_custom_command(
TARGET Kernel POST_BUILD
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
COMMAND ${CMAKE_COMMAND} -E env CXXFILT=${CMAKE_CXXFILT} sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel

View file

@ -2,5 +2,6 @@
tmp=$(mktemp)
nm -n Kernel | grep -vE \\.Lubsan_data | awk '{ if ($2 != "a") print; }' | uniq > "$tmp"
printf "%08x\n" "$(wc -l "$tmp" | awk '{print $1}')" > kernel.map
c++filt < "$tmp" >> kernel.map
CXXFILT="${CXXFILT:-c++filt}"
"$CXXFILT" < "$tmp" >> kernel.map
rm -f "$tmp"