1 |
vapier 14/06/01 17:29:42 |
2 |
|
3 |
Modified: toolchain.eclass |
4 |
Log: |
5 |
downgrade_arch_flags: simplify bash logic a bit |
6 |
|
7 |
Revision Changes Path |
8 |
1.631 eclass/toolchain.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?rev=1.631&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?rev=1.631&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.630&r2=1.631 |
13 |
|
14 |
Index: toolchain.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v |
17 |
retrieving revision 1.630 |
18 |
retrieving revision 1.631 |
19 |
diff -u -r1.630 -r1.631 |
20 |
--- toolchain.eclass 21 May 2014 21:30:26 -0000 1.630 |
21 |
+++ toolchain.eclass 1 Jun 2014 17:29:42 -0000 1.631 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2014 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.630 2014/05/21 21:30:26 rhill Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.631 2014/06/01 17:29:42 vapier Exp $ |
27 |
|
28 |
# Maintainer: Toolchain Ninjas <toolchain@g.o> |
29 |
|
30 |
@@ -619,7 +619,6 @@ |
31 |
|
32 |
# configure to build with the hardened GCC specs as the default |
33 |
make_gcc_hard() { |
34 |
- |
35 |
# we want to be able to control the pie patch logic via something other |
36 |
# than ALL_CFLAGS... |
37 |
sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ |
38 |
@@ -1222,8 +1221,8 @@ |
39 |
# If -march=native isn't supported we have to tease out the actual arch |
40 |
if [[ ${myarch} == native || ${mytune} == native ]] ; then |
41 |
if [[ ${bver} < 4.2 ]] ; then |
42 |
- arch=$(echo "" | $(tc-getCC) -march=native -v -E - 2>&1 \ |
43 |
- | grep cc1 | sed -e 's:.*-march=\([^ ]*\).*:\1:') |
44 |
+ arch=$($(tc-getCC) -march=native -v -E -P - </dev/null 2>&1 \ |
45 |
+ | sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p") |
46 |
replace-cpu-flags native ${arch} |
47 |
fi |
48 |
fi |
49 |
@@ -1234,55 +1233,56 @@ |
50 |
[[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*' |
51 |
[[ ${bver} < 3.4 ]] && filter-flags '-mtune=*' |
52 |
|
53 |
- declare -a archlist |
54 |
- # "arch" "added" "replacement" |
55 |
- archlist=("bdver4 4.9 bdver3") |
56 |
- archlist+=("bonnell 4.9 atom") |
57 |
- archlist+=("broadwell 4.9 core-avx2") |
58 |
- archlist+=("haswell 4.9 core-avx2") |
59 |
- archlist+=("ivybridge 4.9 core-avx-i") |
60 |
- archlist+=("nehalem 4.9 corei7") |
61 |
- archlist+=("sandybridge 4.9 corei7-avx") |
62 |
- archlist+=("silvermont 4.9 corei7") |
63 |
- archlist+=("westmere 4.9 corei7") |
64 |
- archlist+=("bdver3 4.8 bdver2") |
65 |
- archlist+=("btver2 4.8 btver1") |
66 |
- archlist+=("bdver2 4.7 bdver1") |
67 |
- archlist+=("core-avx2 4.7 core-avx-i") |
68 |
- archlist+=("bdver1 4.6 amdfam10") |
69 |
- archlist+=("btver1 4.6 amdfam10") |
70 |
- archlist+=("core-avx-i 4.6 core2") |
71 |
- archlist+=("corei7 4.6 core2") |
72 |
- archlist+=("corei7-avx 4.6 core2") |
73 |
- archlist+=("atom 4.5 core2") |
74 |
- archlist+=("amdfam10 4.3 k8") |
75 |
- archlist+=("athlon64-sse3 4.3 k8") |
76 |
- archlist+=("barcelona 4.3 k8") |
77 |
- archlist+=("core2 4.3 nocona") |
78 |
- archlist+=("geode 4.3 k6-2") # gcc.gnu.org/PR41989#c22 |
79 |
- archlist+=("k8-sse3 4.3 k8") |
80 |
- archlist+=("opteron-sse3 4.3 k8") |
81 |
- archlist+=("athlon-fx 3.4 x86-64") |
82 |
- archlist+=("athlon64 3.4 x86-64") |
83 |
- archlist+=("c3-2 3.4 c3") |
84 |
- archlist+=("k8 3.4 x86-64") |
85 |
- archlist+=("opteron 3.4 x86-64") |
86 |
- archlist+=("pentium-m 3.4 pentium3") |
87 |
- archlist+=("pentium3m 3.4 pentium3") |
88 |
- archlist+=("pentium4m 3.4 pentium4") |
89 |
+ local archlist=( |
90 |
+ # "added" "arch" "replacement" |
91 |
+ 4.9 bdver4 bdver3 |
92 |
+ 4.9 bonnell atom |
93 |
+ 4.9 broadwell core-avx2 |
94 |
+ 4.9 haswell core-avx2 |
95 |
+ 4.9 ivybridge core-avx-i |
96 |
+ 4.9 nehalem corei7 |
97 |
+ 4.9 sandybridge corei7-avx |
98 |
+ 4.9 silvermont corei7 |
99 |
+ 4.9 westmere corei7 |
100 |
+ 4.8 bdver3 bdver2 |
101 |
+ 4.8 btver2 btver1 |
102 |
+ 4.7 bdver2 bdver1 |
103 |
+ 4.7 core-avx2 core-avx-i |
104 |
+ 4.6 bdver1 amdfam10 |
105 |
+ 4.6 btver1 amdfam10 |
106 |
+ 4.6 core-avx-i core2 |
107 |
+ 4.6 corei7 core2 |
108 |
+ 4.6 corei7-avx core2 |
109 |
+ 4.5 atom core2 |
110 |
+ 4.3 amdfam10 k8 |
111 |
+ 4.3 athlon64-sse3 k8 |
112 |
+ 4.3 barcelona k8 |
113 |
+ 4.3 core2 nocona |
114 |
+ 4.3 geode k6-2 # gcc.gnu.org/PR41989#c22 |
115 |
+ 4.3 k8-sse3 k8 |
116 |
+ 4.3 opteron-sse3 k8 |
117 |
+ 3.4 athlon-fx x86-64 |
118 |
+ 3.4 athlon64 x86-64 |
119 |
+ 3.4 c3-2 c3 |
120 |
+ 3.4 k8 x86-64 |
121 |
+ 3.4 opteron x86-64 |
122 |
+ 3.4 pentium-m pentium3 |
123 |
+ 3.4 pentium3m pentium3 |
124 |
+ 3.4 pentium4m pentium4 |
125 |
+ ) |
126 |
|
127 |
myarch=$(get-flag march) |
128 |
mytune=$(get-flag mtune) |
129 |
|
130 |
- for ((i=0; i < ${#archlist[@]}; i++)) ; do |
131 |
- arch=${archlist[i]%% *} |
132 |
- ver=${archlist[i]#* } ver=${ver% *} |
133 |
- rep=${archlist[i]##* } |
134 |
+ for ((i = 0; i < ${#archlist[@]}; i += 3)) ; do |
135 |
+ ver=${archlist[i]} |
136 |
+ arch=${archlist[i + 1]} |
137 |
+ rep=${archlist[i + 2]} |
138 |
|
139 |
[[ ${myarch} != ${arch} && ${mytune} != ${arch} ]] && continue |
140 |
- |
141 |
+ |
142 |
if [[ ${ver} > ${bver} ]] ; then |
143 |
- einfo "Replacing ${myarch} (added in ${ver}) with ${rep}..." |
144 |
+ einfo "Replacing ${myarch} (added in gcc ${ver}) with ${rep}..." |
145 |
[[ ${myarch} == ${arch} ]] && replace-cpu-flags ${myarch} ${rep} |
146 |
[[ ${mytune} == ${arch} ]] && replace-cpu-flags ${mytune} ${rep} |
147 |
downgrade_arch_flags ${1:-${GCC_BRANCH_VER}} |
148 |
@@ -1292,45 +1292,46 @@ |
149 |
fi |
150 |
done |
151 |
|
152 |
- declare -a isalist |
153 |
- # we only check -mno* here since -m* get removed by strip-flags later on |
154 |
- isalist=("-mno-sha 4.9") |
155 |
- isalist+=("-mno-avx512pf 4.9") |
156 |
- isalist+=("-mno-avx512f 4.9") |
157 |
- isalist+=("-mno-avx512er 4.9") |
158 |
- isalist+=("-mno-avx512cd 4.9") |
159 |
- isalist+=("-mno-xsaveopt 4.8") |
160 |
- isalist+=("-mno-xsave 4.8") |
161 |
- isalist+=("-mno-rtm 4.8") |
162 |
- isalist+=("-mno-fxsr 4.8") |
163 |
- isalist+=("-mno-lzcnt 4.7") |
164 |
- isalist+=("-mno-bmi2 4.7") |
165 |
- isalist+=("-mno-avx2 4.7") |
166 |
- isalist+=("-mno-tbm 4.6") |
167 |
- isalist+=("-mno-rdrnd 4.6") |
168 |
- isalist+=("-mno-fsgsbase 4.6") |
169 |
- isalist+=("-mno-f16c 4.6") |
170 |
- isalist+=("-mno-bmi 4.6") |
171 |
- isalist+=("-mno-xop 4.5") |
172 |
- isalist+=("-mno-movbe 4.5") |
173 |
- isalist+=("-mno-lwp 4.5") |
174 |
- isalist+=("-mno-fma4 4.5") |
175 |
- isalist+=("-mno-pclmul 4.4") |
176 |
- isalist+=("-mno-fma 4.4") |
177 |
- isalist+=("-mno-avx 4.4") |
178 |
- isalist+=("-mno-aes 4.4") |
179 |
- isalist+=("-mno-ssse3 4.3") |
180 |
- isalist+=("-mno-sse4a 4.3") |
181 |
- isalist+=("-mno-sse4 4.3") |
182 |
- isalist+=("-mno-sse4.2 4.3") |
183 |
- isalist+=("-mno-sse4.1 4.3") |
184 |
- isalist+=("-mno-popcnt 4.3") |
185 |
- isalist+=("-mno-abm 4.3") |
186 |
- |
187 |
- for ((i=0; i < ${#isalist[@]}; i++)) ; do |
188 |
- isa=${isalist[i]%% *} |
189 |
- ver=${isalist[i]##* } |
190 |
- [[ ${ver} > ${bver} ]] && filter-flags ${isa} |
191 |
+ local isalist=( |
192 |
+ # we only check -mno* here since -m* get removed by strip-flags later on |
193 |
+ 4.9 -mno-sha |
194 |
+ 4.9 -mno-avx512pf |
195 |
+ 4.9 -mno-avx512f |
196 |
+ 4.9 -mno-avx512er |
197 |
+ 4.9 -mno-avx512cd |
198 |
+ 4.8 -mno-xsaveopt |
199 |
+ 4.8 -mno-xsave |
200 |
+ 4.8 -mno-rtm |
201 |
+ 4.8 -mno-fxsr |
202 |
+ 4.7 -mno-lzcnt |
203 |
+ 4.7 -mno-bmi2 |
204 |
+ 4.7 -mno-avx2 |
205 |
+ 4.6 -mno-tbm |
206 |
+ 4.6 -mno-rdrnd |
207 |
+ 4.6 -mno-fsgsbase |
208 |
+ 4.6 -mno-f16c |
209 |
+ 4.6 -mno-bmi |
210 |
+ 4.5 -mno-xop |
211 |
+ 4.5 -mno-movbe |
212 |
+ 4.5 -mno-lwp |
213 |
+ 4.5 -mno-fma4 |
214 |
+ 4.4 -mno-pclmul |
215 |
+ 4.4 -mno-fma |
216 |
+ 4.4 -mno-avx |
217 |
+ 4.4 -mno-aes |
218 |
+ 4.3 -mno-ssse3 |
219 |
+ 4.3 -mno-sse4a |
220 |
+ 4.3 -mno-sse4 |
221 |
+ 4.3 -mno-sse4.2 |
222 |
+ 4.3 -mno-sse4.1 |
223 |
+ 4.3 -mno-popcnt |
224 |
+ 4.3 -mno-abm |
225 |
+ ) |
226 |
+ |
227 |
+ for ((i = 0; i < ${#isalist[@]}; i += 2)) ; do |
228 |
+ ver=${isalist[i]} |
229 |
+ isa=${isalist[i + 1]} |
230 |
+ [[ ${ver} > ${bver} ]] && filter-flags ${isa} ${isa/-m/-mno-} |
231 |
done |
232 |
} |
233 |
|
234 |
@@ -1361,9 +1362,9 @@ |
235 |
case $(tc-arch) in |
236 |
amd64|x86) |
237 |
filter-flags '-mcpu=*' |
238 |
- |
239 |
+ |
240 |
tc_version_is_between 4.4 4.5 && append-flags -mno-avx # 357287 |
241 |
- |
242 |
+ |
243 |
if tc_version_is_between 4.6 4.7 ; then |
244 |
# https://bugs.gentoo.org/411333 |
245 |
# https://bugs.gentoo.org/466454 |
246 |
@@ -1485,7 +1486,7 @@ |
247 |
# gcc_do_make all-target-libstdc++-v3 |
248 |
|
249 |
[[ -n ${1} ]] && GCC_MAKE_TARGET=${1} |
250 |
- |
251 |
+ |
252 |
# default target |
253 |
if is_crosscompile || tc-is-cross-compiler ; then |
254 |
# 3 stage bootstrapping doesnt quite work when you cant run the |