Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#28532: qt: enable -ltcg for windows under LTO
Browse files Browse the repository at this point in the history
f0cebbd qt: enable -ltcg for windows HOST (fanquake)

Pull request description:

  Patch around multiple definition issues in Qt, and enable `-ltcg` when using `LTO=1`.

  Split from #25391.

ACKs for top commit:
  hebasto:
    ACK f0cebbd

Tree-SHA512: 2d6e34779f360bf6dfea4f70fc9004a16e95da79716fcb3046afbf2b01317b7e16965cb51b967b7b5fb64549306c5f48cf59082884289c52016bc1e86949e062
  • Loading branch information
fanquake committed Oct 6, 2023
2 parents 54bdb6e + f0cebbd commit 634b68f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $(package)_patches += fast_fixed_dtoa_no_optimize.patch
$(package)_patches += guix_cross_lib_path.patch
$(package)_patches += fix-macos-linker.patch
$(package)_patches += memory_resource.patch
$(package)_patches += windows_lto.patch

$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=38b942bc7e62794dd072945c8a92bb9dfffed24070aea300327a3bb42f855609
Expand Down Expand Up @@ -183,6 +184,9 @@ $(package)_config_opts_mingw32 += "QMAKE_LFLAGS = '$($(package)_ldflags)'"
$(package)_config_opts_mingw32 += "QMAKE_LIB = '$($(package)_ar) rc'"
$(package)_config_opts_mingw32 += -device-option CROSS_COMPILE="$(host)-"
$(package)_config_opts_mingw32 += -pch
ifneq ($(LTO),)
$(package)_config_opts_mingw32 += -ltcg
endif

$(package)_config_opts_android = -xplatform android-clang
$(package)_config_opts_android += -android-sdk $(ANDROID_SDK)
Expand Down Expand Up @@ -250,6 +254,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \
patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \
patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Expand Down
31 changes: 31 additions & 0 deletions depends/patches/qt/windows_lto.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Qt (for Windows) fails to build under LTO, due to multiple definition issues, i.e

multiple definition of `QAccessibleLineEdit::~QAccessibleLineEdit()';

Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94156.

diff --git a/qtbase/src/widgets/accessible/simplewidgets.cpp b/qtbase/src/widgets/accessible/simplewidgets.cpp
index 107fd729fe..0e61878f39 100644
--- a/qtbase/src/widgets/accessible/simplewidgets.cpp
+++ b/qtbase/src/widgets/accessible/simplewidgets.cpp
@@ -109,6 +109,8 @@ QString qt_accHotKey(const QString &text);
\ingroup accessibility
*/

+QAccessibleLineEdit::~QAccessibleLineEdit(){};
+
/*!
Creates a QAccessibleButton object for \a w.
*/
diff --git a/qtbase/src/widgets/accessible/simplewidgets_p.h b/qtbase/src/widgets/accessible/simplewidgets_p.h
index 73572e3059..658da86143 100644
--- a/qtbase/src/widgets/accessible/simplewidgets_p.h
+++ b/qtbase/src/widgets/accessible/simplewidgets_p.h
@@ -155,6 +155,7 @@ class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInte
public:
explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());

+ ~QAccessibleLineEdit();
QString text(QAccessible::Text t) const override;
void setText(QAccessible::Text t, const QString &text) override;
QAccessible::State state() const override;

0 comments on commit 634b68f

Please sign in to comment.