From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1409633-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 193E6158091
	for <garchives@archives.gentoo.org>; Sat, 18 Jun 2022 14:27:31 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0F930E08FA;
	Sat, 18 Jun 2022 14:27:30 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E6C5EE08FA
	for <gentoo-commits@lists.gentoo.org>; Sat, 18 Jun 2022 14:27:29 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 04FC7341899
	for <gentoo-commits@lists.gentoo.org>; Sat, 18 Jun 2022 14:27:29 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 8A7ED4F7
	for <gentoo-commits@lists.gentoo.org>; Sat, 18 Jun 2022 14:27:27 +0000 (UTC)
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" <asturm@gentoo.org>
Message-ID: <1655562082.bce861717d5120f95d17eec6ce9d672ae791e80c.asturm@gentoo>
Subject: [gentoo-commits] proj/qt:master commit in: dev-qt/qtcore/
X-VCS-Repository: proj/qt
X-VCS-Files: dev-qt/qtcore/qtcore-5.15.5.9999.ebuild
X-VCS-Directories: dev-qt/qtcore/
X-VCS-Committer: asturm
X-VCS-Committer-Name: Andreas Sturmlechner
X-VCS-Revision: bce861717d5120f95d17eec6ce9d672ae791e80c
X-VCS-Branch: master
Date: Sat, 18 Jun 2022 14:27:27 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: c5312691-e8f7-414d-971e-27909a2df2b1
X-Archives-Hash: d7350767f3c0deb54f9ef58c2c986088

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
 }