Enable -separate-debug-info for mingw toolchains

Having the debug info in separate files is very helpful, especially on
memory constrained 32bit systems. When the debug info is compiled into
the object files, processes can run out of memory when trying to load
them.

Change-Id: I1808a32e855d6a62e17e1b734c511b31db5f03f1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Ulf Hermann 2016-05-12 17:16:51 +02:00
parent 11f14a0442
commit eda29451e9
2 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,7 @@
SOURCES = objcopy.cpp
CONFIG -= qt
TARGET = objcopytest
QMAKE_POST_LINK += $$QMAKE_OBJCOPY --only-keep-debug objcopy objcopy.debug && $$QMAKE_OBJCOPY --strip-debug objcopy && $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopy.debug objcopy
load(resolve_target)
QMAKE_POST_LINK += $$QMAKE_OBJCOPY --only-keep-debug $$QMAKE_RESOLVED_TARGET objcopytest.debug && $$QMAKE_OBJCOPY --strip-debug $$QMAKE_RESOLVED_TARGET && $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopytest.debug $$QMAKE_RESOLVED_TARGET

View File

@ -0,0 +1,18 @@
have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
load(resolve_target)
QMAKE_TARGET_DEBUG_INFO = $${QMAKE_RESOLVED_TARGET}.debug
shell_target = $$shell_quote($$relative_path($$QMAKE_RESOLVED_TARGET, $$OUT_PWD))
shell_target_debug_info = $$shell_quote($$relative_path($$QMAKE_TARGET_DEBUG_INFO, $$OUT_PWD))
copy_debug_info = $$QMAKE_OBJCOPY --only-keep-debug $$shell_target $$shell_target_debug_info
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
strip_debug_info = $$QMAKE_OBJCOPY --strip-debug $$shell_target
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info $$QMAKE_POST_LINK
silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK
target.targets += $$QMAKE_TARGET_DEBUG_INFO
QMAKE_DISTCLEAN += $$QMAKE_TARGET_DEBUG_INFO
}