Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 17 Jul 2021 10:25:33
Message-Id: 1626517525.eb49d171430cc2baffbf9d37493a78cc02b33fe2.slyfox@gentoo
1 commit: eb49d171430cc2baffbf9d37493a78cc02b33fe2
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 17 09:49:42 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 17 10:25:25 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb49d171
7
8 toolchain.eclass: drop pre-gcc-4.2 support code
9
10 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
11
12 eclass/toolchain.eclass | 271 +++++++++++++++++++-----------------------------
13 1 file changed, 104 insertions(+), 167 deletions(-)
14
15 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
16 index a94c2d3e837..54b70a08028 100644
17 --- a/eclass/toolchain.eclass
18 +++ b/eclass/toolchain.eclass
19 @@ -146,15 +146,13 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
20 IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl)
21 [[ -n ${PIE_VER} ]] && IUSE+=" nopie"
22 [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
23 - # fortran support appeared in 4.1, but 4.1 needs outdated mpfr
24 - tc_version_is_at_least 4.2 && IUSE+=" +fortran" TC_FEATURES+=(fortran)
25 - tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
26 + IUSE+=" +fortran" TC_FEATURES+=(fortran)
27 + IUSE+=" doc hardened multilib objc"
28 tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
29 - tc_version_is_at_least 3.3 && IUSE+=" pgo"
30 - tc_version_is_at_least 4.0 &&
31 - IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
32 - tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
33 - tc_version_is_at_least 4.2 && IUSE+=" +openmp"
34 + IUSE+=" pgo"
35 + IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
36 + IUSE+=" libssp objc++"
37 + IUSE+=" +openmp"
38 tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
39 tc_version_is_at_least 4.7 && IUSE+=" go"
40 # sanitizer support appeared in gcc-4.8, but <gcc-5 does not
41 @@ -203,17 +201,15 @@ fi
42 #---->> DEPEND <<----
43
44 RDEPEND="sys-libs/zlib
45 - nls? ( virtual/libintl )"
46 -
47 -tc_version_is_at_least 3 && RDEPEND+=" virtual/libiconv"
48 -
49 -if tc_version_is_at_least 4 ; then
50 - GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
51 - if tc_version_is_at_least 4.3 ; then
52 - RDEPEND+=" ${GMP_MPFR_DEPS}"
53 - elif tc_has_feature fortran ; then
54 - RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
55 - fi
56 + virtual/libiconv
57 + nls? ( virtual/libintl )
58 +"
59 +
60 +GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
61 +if tc_version_is_at_least 4.3 ; then
62 + RDEPEND+=" ${GMP_MPFR_DEPS}"
63 +elif tc_has_feature fortran ; then
64 + RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
65 fi
66
67 tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
68 @@ -239,18 +235,22 @@ BDEPEND="
69 DEPEND="${RDEPEND}"
70
71 if tc_has_feature gcj ; then
72 - GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
73 - GCJ_GTK_DEPS="
74 - x11-base/xorg-proto
75 - x11-libs/libXt
76 - x11-libs/libX11
77 - x11-libs/libXtst
78 - =x11-libs/gtk+-2*
79 - virtual/pkgconfig
80 + DEPEND+="
81 + gcj? (
82 + awt? (
83 + x11-base/xorg-proto
84 + x11-libs/libXt
85 + x11-libs/libX11
86 + x11-libs/libXtst
87 + =x11-libs/gtk+-2*
88 + x11-libs/pango
89 + virtual/pkgconfig
90 + )
91 + >=media-libs/libart_lgpl-2.1
92 + app-arch/zip
93 + app-arch/unzip
94 + )
95 "
96 - tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
97 - tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
98 - DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
99 fi
100
101 if tc_has_feature systemtap ; then
102 @@ -527,9 +527,7 @@ toolchain_src_prepare() {
103 sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
104
105 # Prevent new texinfo from breaking old versions (see #198182, #464008)
106 - if tc_version_is_at_least 4.1; then
107 - tc_apply_patches "Remove texinfo (bug #198182, bug #464008)" "${FILESDIR}"/gcc-configure-texinfo.patch
108 - fi
109 + tc_apply_patches "Remove texinfo (bug #198182, bug #464008)" "${FILESDIR}"/gcc-configure-texinfo.patch
110
111 # >=gcc-4
112 if [[ -x contrib/gcc_update ]] ; then
113 @@ -782,9 +780,7 @@ toolchain_src_configure() {
114 is_jit && GCC_LANG+=",jit"
115 if is_objc || is_objcxx ; then
116 GCC_LANG+=",objc"
117 - if tc_version_is_at_least 4 ; then
118 - use objc-gc && confgcc+=( --enable-objc-gc )
119 - fi
120 + use objc-gc && confgcc+=( --enable-objc-gc )
121 is_objcxx && GCC_LANG+=",obj-c++"
122 fi
123
124 @@ -814,11 +810,11 @@ toolchain_src_configure() {
125 confgcc+=( --disable-nls )
126 fi
127
128 - tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
129 + confgcc+=( --disable-libunwind-exceptions )
130
131 # Use the default ("release") checking because upstream usually neglects
132 # to test "disabled" so it has a history of breaking. bug #317217
133 - if tc_version_is_at_least 3.4 && in_iuse debug ; then
134 + if in_iuse debug ; then
135 # The "release" keyword is new to 4.0. bug #551636
136 local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
137 confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
138 @@ -943,7 +939,7 @@ toolchain_src_configure() {
139 fi
140 fi
141
142 - tc_version_is_at_least 4.2 && confgcc+=( --disable-bootstrap )
143 + confgcc+=( --disable-bootstrap )
144 else
145 if tc-is-static-only ; then
146 confgcc+=( --disable-shared )
147 @@ -968,10 +964,6 @@ toolchain_src_configure() {
148 $(use_enable nptl tls)
149 )
150 fi
151 - tc_version_is_between 3.3 3.4 && confgcc+=( --enable-sjlj-exceptions )
152 - if tc_version_is_between 3.4 4.3 ; then
153 - confgcc+=( --enable-clocale=uclibc )
154 - fi
155 ;;
156 *-elf|*-eabi)
157 confgcc+=( --with-newlib )
158 @@ -1093,7 +1085,7 @@ toolchain_src_configure() {
159 # be small, and should simplify building of 64bit kernels in a 32bit
160 # userland by not needing sys-devel/kgcc64. #349405
161 case $(tc-arch) in
162 - ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
163 + ppc|ppc64) confgcc+=( --enable-targets=all ) ;;
164 sparc) tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
165 amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
166 esac
167 @@ -1116,44 +1108,40 @@ toolchain_src_configure() {
168 fi
169 fi
170
171 - if tc_version_is_at_least 4.2 ; then
172 - if in_iuse openmp ; then
173 - # Make sure target has pthreads support. #326757 #335883
174 - # There shouldn't be a chicken & egg problem here as openmp won't
175 - # build without a C library, and you can't build that w/out
176 - # already having a compiler ...
177 - if ! is_crosscompile || \
178 - $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
179 - then
180 - confgcc+=( $(use_enable openmp libgomp) )
181 - else
182 - # Force disable as the configure script can be dumb #359855
183 - confgcc+=( --disable-libgomp )
184 - fi
185 + if in_iuse openmp ; then
186 + # Make sure target has pthreads support. #326757 #335883
187 + # There shouldn't be a chicken & egg problem here as openmp won't
188 + # build without a C library, and you can't build that w/out
189 + # already having a compiler ...
190 + if ! is_crosscompile || \
191 + $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
192 + then
193 + confgcc+=( $(use_enable openmp libgomp) )
194 else
195 - # For gcc variants where we don't want openmp (e.g. kgcc)
196 + # Force disable as the configure script can be dumb #359855
197 confgcc+=( --disable-libgomp )
198 fi
199 + else
200 + # For gcc variants where we don't want openmp (e.g. kgcc)
201 + confgcc+=( --disable-libgomp )
202 fi
203
204 - if tc_version_is_at_least 4.0 ; then
205 - if _tc_use_if_iuse libssp ; then
206 - confgcc+=( --enable-libssp )
207 + if _tc_use_if_iuse libssp ; then
208 + confgcc+=( --enable-libssp )
209 + else
210 + if hardened_gcc_is_stable ssp; then
211 + export gcc_cv_libc_provides_ssp=yes
212 + fi
213 + if _tc_use_if_iuse ssp; then
214 + # On some targets USE="ssp -libssp" is an invalid
215 + # configuration as target libc does not provide
216 + # stack_chk_* functions. Do not disable libssp there.
217 + case ${CTARGET} in
218 + mingw*|*-mingw*) ewarn "Not disabling libssp" ;;
219 + *) confgcc+=( --disable-libssp ) ;;
220 + esac
221 else
222 - if hardened_gcc_is_stable ssp; then
223 - export gcc_cv_libc_provides_ssp=yes
224 - fi
225 - if _tc_use_if_iuse ssp; then
226 - # On some targets USE="ssp -libssp" is an invalid
227 - # configuration as target libc does not provide
228 - # stack_chk_* functions. Do not disable libssp there.
229 - case ${CTARGET} in
230 - mingw*|*-mingw*) ewarn "Not disabling libssp" ;;
231 - *) confgcc+=( --disable-libssp ) ;;
232 - esac
233 - else
234 - confgcc+=( --disable-libssp )
235 - fi
236 + confgcc+=( --disable-libssp )
237 fi
238 fi
239
240 @@ -1282,20 +1270,9 @@ downgrade_arch_flags() {
241 myarch=$(get-flag march)
242 mytune=$(get-flag mtune)
243
244 - # If -march=native isn't supported we have to tease out the actual arch
245 - if [[ ${myarch} == native || ${mytune} == native ]] ; then
246 - if ! tc_version_is_at_least 4.2 ${bver}; then
247 - arch=$($(tc-getCC) -march=native -v -E -P - </dev/null 2>&1 \
248 - | sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p")
249 - replace-cpu-flags native ${arch}
250 - fi
251 - fi
252 -
253 # Handle special -mtune flags
254 [[ ${mytune} == intel ]] && ! tc_version_is_at_least 4.9 ${bver} && replace-cpu-flags intel generic
255 - [[ ${mytune} == generic ]] && ! tc_version_is_at_least 4.2 ${bver} && filter-flags '-mtune=*'
256 [[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*'
257 - tc_version_is_at_least 3.4 ${bver} || filter-flags '-mtune=*'
258
259 # "added" "arch" "replacement"
260 local archlist=(
261 @@ -1327,14 +1304,6 @@ downgrade_arch_flags() {
262 4.3 geode k6-2 # gcc.gnu.org/PR41989#c22
263 4.3 k8-sse3 k8
264 4.3 opteron-sse3 k8
265 - 3.4 athlon-fx x86-64
266 - 3.4 athlon64 x86-64
267 - 3.4 c3-2 c3
268 - 3.4 k8 x86-64
269 - 3.4 opteron x86-64
270 - 3.4 pentium-m pentium3
271 - 3.4 pentium3m pentium3
272 - 3.4 pentium4m pentium4
273 )
274
275 for ((i = 0; i < ${#archlist[@]}; i += 3)) ; do
276 @@ -1420,25 +1389,6 @@ gcc_do_filter_flags() {
277 filter-flags -frecord-gcc-switches # 490738
278 filter-flags -mno-rtm -mno-htm # 506202
279
280 - if tc_version_is_between 3.2 3.4 ; then
281 - # XXX: this is so outdated it's barely useful, but it don't hurt...
282 - replace-cpu-flags G3 750
283 - replace-cpu-flags G4 7400
284 - replace-cpu-flags G5 7400
285 -
286 - # XXX: should add a sed or something to query all supported flags
287 - # from the gcc source and trim everything else ...
288 - filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
289 - filter-flags -f{no-,}stack-protector{,-all}
290 - filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
291 - # and warning options
292 - filter-flags -Wextra -Wstack-protector
293 - fi
294 - if ! tc_version_is_at_least 4.1 ; then
295 - filter-flags -fdiagnostics-show-option
296 - filter-flags -Wstack-protector
297 - fi
298 -
299 if tc_version_is_between 6 8 ; then
300 # -mstackrealign triggers crashes in exception throwing
301 # at least on ada: bug #688580
302 @@ -1446,35 +1396,33 @@ gcc_do_filter_flags() {
303 filter-flags -mstackrealign
304 fi
305
306 - if tc_version_is_at_least 3.4 ; then
307 - case $(tc-arch) in
308 - amd64|x86)
309 - filter-flags '-mcpu=*'
310 + case $(tc-arch) in
311 + amd64|x86)
312 + filter-flags '-mcpu=*'
313
314 - tc_version_is_between 4.4 4.5 && append-flags -mno-avx # 357287
315 + tc_version_is_between 4.4 4.5 && append-flags -mno-avx # 357287
316
317 - if tc_version_is_between 4.6 4.7 ; then
318 - # https://bugs.gentoo.org/411333
319 - # https://bugs.gentoo.org/466454
320 - replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
321 - fi
322 - ;;
323 - alpha)
324 - # https://bugs.gentoo.org/454426
325 - append-ldflags -Wl,--no-relax
326 - ;;
327 - sparc)
328 - # temporary workaround for random ICEs reproduced by multiple users
329 - # https://bugs.gentoo.org/457062
330 - tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1"
331 - ;;
332 - *-macos)
333 - # http://gcc.gnu.org/PR25127
334 - tc_version_is_between 4.0 4.2 && \
335 - filter-flags '-mcpu=*' '-march=*' '-mtune=*'
336 - ;;
337 - esac
338 - fi
339 + if tc_version_is_between 4.6 4.7 ; then
340 + # https://bugs.gentoo.org/411333
341 + # https://bugs.gentoo.org/466454
342 + replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
343 + fi
344 + ;;
345 + alpha)
346 + # https://bugs.gentoo.org/454426
347 + append-ldflags -Wl,--no-relax
348 + ;;
349 + sparc)
350 + # temporary workaround for random ICEs reproduced by multiple users
351 + # https://bugs.gentoo.org/457062
352 + tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1"
353 + ;;
354 + *-macos)
355 + # http://gcc.gnu.org/PR25127
356 + tc_version_is_between 4.0 4.2 && \
357 + filter-flags '-mcpu=*' '-march=*' '-mtune=*'
358 + ;;
359 + esac
360
361 strip-unsupported-flags
362
363 @@ -1589,7 +1537,7 @@ gcc_do_make() {
364 # resulting binaries natively ^^;
365 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
366 else
367 - if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then
368 + if _tc_use_if_iuse pgo; then
369 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
370 else
371 GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
372 @@ -1648,7 +1596,7 @@ gcc_do_make() {
373 if tc_version_is_at_least 4.3 ; then
374 cd "${CTARGET}"/libstdc++-v3/doc
375 emake doc-man-doxygen || ewarn "failed to make docs"
376 - elif tc_version_is_at_least 3.0 ; then
377 + else
378 cd "${CTARGET}"/libstdc++-v3
379 emake doxygen-man || ewarn "failed to make docs"
380 fi
381 @@ -1795,11 +1743,9 @@ toolchain_src_install() {
382 rm -rf "${ED}"/usr/share/{man,info}
383 rm -rf "${D}"${DATAPATH}/{man,info}
384 else
385 - if tc_version_is_at_least 3.0 ; then
386 - local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
387 - if [[ -d ${cxx_mandir} ]] ; then
388 - cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
389 - fi
390 + local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
391 + if [[ -d ${cxx_mandir} ]] ; then
392 + cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
393 fi
394 fi
395
396 @@ -1891,9 +1837,6 @@ toolchain_src_install() {
397 # when installing gcc, it dumps internal libraries into /usr/lib
398 # instead of the private gcc lib path
399 gcc_movelibs() {
400 - # older versions of gcc did not support --print-multi-os-directory
401 - tc_version_is_at_least 3.2 || return 0
402 -
403 # For non-target libs which are for CHOST and not CTARGET, we want to
404 # move them to the compiler-specific CHOST internal dir. This is stuff
405 # that you want to link against when building tools rather than building
406 @@ -2008,21 +1951,16 @@ create_gcc_env_entry() {
407 # workaround for libtool being stupid and using .la's from
408 # conflicting ABIs by using the first one in the search path
409 local ldpaths mosdirs
410 - if tc_version_is_at_least 3.2 ; then
411 - local mdir mosdir abi ldpath
412 - for abi in $(get_all_abis TARGET) ; do
413 - mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
414 - ldpath=${LIBPATH}
415 - [[ ${mdir} != "." ]] && ldpath+="/${mdir}"
416 - ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
417 -
418 - mosdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) -print-multi-os-directory)
419 - mosdirs="${mosdir}${mosdirs:+:${mosdirs}}"
420 - done
421 - else
422 - # Older gcc's didn't do multilib, so logic is simple.
423 - ldpaths=${LIBPATH}
424 - fi
425 + local mdir mosdir abi ldpath
426 + for abi in $(get_all_abis TARGET) ; do
427 + mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
428 + ldpath=${LIBPATH}
429 + [[ ${mdir} != "." ]] && ldpath+="/${mdir}"
430 + ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
431 +
432 + mosdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) -print-multi-os-directory)
433 + mosdirs="${mosdir}${mosdirs:+:${mosdirs}}"
434 + done
435
436 cat <<-EOF > ${gcc_envd_file}
437 GCC_PATH="${BINPATH}"
438 @@ -2294,7 +2232,6 @@ is_jit() {
439 }
440
441 is_multilib() {
442 - tc_version_is_at_least 3 || return 1
443 _tc_use_if_iuse multilib
444 }