commit:     bce861717d5120f95d17eec6ce9d672ae791e80c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 23:10:33 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Jun 18 14:21:22 2022 +0000
URL:        https://gitweb.gentoo.org/proj/qt.git/commit/?id=bce86171

dev-qt/qtcore: add FORTIFY_SOURCE=3 workaround (force back to =2)

As discussed with asturm until we know what's happening with
the upstream bug. We can consider the opensuse patch once
that's resolved, if the upstream fix isn't made public, almost
certainly via KDE Qt5PatchCollection. But we'll see.

Bug: https://bugs.gentoo.org/847145
Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 dev-qt/qtcore/qtcore-5.15.5.9999.ebuild | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/dev-qt/qtcore/qtcore-5.15.5.9999.ebuild 
b/dev-qt/qtcore/qtcore-5.15.5.9999.ebuild
index 84966e24..1f4a57ff 100644
--- a/dev-qt/qtcore/qtcore-5.15.5.9999.ebuild
+++ b/dev-qt/qtcore/qtcore-5.15.5.9999.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 QT5_MODULE="qtbase"
-inherit linux-info qt5-build
+inherit linux-info flag-o-matic qt5-build
 
 DESCRIPTION="Cross-platform application development framework"
 SLOT=5/${QT5_PV}
@@ -58,6 +58,25 @@ src_prepare() {
        # fix missing qt_version_tag symbol w/ LTO, bug 674382
        sed -i -e 's/^gcc:ltcg/gcc/' src/corelib/global/global.pri || die
 
+       # Broken with FORTIFY_SOURCE=3
+       # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+       # to unset F_S first, then explicitly set 2, to negate any default
+       # and anything set by the user if they're choosing 3 (or if they've
+       # modified GCC to set 3).
+       #
+       # Refs:
+       # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105078
+       # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709
+       # https://bugreports.qt.io/browse/QTBUG-103782
+       # bug #847145
+       if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+               # We can't unconditionally do this b/c we fortify needs
+               # some level of optimisation.
+               filter-flags -D_FORTIFY_SOURCE=3
+               # (Qt doesn't seem to respect CPPFLAGS?)
+               append-flags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+       fi
+
        qt5-build_src_prepare
 }
 

Reply via email to