summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-09-07 13:20:42 -0700
committerThiago Macieira <thiago.macieira@intel.com>2019-06-17 15:27:51 +0000
commit859eb2467dbc15728ea2ee15931073a4147f8d59 (patch)
tree51690373d376af68e646b38b39522ff1ba7a977e /mkspecs
parentcbdc9a7786278c31fdb6eb465f32d0374349c1ef (diff)
Add qmake config for controlling LTCG behavior for static libs
Static libraries may get installed and used by other builds, which may be done with a different version or build of the compiler. So this commit introduces two new flags: - no-static-ltcg: disables LTCG completely for static libraries - fat-static-lto: forces static libraries to produce fat LTO objects fat-static-lto is useful for Linux distributions, since installed static libraries should not carry LTO information, but that information is useful during Qt's own build. This feature should be used alongside some compiler-specific method of removing the LTO information from the static libraries prior to installation, so only the regular part remains. For current GCC versions, this command suffices: strip -R '.gnu.lto*' -R '.gnu.debuglto*' libname.a Otherwise, distributions can use "no-static-ltcg" to disable it completely. Change-Id: I495bc19409f348069f5bfffd155237ade9f4b42f Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/ltcg.prf6
1 files changed, 4 insertions, 2 deletions
diff --git a/mkspecs/features/ltcg.prf b/mkspecs/features/ltcg.prf
index f2dbc6fa9e..a94f6d0eeb 100644
--- a/mkspecs/features/ltcg.prf
+++ b/mkspecs/features/ltcg.prf
@@ -1,4 +1,6 @@
-CONFIG(release, debug|release) {
+static:no-static-ltcg {
+ # Static library but no-static-ltcg enabled: skip LTCG
+} else: CONFIG(release, debug|release) {
# 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
@@ -22,7 +24,7 @@ CONFIG(release, debug|release) {
}
}
- fat-lto {
+ fat-lto|if(static:fat-static-lto) {
QMAKE_CFLAGS_LTCG += $$QMAKE_CFLAGS_LTCG_FATOBJECTS
QMAKE_CXXFLAGS_LTCG += $$QMAKE_CXXFLAGS_LTCG_FATOBJECTS
}