Fix LTCG linker flags for macOS with separate debug info
The linker must not throw away the lto.o file. We now instruct the linker to create a non-temporary lto.o, dependent on the target name. In order to do that we introduce a new mkspec variable QMAKE_LFLAGS_LTCG_SEPARATE_DEBUG_INFO. This variable can contain single-$ variable references that get evaluated when loading ltcg.prf. Fixes: QTBUG-72846 Change-Id: I0ea882628d63e5406ba0ee68c7435af597364b0f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
26f8adb1ee
commit
8ffb200153
@ -5,6 +5,7 @@ QMAKE_OBJCXXFLAGS_PRECOMPILE = -x objective-c++-header -c ${QMAKE_PCH_INPUT}
|
||||
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
|
||||
QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
||||
QMAKE_LFLAGS_LTCG_SEPARATE_DEBUG_INFO = -Wl,-object_path_lto,${OBJECTS_DIR}/${TARGET}_lto.o
|
||||
|
||||
QMAKE_CXXFLAGS += -stdlib=libc++
|
||||
QMAKE_LFLAGS += -stdlib=libc++
|
||||
|
@ -1,6 +1,12 @@
|
||||
static:no-static-ltcg {
|
||||
# Static library but no-static-ltcg enabled: skip LTCG
|
||||
} else: CONFIG(release, debug|release) {
|
||||
separate_debug_info {
|
||||
# Evaluate single-$ variable references that have no valid value at mkspec loading time
|
||||
QMAKE_LFLAGS_LTCG_SEPARATE_DEBUG_INFO ~= s/\\$\\{/\$\$\{/
|
||||
eval(QMAKE_LFLAGS_LTCG += $$QMAKE_LFLAGS_LTCG_SEPARATE_DEBUG_INFO)
|
||||
}
|
||||
|
||||
# We need fat object files when creating static libraries on some platforms
|
||||
# so the linker will know to load a particular object from the library
|
||||
# in the first place. On others, we have special ar and nm to create the symbol
|
||||
|
Loading…
Reference in New Issue
Block a user