1 |
commit: 50a543bdfe736ec8faa708c93471e1e31ef1e8eb |
2 |
Author: Jory A. Pratt <anarchy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 30 03:01:01 2017 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 30 03:01:01 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50a543bd |
7 |
|
8 |
www-client/firefox: Fix pie detection on hardened toolchain, bug #607350 |
9 |
|
10 |
.../firefox/files/fix_hardened_pie_detection.patch | 36 ++++++++++++++++++++++ |
11 |
www-client/firefox/firefox-51.0.ebuild | 3 +- |
12 |
2 files changed, 38 insertions(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/www-client/firefox/files/fix_hardened_pie_detection.patch b/www-client/firefox/files/fix_hardened_pie_detection.patch |
15 |
new file mode 100644 |
16 |
index 00000000..7cc74cd |
17 |
--- /dev/null |
18 |
+++ b/www-client/firefox/files/fix_hardened_pie_detection.patch |
19 |
@@ -0,0 +1,36 @@ |
20 |
+From: Jory A. Pratt <anarchy@g.o> |
21 |
+ |
22 |
+CFLAGS must contain -fPIC when checking the linker |
23 |
+ |
24 |
+https://bugs.gentoo.org/show_bug.cgi?id=607350 |
25 |
+ |
26 |
+diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 |
27 |
+--- a/build/autoconf/compiler-opts.m4 |
28 |
++++ b/build/autoconf/compiler-opts.m4 |
29 |
+@@ -263,23 +263,26 @@ fi |
30 |
+ |
31 |
+ MOZ_ARG_ENABLE_BOOL(pie, |
32 |
+ [ --enable-pie Enable Position Independent Executables], |
33 |
+ MOZ_PIE=1, |
34 |
+ MOZ_PIE= ) |
35 |
+ |
36 |
+ if test "$GNU_CC" -a -n "$MOZ_PIE"; then |
37 |
+ AC_MSG_CHECKING([for PIE support]) |
38 |
++ _SAVE_CFLAGS=$CFLAGS |
39 |
++ CFLAGS="$CFLAGS -fPIC" |
40 |
+ _SAVE_LDFLAGS=$LDFLAGS |
41 |
+ LDFLAGS="$LDFLAGS -pie" |
42 |
+ AC_TRY_LINK(,,AC_MSG_RESULT([yes]) |
43 |
+ [MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -pie"], |
44 |
+ AC_MSG_RESULT([no]) |
45 |
+ AC_MSG_ERROR([--enable-pie requires PIE support from the linker.])) |
46 |
+ LDFLAGS=$_SAVE_LDFLAGS |
47 |
++ CFLAGS=$_SAVE_CFLAGS |
48 |
+ fi |
49 |
+ |
50 |
+ AC_SUBST(MOZ_PROGRAM_LDFLAGS) |
51 |
+ |
52 |
+ dnl ASan assumes no symbols are being interposed, and when that happens, |
53 |
+ dnl it's not happy with it. Unconveniently, since Firefox is exporting |
54 |
+ dnl libffi symbols and Gtk+3 pulls system libffi via libwayland-client, |
55 |
+ dnl system libffi interposes libffi symbols that ASan assumes are in |
56 |
|
57 |
diff --git a/www-client/firefox/firefox-51.0.ebuild b/www-client/firefox/firefox-51.0.ebuild |
58 |
index f1f2b1c..579ef6e 100644 |
59 |
--- a/www-client/firefox/firefox-51.0.ebuild |
60 |
+++ b/www-client/firefox/firefox-51.0.ebuild |
61 |
@@ -127,7 +127,8 @@ src_unpack() { |
62 |
|
63 |
src_prepare() { |
64 |
# Apply our patches |
65 |
- eapply "${WORKDIR}/firefox" |
66 |
+ eapply "${WORKDIR}/firefox" \ |
67 |
+ "${FILESDIR}"/fix_hardened_pie_detection.patch |
68 |
|
69 |
# Enable gnomebreakpad |
70 |
if use debug ; then |