From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-928169-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5DEDF139085
	for <garchives@archives.gentoo.org>; Mon, 30 Jan 2017 03:02:18 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 736A92241A1;
	Mon, 30 Jan 2017 03:02:17 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5344A2241A1
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Jan 2017 03:02:17 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1EEC034165F
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Jan 2017 03:02:16 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7792C3A77
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Jan 2017 03:02:14 +0000 (UTC)
From: "Jory Pratt" <anarchy@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, "Jory Pratt" <anarchy@gentoo.org>
Message-ID: <1485745261.50a543bdfe736ec8faa708c93471e1e31ef1e8eb.anarchy@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/firefox/files/, www-client/firefox/
X-VCS-Repository: repo/gentoo
X-VCS-Files: www-client/firefox/files/fix_hardened_pie_detection.patch www-client/firefox/firefox-51.0.ebuild
X-VCS-Directories: www-client/firefox/ www-client/firefox/files/
X-VCS-Committer: anarchy
X-VCS-Committer-Name: Jory Pratt
X-VCS-Revision: 50a543bdfe736ec8faa708c93471e1e31ef1e8eb
X-VCS-Branch: master
Date: Mon, 30 Jan 2017 03:02:14 +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-Archives-Salt: 163f0e63-9fee-48cf-87e9-9b1f10e0557b
X-Archives-Hash: c296e4068e679e2e0455c821594e98f0

commit:     50a543bdfe736ec8faa708c93471e1e31ef1e8eb
Author:     Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 30 03:01:01 2017 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Mon Jan 30 03:01:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50a543bd

www-client/firefox: Fix pie detection on hardened toolchain, bug #607350

 .../firefox/files/fix_hardened_pie_detection.patch | 36 ++++++++++++++++++++++
 www-client/firefox/firefox-51.0.ebuild             |  3 +-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/www-client/firefox/files/fix_hardened_pie_detection.patch b/www-client/firefox/files/fix_hardened_pie_detection.patch
new file mode 100644
index 00000000..7cc74cd
--- /dev/null
+++ b/www-client/firefox/files/fix_hardened_pie_detection.patch
@@ -0,0 +1,36 @@
+From: Jory A. Pratt <anarchy@gentoo.org>
+
+CFLAGS must contain -fPIC when checking the linker
+
+https://bugs.gentoo.org/show_bug.cgi?id=607350
+
+diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
+--- a/build/autoconf/compiler-opts.m4
++++ b/build/autoconf/compiler-opts.m4
+@@ -263,23 +263,26 @@ fi
+ 
+ MOZ_ARG_ENABLE_BOOL(pie,
+ [  --enable-pie           Enable Position Independent Executables],
+     MOZ_PIE=1,
+     MOZ_PIE= )
+ 
+ if test "$GNU_CC" -a -n "$MOZ_PIE"; then
+     AC_MSG_CHECKING([for PIE support])
++    _SAVE_CFLAGS=$CFLAGS
++    CFLAGS="$CFLAGS -fPIC"
+     _SAVE_LDFLAGS=$LDFLAGS
+     LDFLAGS="$LDFLAGS -pie"
+     AC_TRY_LINK(,,AC_MSG_RESULT([yes])
+                   [MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -pie"],
+                   AC_MSG_RESULT([no])
+                   AC_MSG_ERROR([--enable-pie requires PIE support from the linker.]))
+     LDFLAGS=$_SAVE_LDFLAGS
++    CFLAGS=$_SAVE_CFLAGS
+ fi
+ 
+ AC_SUBST(MOZ_PROGRAM_LDFLAGS)
+ 
+ dnl ASan assumes no symbols are being interposed, and when that happens,
+ dnl it's not happy with it. Unconveniently, since Firefox is exporting
+ dnl libffi symbols and Gtk+3 pulls system libffi via libwayland-client,
+ dnl system libffi interposes libffi symbols that ASan assumes are in

diff --git a/www-client/firefox/firefox-51.0.ebuild b/www-client/firefox/firefox-51.0.ebuild
index f1f2b1c..579ef6e 100644
--- a/www-client/firefox/firefox-51.0.ebuild
+++ b/www-client/firefox/firefox-51.0.ebuild
@@ -127,7 +127,8 @@ src_unpack() {
 
 src_prepare() {
 	# Apply our patches
-	eapply "${WORKDIR}/firefox"
+	eapply "${WORKDIR}/firefox" \
+		"${FILESDIR}"/fix_hardened_pie_detection.patch
 
 	# Enable gnomebreakpad
 	if use debug ; then