1 |
commit: d245318d8912a6fef051fe1bdfbee626af72a742 |
2 |
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Dec 26 00:01:52 2016 +0000 |
4 |
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Dec 26 00:03:31 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=d245318d |
7 |
|
8 |
eclass: Synchronize toolchain.eclass with upstream. |
9 |
|
10 |
musl supports __cxa_atexit, and --enable-__cxa_atexit is passed by default, but |
11 |
it appears that upstream has a convention of including this in the |
12 |
toolchain.eclass |
13 |
|
14 |
eclass/toolchain.eclass | 143 +++++++++++++++++++++++++++++++----------------- |
15 |
1 file changed, 94 insertions(+), 49 deletions(-) |
16 |
|
17 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
18 |
index 1192f62..a6034d3 100644 |
19 |
--- a/eclass/toolchain.eclass |
20 |
+++ b/eclass/toolchain.eclass |
21 |
@@ -1,4 +1,4 @@ |
22 |
-# Copyright 1999-2015 Gentoo Foundation |
23 |
+# Copyright 1999-2016 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
# $Id$ |
26 |
|
27 |
@@ -131,7 +131,7 @@ else |
28 |
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+" |
29 |
fi |
30 |
|
31 |
-IUSE="multislot regression-test vanilla" |
32 |
+IUSE="regression-test vanilla" |
33 |
IUSE_DEF=( nls nptl ) |
34 |
|
35 |
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
36 |
@@ -152,9 +152,9 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
37 |
# versions which we dropped. Since graphite was also experimental in |
38 |
# the older versions, we don't want to bother supporting it. #448024 |
39 |
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize ) |
40 |
- tc_version_is_at_least 4.9 && IUSE+=" cilk" |
41 |
- tc_version_is_at_least 5.0 && IUSE+=" jit pch" |
42 |
- tc_version_is_at_least 6.0 && IUSE+=" pie +ssp" |
43 |
+ tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv" |
44 |
+ tc_version_is_at_least 5.0 && IUSE+=" jit mpx" |
45 |
+ tc_version_is_at_least 6.0 && IUSE+=" pie ssp +pch" |
46 |
fi |
47 |
|
48 |
IUSE+=" ${IUSE_DEF[*]/#/+}" |
49 |
@@ -627,20 +627,47 @@ do_gcc_PIE_patches() { |
50 |
# configure to build with the hardened GCC specs as the default |
51 |
make_gcc_hard() { |
52 |
|
53 |
- # Gcc >= 6.X we don't need to sed in Makefile |
54 |
- # It have configurations options to turn pie/ssp on as default |
55 |
+ local gcc_hard_flags="" |
56 |
+ # Gcc >= 6.X we can use configuration options to turn pie/ssp on as default |
57 |
if tc_version_is_at_least 6.0 ; then |
58 |
- if use hardened ; then |
59 |
- # rebrand to make bug reports easier |
60 |
- BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
61 |
- fi |
62 |
if use pie ; then |
63 |
einfo "Updating gcc to use automatic PIE building ..." |
64 |
fi |
65 |
if use ssp ; then |
66 |
einfo "Updating gcc to use automatic SSP building ..." |
67 |
fi |
68 |
- return 1 |
69 |
+ if use hardened ; then |
70 |
+ # Will add some optimizations by default. |
71 |
+ gcc_hard_flags+=" -DEXTRA_OPTIONS" |
72 |
+ # rebrand to make bug reports easier |
73 |
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
74 |
+ fi |
75 |
+ else |
76 |
+ if use hardened ; then |
77 |
+ # rebrand to make bug reports easier |
78 |
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
79 |
+ if hardened_gcc_works ; then |
80 |
+ einfo "Updating gcc to use automatic PIE + SSP building ..." |
81 |
+ gcc_hard_flags+=" -DEFAULT_PIE_SSP" |
82 |
+ elif hardened_gcc_works pie ; then |
83 |
+ einfo "Updating gcc to use automatic PIE building ..." |
84 |
+ ewarn "SSP has not been enabled by default" |
85 |
+ gcc_hard_flags+=" -DEFAULT_PIE" |
86 |
+ elif hardened_gcc_works ssp ; then |
87 |
+ einfo "Updating gcc to use automatic SSP building ..." |
88 |
+ ewarn "PIE has not been enabled by default" |
89 |
+ gcc_hard_flags+=" -DEFAULT_SSP" |
90 |
+ else |
91 |
+ # do nothing if hardened isn't supported, but don't die either |
92 |
+ ewarn "hardened is not supported for this arch in this gcc version" |
93 |
+ return 0 |
94 |
+ fi |
95 |
+ else |
96 |
+ if hardened_gcc_works ssp ; then |
97 |
+ einfo "Updating gcc to use automatic SSP building ..." |
98 |
+ gcc_hard_flags+=" -DEFAULT_SSP" |
99 |
+ fi |
100 |
+ fi |
101 |
fi |
102 |
|
103 |
# we want to be able to control the pie patch logic via something other |
104 |
@@ -651,36 +678,8 @@ make_gcc_hard() { |
105 |
# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7 |
106 |
if tc_version_is_at_least 4.7 ; then |
107 |
sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \ |
108 |
- -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \ |
109 |
- -i "${S}"/gcc/Makefile.in |
110 |
- fi |
111 |
- |
112 |
- # defaults to enable for all toolchains |
113 |
- local gcc_hard_flags="" |
114 |
- if use hardened ; then |
115 |
- if hardened_gcc_works ; then |
116 |
- einfo "Updating gcc to use automatic PIE + SSP building ..." |
117 |
- gcc_hard_flags+=" -DEFAULT_PIE_SSP" |
118 |
- elif hardened_gcc_works pie ; then |
119 |
- einfo "Updating gcc to use automatic PIE building ..." |
120 |
- ewarn "SSP has not been enabled by default" |
121 |
- gcc_hard_flags+=" -DEFAULT_PIE" |
122 |
- elif hardened_gcc_works ssp ; then |
123 |
- einfo "Updating gcc to use automatic SSP building ..." |
124 |
- ewarn "PIE has not been enabled by default" |
125 |
- gcc_hard_flags+=" -DEFAULT_SSP" |
126 |
- else |
127 |
- # do nothing if hardened isn't supported, but don't die either |
128 |
- ewarn "hardened is not supported for this arch in this gcc version" |
129 |
- return 0 |
130 |
- fi |
131 |
- # rebrand to make bug reports easier |
132 |
- BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
133 |
- else |
134 |
- if hardened_gcc_works ssp ; then |
135 |
- einfo "Updating gcc to use automatic SSP building ..." |
136 |
- gcc_hard_flags+=" -DEFAULT_SSP" |
137 |
- fi |
138 |
+ -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \ |
139 |
+ -i "${S}"/gcc/Makefile.in |
140 |
fi |
141 |
|
142 |
sed -i \ |
143 |
@@ -917,7 +916,7 @@ toolchain_src_configure() { |
144 |
fi |
145 |
|
146 |
# Support to disable pch when building libstdcxx |
147 |
- if tc_version_is_at_least 5.0 && ! use pch ; then |
148 |
+ if tc_version_is_at_least 6.0 && ! use pch ; then |
149 |
confgcc+=( --disable-libstdcxx-pch ) |
150 |
fi |
151 |
|
152 |
@@ -1022,6 +1021,9 @@ toolchain_src_configure() { |
153 |
*-elf|*-eabi) |
154 |
confgcc+=( --with-newlib ) |
155 |
;; |
156 |
+ *-musl*) |
157 |
+ confgcc+=( --enable-__cxa_atexit ) |
158 |
+ ;; |
159 |
*-gnu*) |
160 |
confgcc+=( |
161 |
--enable-__cxa_atexit |
162 |
@@ -1187,6 +1189,17 @@ toolchain_src_configure() { |
163 |
confgcc+=( $(use_enable cilk libcilkrts) ) |
164 |
fi |
165 |
|
166 |
+ if in_iuse mpx ; then |
167 |
+ confgcc+=( $(use_enable mpx libmpx) ) |
168 |
+ fi |
169 |
+ |
170 |
+ if in_iuse vtv ; then |
171 |
+ confgcc+=( |
172 |
+ $(use_enable vtv vtable-verify) |
173 |
+ $(use_enable vtv libvtv) |
174 |
+ ) |
175 |
+ fi |
176 |
+ |
177 |
# newer gcc's come with libquadmath, but only fortran uses |
178 |
# it, so auto punt it when we don't care |
179 |
if tc_version_is_at_least 4.6 && ! is_fortran ; then |
180 |
@@ -1756,13 +1769,49 @@ toolchain_src_install() { |
181 |
if ! is_crosscompile ; then |
182 |
insinto "${DATAPATH}" |
183 |
newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die |
184 |
- find "${D}/${LIBPATH}" -name libstdc++.la -type f -delete |
185 |
- find "${D}/${LIBPATH}" -name 'lib*san.la' -type f -delete #487550 #546700 |
186 |
exeinto "${DATAPATH}" |
187 |
doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die |
188 |
doexe "${GCC_FILESDIR}"/c{89,99} || die |
189 |
fi |
190 |
|
191 |
+ # libstdc++.la: Delete as it doesn't add anything useful: g++ itself |
192 |
+ # handles linkage correctly in the dynamic & static case. It also just |
193 |
+ # causes us pain: any C++ progs/libs linking with libtool will gain a |
194 |
+ # reference to the full libstdc++.la file which is gcc version specific. |
195 |
+ # libstdc++fs.la: It doesn't link against anything useful. |
196 |
+ # libsupc++.la: This has no dependencies. |
197 |
+ # libcc1.la: There is no static library, only dynamic. |
198 |
+ # libcc1plugin.la: Same as above, and it's loaded via dlopen. |
199 |
+ # libgomp.la: gcc itself handles linkage (libgomp.spec). |
200 |
+ # libgomp-plugin-*.la: Same as above, and it's an internal plugin only |
201 |
+ # loaded via dlopen. |
202 |
+ # libgfortran.la: gfortran itself handles linkage correctly in the |
203 |
+ # dynamic & static case (libgfortran.spec). #573302 |
204 |
+ # libgfortranbegin.la: Same as above, and it's an internal lib. |
205 |
+ # libmpx.la: gcc itself handles linkage correctly (libmpx.spec). |
206 |
+ # libmpxwrappers.la: See above. |
207 |
+ # libitm.la: gcc itself handles linkage correctly (libitm.spec). |
208 |
+ # libvtv.la: gcc itself handles linkage correctly. |
209 |
+ # lib*san.la: Sanitizer linkage is handled internally by gcc, and they |
210 |
+ # do not support static linking. #487550 #546700 |
211 |
+ find "${D}/${LIBPATH}" \ |
212 |
+ '(' \ |
213 |
+ -name libstdc++.la -o \ |
214 |
+ -name libstdc++fs.la -o \ |
215 |
+ -name libsupc++.la -o \ |
216 |
+ -name libcc1.la -o \ |
217 |
+ -name libcc1plugin.la -o \ |
218 |
+ -name 'libgomp.la' -o \ |
219 |
+ -name 'libgomp-plugin-*.la' -o \ |
220 |
+ -name libgfortran.la -o \ |
221 |
+ -name libgfortranbegin.la -o \ |
222 |
+ -name libmpx.la -o \ |
223 |
+ -name libmpxwrappers.la -o \ |
224 |
+ -name libitm.la -o \ |
225 |
+ -name libvtv.la -o \ |
226 |
+ -name 'lib*san.la' \ |
227 |
+ ')' -type f -delete |
228 |
+ |
229 |
# Use gid of 0 because some stupid ports don't have |
230 |
# the group 'root' set to gid 0. Send to /dev/null |
231 |
# for people who are testing as non-root. |
232 |
@@ -2122,10 +2171,6 @@ should_we_gcc_config() { |
233 |
|
234 |
local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) |
235 |
|
236 |
- # If we're using multislot, just run gcc-config if we're installing |
237 |
- # to the same profile as the current one. |
238 |
- use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]]) |
239 |
- |
240 |
if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then |
241 |
return 0 |
242 |
else |