Gentoo Archives: gentoo-dev

From: Matthias Maier <tamiko@g.o>
To: gentoo-dev@l.g.o
Cc: toolchain@g.o, embedded@g.o
Subject: [gentoo-dev] [PATCH 5/5] eclass/toolchain-glibc.eclass: skip pie check for gcc-6 or newer
Date: Wed, 14 Jun 2017 23:17:24
Message-Id: 20170614231541.29719-6-tamiko@gentoo.org
In Reply to: [gentoo-dev] [RFC] toolchain-funcs.eclass / toolchain-glibc.eclass - gcc-6 bugfixes and updates by Matthias Maier
1 For gcc-6 and newer the old logic in the toolchain-glibc eclass:
2
3 if use hardened && gcc-specs-pie ; then
4 append-cppflags -DPIC
5 else
6 filter-flags -fPIE
7 fi
8
9 is obsolete. Simply disable the check.
10 ---
11 eclass/toolchain-glibc.eclass | 24 +++++++++++++++---------
12 1 file changed, 15 insertions(+), 9 deletions(-)
13
14 diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
15 index 270c9cdac7..32c1307c3a 100644
16 --- a/eclass/toolchain-glibc.eclass
17 +++ b/eclass/toolchain-glibc.eclass
18 @@ -266,15 +266,21 @@ setup_flags() {
19 tc-enables-ssp && append-flags $(test-flags -fno-stack-protector)
20 fi
21
22 - if use hardened && tc-enables-pie ; then
23 - # Force PIC macro definition for all compilations since they're all
24 - # either -fPIC or -fPIE with the default-PIE compiler.
25 - append-cppflags -DPIC
26 - else
27 - # Don't build -fPIE without the default-PIE compiler and the
28 - # hardened-pie patch
29 - filter-flags -fPIE
30 - fi
31 + if [[ $(gcc-major-version) -lt 6 ]]; then
32 + # Starting with gcc-6 (and fully upstreamed pie patches) we control
33 + # default enabled/disabled pie via use flags. So nothing to do
34 + # here. #618160
35 +
36 + if use hardened && tc-enables-pie ; then
37 + # Force PIC macro definition for all compilations since they're all
38 + # either -fPIC or -fPIE with the default-PIE compiler.
39 + append-cppflags -DPIC
40 + else
41 + # Don't build -fPIE without the default-PIE compiler and the
42 + # hardened-pie patch
43 + filter-flags -fPIE
44 + fi
45 + fi
46 }
47
48 want_nptl() {
49 --
50 2.13.0