Commit Graph

12 Commits

Author SHA1 Message Date
Liang Qi
d140f2f614 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	examples/widgets/widgets/scribble/mainwindow.cpp
		This amends cb54c16584.

Change-Id: Iaae60a893330524b2973917e23b31f9d51f8bd38
2019-11-13 07:21:33 +01:00
Joerg Bornemann
8ffb200153 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>
2019-11-08 17:00:17 +01:00
Liang Qi
25eb97d2d4 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	.qmake.conf
	src/network/ssl/qsslsocket_openssl.cpp

Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: Ibb57a0548b4977797b400637487a56245ac1c024
2019-06-27 14:38:03 +02:00
Thiago Macieira
859eb2467d 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>
2019-06-17 15:27:51 +00:00
Liang Qi
ef37ab9970 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	.qmake.conf
	src/gui/painting/qdrawhelper.cpp
	src/gui/text/qdistancefield.cpp
	src/gui/text/qdistancefield_p.h
	src/network/ssl/qsslsocket_openssl.cpp
	src/plugins/platforms/android/qandroidinputcontext.cpp
	src/widgets/styles/qstylesheetstyle.cpp

Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
2019-06-25 13:04:27 +02:00
Thiago Macieira
36c6b7ee4d Append LTCG arguments properly
If the QMAKE_CXXFLAGS already had -ffat-lto-objects, the *= wouldn't add
it it again, after our "-flto -fno-fat-lto-objects", which meant the
last one would stand.

Change-Id: Ic9cfa6256b5045caa6e6fffd15a7f6cda7aaa837
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-06-13 23:02:22 -07:00
Yuhang Zhao
36827faa18 Clang: Add Thin LTO in addition to Full LTO
Change-Id: I6502f3ff31c16faebd9b931b99b77a273971f611
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-03-20 17:21:08 +00:00
Thiago Macieira
0f569f5900 Clean up ltcg.prf with variables, including a new static mode
By using the special "ar" and "ranlib" tools, the symbol table is made
visible, so we don't need fat LTO binaries. Since we need to store the
new tool names, we may as well clean up ltcg.prf with variable names for
the fat mode too.

Change-Id: I7e53af0c74a3d069313f38500b72538af1d61128
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:41:48 +01:00
Thiago Macieira
d7795559a7 Let qmake find the number of processors online
Instead of trying to load in ltcg.prf and cache the value.

Change-Id: If485ff68fc6ff9d9cf7009cd72d5e702d0199c7f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-01-11 03:41:35 +01:00
Thiago Macieira
fe6f4b9ad7 Fix linking of sources without LTCG to a static lib with LTCG
Whenever a binary is created and linked against a static lib that was
compiled with LTCG, the final linking step requires the compiler flags
so that the pre-compiled data in the shared library can get properly
compiled.

This could happen for a static build of Qt with LTCG, but also happens
frequently for Qt's own build when linking regular libraries and
applications against QtBootstrap or QtPlatformSupport. The linking fails
when the target is a shared library (example: QtWaylandClient linking
against QtPlatformSupport).

The .prl file actually contains the "ltcg" flag, so the best solution
would actually be to process that flag there and add link_ltcg if any
dependent .prl has "ltcg", but I couldn't find out how to do that.

Change-Id: I4a75a14d1dcb8c2089a427285e25d5555df7d7d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2014-12-01 21:33:31 +01:00
Thiago Macieira
2b258dc80b Make sure plugins under LTCG get the right flags too.
Change-Id: I51384b4c3ceca25b6e010ccf67fa0f1995cfa557
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2014-12-01 21:33:21 +01:00
Thiago Macieira
1bd27f24fb Add link-time optimization support for Clang, GCC and ICC
GCC currently requires fat object files for static libraries, since the
linker would otherwise not load the .o file from the archive at all and
the linking would fail with a lot of undefined references. Clang on
Linux also needs this, but it has no equivalent flag, so enabling LTCG
for Clang on static libraries will result in linker error.

This commit does not add support for enabling it in configure. It can be
enabled on a per-project basis by doing CONFIG += ltcg or by passing
-config ltcg to qmake's command-line.

Change-Id: I52cf99f1ed9f1701e23a3b457ba3502fd28126ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-23 11:12:02 +02:00