0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-04-04 01:05:23 +00:00

allow building with separate debug info

Add SPLIT_DEBUG_INFO option, when it's set to yes the debug info is
stored in separate .dwo files.

This is mainly useful for remote debugging and reduces image size a lot.

See also https://gcc.gnu.org/wiki/DebugFission

Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
Matthias Reichl
2020-04-22 19:55:38 +02:00
parent 7d9abe360d
commit 3524d12878
2 changed files with 15 additions and 3 deletions

@ -208,6 +208,7 @@ setup_pkg_config_host() {
}
setup_toolchain() {
local have_gold="no"
if [ "$LTO_SUPPORT" = "yes" ]; then
if flag_enabled "lto-parallel" "no"; then
TARGET_CFLAGS+=" $FLAGS_OPTIM_LTO_PARALLEL $FLAGS_OPTIM_LTO_NO_FAT"
@ -233,13 +234,20 @@ setup_toolchain() {
# gold flag
if flag_enabled "gold" "$GOLD_SUPPORT" "only-disable"; then
TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_GOLD"
have_gold="yes"
fi
# compiler optimization, descending priority: speed, size, default
if [ "${BUILD_WITH_DEBUG}" = "yes" ]; then
TARGET_CFLAGS+=" $CFLAGS_OPTIM_DEBUG"
TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_DEBUG"
TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_DEBUG"
if [ "${SPLIT_DEBUG_INFO}" = "yes" -a "${have_gold}" = "yes" ]; then
TARGET_CFLAGS+=" $CFLAGS_OPTIM_DEBUG_SPLIT"
TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_DEBUG_SPLIT"
TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_DEBUG_SPLIT"
else
TARGET_CFLAGS+=" $CFLAGS_OPTIM_DEBUG"
TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_DEBUG"
TARGET_LDFLAGS+=" $LDFLAGS_OPTIM_DEBUG"
fi
elif flag_enabled "speed" "no"; then
TARGET_CFLAGS+=" $CFLAGS_OPTIM_SPEED"
TARGET_CXXFLAGS+=" $CXXFLAGS_OPTIM_SPEED"

@ -43,6 +43,10 @@ CXXFLAGS_OPTIM_SIZE="$CFLAGS_OPTIM_SIZE"
CFLAGS_OPTIM_DEBUG="-ggdb -Os"
CXXFLAGS_OPTIM_DEBUG="$CFLAGS_OPTIM_DEBUG"
LDFLAGS_OPTIM_DEBUG="-ggdb"
# split debug settings (requires gold)
CFLAGS_OPTIM_DEBUG_SPLIT="-gsplit-dwarf -Os"
CXXFLAGS_OPTIM_DEBUG_SPLIT="$CFLAGS_OPTIM_DEBUG_SPLIT"
LDFLAGS_OPTIM_DEBUG_SPLIT="-Wl,--gdb-index"
# position-independent code
CFLAGS_OPTIM_PIC="-fPIC -DPIC"