Implement ADD_GDB_INDEX() macro
ISSUE:
Note: mandatory check (NEED_CHECK) was skipped
@@ -1789,13 +1789,27 @@ when ($STRIP == "yes" && $NO_STRIP != "yes") {
OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
+### @usage: ADD_GDB_INDEX()
+### Adds .gdb_index section to the target binary
+macro ADD_GDB_INDEX() {
+ SET(ADD_GDB_INDEX_VALUE yes)
+}
+
+when ($ADD_GDB_INDEX_VALUE && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
+ DWARF_COMMAND= \
+ $(GDB)/gdb/bin/gdb $TARGET -batch -n --ex "save gdb-index ${BINDIR}" && \
+ $OBJCOPY_TOOL --add-section .gdb_index=$TARGET.gdb-index --set-section-flags .gdb_index=readonly $TARGET && \
+ $REMOVE_FILE $TARGET.gdb-index ${kv;hide:"needs_resourceGDB"} &&
+ PEERDIR+=contrib/libs/platform/tools/misc/binutils
+}
+
macro SPLIT_DWARF() {
SET(SPLIT_DWARF_VALUE yes)
}
SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
when ($SPLIT_DWARF_VALUE == "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
- DWARF_COMMAND= \
+ DWARF_COMMAND+= \
$OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
$STRIP_TOOL --remove-section .gnu_debuglink $TARGET && \
$OBJCOPY_TOOL --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
