Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:testing commit in: eclass/
Date: Sat, 07 Apr 2012 23:58:47
Message-Id: 1333843100.e55e38c40d8f9d8b44f9335a4f1c1e0016227534.zorry@gentoo
1 commit: e55e38c40d8f9d8b44f9335a4f1c1e0016227534
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 7 23:58:20 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 7 23:58:20 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=e55e38c4
7
8 remove alot of <gcc-4.6 support
9
10 ---
11 eclass/toolchain.eclass | 615 +++++++++--------------------------------------
12 1 files changed, 111 insertions(+), 504 deletions(-)
13
14 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
15 index aa00f09..9f87225 100644
16 --- a/eclass/toolchain.eclass
17 +++ b/eclass/toolchain.eclass
18 @@ -71,11 +71,7 @@ export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
19
20 PREFIX=${TOOLCHAIN_PREFIX:-/usr}
21
22 -if tc_version_is_at_least 3.4.0 ; then
23 - LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
24 -else
25 - LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
26 -fi
27 +LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
28 INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
29 if is_crosscompile ; then
30 BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
31 @@ -98,18 +94,9 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
32 [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
33 [[ -n ${D_VER} ]] && IUSE+=" d"
34 [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
35 -
36 - if tc_version_is_at_least 3 ; then
37 - IUSE+=" bootstrap doc gcj gtk hardened multilib objc"
38 -
39 - tc_version_is_at_least "4.0" && IUSE+=" objc-gc mudflap"
40 - tc_version_is_at_least "4.1" && IUSE+=" libssp objc++"
41 - tc_version_is_at_least "4.2" && IUSE+=" openmp"
42 - tc_version_is_at_least "4.3" && IUSE+=" fixed-point"
43 - tc_version_is_at_least "4.4" && IUSE+=" graphite"
44 - [[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto"
45 - tc_version_is_at_least "4.6" && IUSE+=" go"
46 - fi
47 + IUSE+=" bootstrap doc gcj gtk hardened multilib objc"
48 + IUSE+=" objc-gc mudflap objc++ openmp fixed-point graphite go"
49 + [[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto"
50 fi
51
52 # Support upgrade paths here or people get pissed
53 @@ -128,21 +115,11 @@ RDEPEND="sys-libs/zlib
54 !build? (
55 nls? ( sys-devel/gettext )
56 )"
57 -if tc_version_is_at_least 3 ; then
58 - RDEPEND+=" virtual/libiconv"
59 -fi
60 -if tc_version_is_at_least 4 ; then
61 - GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
62 - if tc_version_is_at_least 4.3 ; then
63 - RDEPEND+=" ${GMP_MPFR_DEPS}"
64 - elif in_iuse fortran ; then
65 - RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
66 - fi
67 - if tc_version_is_at_least 4.5 ; then
68 - RDEPEND+=" >=dev-libs/mpc-0.8.1"
69 - fi
70 - in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
71 -fi
72 +RDEPEND+=" virtual/libiconv"
73 +RDEPEND+=" >=dev-libs/mpc-0.8.1"
74 +GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
75 +RDEPEND+=" ${GMP_MPFR_DEPS}"
76 +in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
77 if in_iuse graphite ; then
78 RDEPEND+="
79 graphite? (
80 @@ -167,9 +144,9 @@ if in_iuse gcj ; then
81 x11-proto/xproto
82 x11-proto/xextproto
83 =x11-libs/gtk+-2*"
84 - tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
85 + GCJ_GTK_DEPS+=" x11-libs/pango"
86 GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
87 - tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
88 + GCJ_DEPS+=" app-arch/zip app-arch/unzip"
89 DEPEND+=" gcj? ( gtk? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
90 fi
91
92 @@ -301,14 +278,8 @@ get_gcc_src_uri() {
93
94 [[ -n ${D_VER} ]] && GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
95
96 - # >= gcc-4.3 uses ecj.jar and we only add gcj as a use flag under certain
97 - # conditions
98 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
99 - if tc_version_is_at_least "4.5" ; then
100 - GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
101 - elif tc_version_is_at_least "4.3" ; then
102 - GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )"
103 - fi
104 + GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
105 fi
106
107 echo "${GCC_SRC_URI}"
108 @@ -326,85 +297,6 @@ get_make_var() {
109 }
110 XGCC() { get_make_var GCC_FOR_TARGET ; }
111
112 -# The gentoo piessp patches allow for 3 configurations:
113 -# 1) PIE+SSP by default
114 -# 2) PIE by default
115 -# 3) SSP by default
116 -hardened_gcc_works() {
117 - if [[ $1 == "pie" ]] ; then
118 - # $gcc_cv_ld_pie is unreliable as it simply take the output of
119 - # `ld --help | grep -- -pie`, that reports the option in all cases, also if
120 - # the loader doesn't actually load the resulting executables.
121 - # To avoid breakage, blacklist FreeBSD here at least
122 - [[ ${CTARGET} == *-freebsd* ]] && return 1
123 -
124 - want_pie || return 1
125 - use_if_iuse nopie && return 1
126 - hardened_gcc_is_stable pie
127 - return $?
128 - elif [[ $1 == "ssp" ]] ; then
129 - [[ -n ${SPECS_VER} ]] || return 1
130 - use_if_iuse nossp && return 1
131 - hardened_gcc_is_stable ssp
132 - return $?
133 - else
134 - # laziness ;)
135 - hardened_gcc_works pie || return 1
136 - hardened_gcc_works ssp || return 1
137 - return 0
138 - fi
139 -}
140 -
141 -hardened_gcc_is_stable() {
142 - local tocheck
143 - if [[ $1 == "pie" ]] ; then
144 - if [[ ${CTARGET} == *-uclibc* ]] ; then
145 - tocheck=${PIE_UCLIBC_STABLE}
146 - else
147 - tocheck=${PIE_GLIBC_STABLE}
148 - fi
149 - elif [[ $1 == "ssp" ]] ; then
150 - if [[ ${CTARGET} == *-uclibc* ]] ; then
151 - tocheck=${SSP_UCLIBC_STABLE}
152 - else
153 - tocheck=${SSP_STABLE}
154 - fi
155 - else
156 - die "hardened_gcc_stable needs to be called with pie or ssp"
157 - fi
158 -
159 - has $(tc-arch) ${tocheck} && return 0
160 - return 1
161 -}
162 -
163 -want_pie() {
164 - ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1
165 - [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
166 - tc_version_is_at_least 4.3.2 && return 1
167 - [[ -z ${PIE_VER} ]] && return 1
168 - use !nopie && return 0
169 - return 1
170 -}
171 -
172 -want_minispecs() {
173 - if tc_version_is_at_least 4.3.2 && use hardened ; then
174 - if ! want_pie ; then
175 - ewarn "PIE_VER or SPECS_VER is not defiend in the GCC ebuild."
176 - elif use vanilla ; then
177 - ewarn "You will not get hardened features if you have the vanilla USE-flag."
178 - elif use nopie && use nossp ; then
179 - ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
180 - elif ! hardened_gcc_works ; then
181 - ewarn "Your $(tc-arch) arch is not supported."
182 - else
183 - return 0
184 - fi
185 - ewarn "Hope you know what you are doing. Hardened will not work."
186 - return 0
187 - fi
188 - return 1
189 -}
190 -
191 # This is to make sure we don't accidentally try to enable support for a
192 # language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc.
193 #
194 @@ -420,37 +312,6 @@ gcc-lang-supported() {
195
196 #---->> specs + env.d logic <<----
197
198 -# configure to build with the hardened GCC specs as the default
199 -make_gcc_hard() {
200 - # defaults to enable for all hardened toolchains
201 - local gcc_hard_flags="-DEFAULT_RELRO -DEFAULT_BIND_NOW"
202 -
203 - if hardened_gcc_works ; then
204 - einfo "Updating gcc to use automatic PIE + SSP building ..."
205 - gcc_hard_flags+=" -DEFAULT_PIE_SSP"
206 - elif hardened_gcc_works pie ; then
207 - einfo "Updating gcc to use automatic PIE building ..."
208 - ewarn "SSP has not been enabled by default"
209 - gcc_hard_flags+=" -DEFAULT_PIE"
210 - elif hardened_gcc_works ssp ; then
211 - einfo "Updating gcc to use automatic SSP building ..."
212 - ewarn "PIE has not been enabled by default"
213 - gcc_hard_flags+=" -DEFAULT_SSP"
214 - else
215 - # do nothing if hardened isnt supported, but dont die either
216 - ewarn "hardened is not supported for this arch in this gcc version"
217 - ebeep
218 - return 0
219 - fi
220 -
221 - sed -i \
222 - -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
223 - "${S}"/gcc/Makefile.in || die
224 -
225 - # rebrand to make bug reports easier
226 - BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
227 -}
228 -
229 create_gcc_env_entry() {
230 dodir /etc/env.d/gcc
231 local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
232 @@ -498,21 +359,6 @@ create_gcc_env_entry() {
233 # Set which specs file to use
234 [[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=\"${gcc_specs_file}\"" >> ${gcc_envd_file}
235 }
236 -setup_minispecs_gcc_build_specs() {
237 - # Setup the "build.specs" file for gcc 4.3 to use when building.
238 - if hardened_gcc_works pie ; then
239 - cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs
240 - fi
241 - if hardened_gcc_works ssp ; then
242 - for s in ssp sspall ; do
243 - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
244 - done
245 - fi
246 - for s in nostrict znow ; do
247 - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
248 - done
249 - export GCC_SPECS="${WORKDIR}"/build.specs
250 -}
251 copy_minispecs_gcc_specs() {
252 # setup the hardenedno* specs files and the vanilla specs file.
253 if hardened_gcc_works ; then
254 @@ -527,14 +373,6 @@ copy_minispecs_gcc_specs() {
255 create_gcc_env_entry vanilla
256 insinto ${LIBPATH}
257 doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
258 - # Build system specs file which, if it exists, must be a complete set of
259 - # specs as it completely and unconditionally overrides the builtin specs.
260 - # For gcc 4.3
261 - if ! tc_version_is_at_least 4.4 ; then
262 - $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs
263 - cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs
264 - doins "${WORKDIR}"/specs/specs || die "failed to install the specs file"
265 - fi
266 }
267
268 #----<< specs + env.d logic >>----
269 @@ -560,8 +398,6 @@ pkg_setup() {
270 use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
271 fi
272
273 - want_minispecs
274 -
275 unset LANGUAGES #265283
276 }
277
278 @@ -583,23 +419,6 @@ pkg_postinst() {
279 echo
280 fi
281
282 - # If our gcc-config version doesn't like '-' in it's version string,
283 - # tell our users that gcc-config will yell at them, but it's all good.
284 - if ! has_version '>=sys-devel/gcc-config-1.3.10-r1' && [[ ${GCC_CONFIG_VER/-/} != ${GCC_CONFIG_VER} ]] ; then
285 - ewarn "Your version of gcc-config will issue about having an invalid profile"
286 - ewarn "when switching to this profile. It is safe to ignore this warning,"
287 - ewarn "and this problem has been corrected in >=sys-devel/gcc-config-1.3.10-r1."
288 - fi
289 -
290 - if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} == 3.4 ]] ; then
291 - echo
292 - ewarn "You should make sure to rebuild all your C++ packages when"
293 - ewarn "upgrading between different versions of gcc. For example,"
294 - ewarn "when moving to gcc-3.4 from gcc-3.3, emerge gentoolkit and run:"
295 - ewarn " # revdep-rebuild --library libstdc++.so.5"
296 - echo
297 - fi
298 -
299 if ! is_crosscompile ; then
300 # hack to prevent collisions between SLOT
301 [[ ! -d ${ROOT}/$(get_libdir)/rcscripts/awk ]] \
302 @@ -670,40 +489,6 @@ guess_patch_type_in_dir() {
303 && EPATCH_SUFFIX="patch.bz2" \
304 || EPATCH_SUFFIX="patch"
305 }
306 -do_gcc_rename_java_bins() {
307 - # bug #139918 - conflict between gcc and java-config-2 for ownership of
308 - # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch
309 - # because patches would be large (thanks to the rename of man files),
310 - # and it's clear from the sed invocations that all that changes is the
311 - # rmi{c,registry} names to grmi{c,registry} names.
312 - # Kevin F. Quinn 2006-07-12
313 - einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry."
314 - # 1) Move the man files if present (missing prior to gcc-3.4)
315 - for manfile in rmic rmiregistry; do
316 - [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue
317 - mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1
318 - done
319 - # 2) Fixup references in the docs if present (mission prior to gcc-3.4)
320 - for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi; do
321 - [[ -f ${S}/${jfile} ]] || continue
322 - sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
323 - die "Failed to fixup file ${jfile} for rename to grmiregistry"
324 - sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} ||
325 - die "Failed to fixup file ${jfile} for rename to grmic"
326 - done
327 - # 3) Fixup Makefiles to build the changed executable names
328 - # These are present in all 3.x versions, and are the important bit
329 - # to get gcc to build with the new names.
330 - for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in; do
331 - sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
332 - die "Failed to fixup file ${jfile} for rename to grmiregistry"
333 - # Careful with rmic on these files; it's also the name of a directory
334 - # which should be left unchanged. Replace occurrences of 'rmic$',
335 - # 'rmic_' and 'rmic '.
336 - sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} ||
337 - die "Failed to fixup file ${jfile} for rename to grmic"
338 - done
339 -}
340 gcc-abi-map() {
341 # Convert the ABI name we use in Gentoo to what gcc uses
342 local map=()
343 @@ -736,12 +521,7 @@ gcc-multilib-configure() {
344 if [[ -n ${list} ]] ; then
345 case ${CTARGET} in
346 x86_64*)
347 - # drop the 4.6.2 stuff once 4.7 goes stable
348 - if tc_version_is_at_least 4.7 ||
349 - ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) )
350 - then
351 - confgcc+=" --with-multilib-list=${list:1}"
352 - fi
353 + confgcc+=" --with-multilib-list=${list:1}"
354 ;;
355 esac
356 fi
357 @@ -749,68 +529,47 @@ gcc-multilib-configure() {
358 gcc-compiler-configure() {
359 gcc-multilib-configure
360
361 - if tc_version_is_at_least "4.0" ; then
362 - if in_iuse mudflap ; then
363 - confgcc+=" $(use_enable mudflap libmudflap)"
364 - else
365 - confgcc+=" --disable-libmudflap"
366 - fi
367 -
368 - if use_if_iuse libssp ; then
369 - confgcc+=" --enable-libssp"
370 - else
371 - export gcc_cv_libc_provides_ssp=yes
372 - confgcc+=" --disable-libssp"
373 - fi
374 -
375 - # If we want hardened support with the newer piepatchset for >=gcc 4.4
376 - if tc_version_is_at_least 4.4 && want_minispecs ; then
377 - confgcc+=" $(use_enable hardened esp)"
378 - fi
379 + if in_iuse mudflap ; then
380 + confgcc+=" $(use_enable mudflap libmudflap)"
381 + else
382 + confgcc+=" --disable-libmudflap"
383 + fi
384
385 - if tc_version_is_at_least "4.2" ; then
386 - if in_iuse openmp ; then
387 - # Make sure target has pthreads support. #326757 #335883
388 - # There shouldn't be a chicken&egg problem here as openmp won't
389 - # build without a C library, and you can't build that w/out
390 - # already having a compiler ...
391 - if ! is_crosscompile || \
392 - $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
393 - then
394 - confgcc+=" $(use_enable openmp libgomp)"
395 - else
396 - # Force disable as the configure script can be dumb #359855
397 - confgcc+=" --disable-libgomp"
398 - fi
399 - else
400 - # For gcc variants where we don't want openmp (e.g. kgcc)
401 - confgcc+=" --disable-libgomp"
402 - fi
403 - fi
404 + confgcc+=" $(use_enable hardened espf)"
405
406 - # Stick the python scripts in their own slotted directory
407 - # bug #279252
408 - #
409 - # --with-python-dir=DIR
410 - # Specifies where to install the Python modules used for aot-compile. DIR
411 - # should not include the prefix used in installation. For example, if the
412 - # Python modules are to be installed in /usr/lib/python2.5/site-packages,
413 - # then --with-python-dir=/lib/python2.5/site-packages should be passed.
414 - #
415 - # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
416 - if tc_version_is_at_least "4.4" ; then
417 - confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python"
418 + if in_iuse openmp ; then
419 + # Make sure target has pthreads support. #326757 #335883
420 + # There shouldn't be a chicken&egg problem here as openmp won't
421 + # build without a C library, and you can't build that w/out
422 + # already having a compiler ...
423 + if ! is_crosscompile || \
424 + $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
425 + then
426 + confgcc+=" $(use_enable openmp libgomp)"
427 + else
428 + # Force disable as the configure script can be dumb #359855
429 + confgcc+=" --disable-libgomp"
430 fi
431 + else
432 + # For gcc variants where we don't want openmp (e.g. kgcc)
433 + confgcc+=" --disable-libgomp"
434 fi
435 + # Stick the python scripts in their own slotted directory
436 + # bug #279252
437 + #
438 + # --with-python-dir=DIR
439 + # Specifies where to install the Python modules used for aot-compile. DIR
440 + # should not include the prefix used in installation. For example, if the
441 + # Python modules are to be installed in /usr/lib/python2.5/site-packages,
442 + # then --with-python-dir=/lib/python2.5/site-packages should be passed.
443 + #
444 + # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
445 + confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python"
446
447 # For newer versions of gcc, use the default ("release"), because no
448 # one (even upstream apparently) tests with it disabled. #317217
449 - if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then
450 - confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}"
451 - else
452 - confgcc+=" --disable-checking"
453 - fi
454 -
455 + confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}"
456 +
457 # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained
458 # right now). Much thanks to <csm@×××.org> for the heads up.
459 # Travis Tilley <lv@g.o> (11 Jul 2004)
460 @@ -822,13 +581,13 @@ gcc-compiler-configure() {
461
462 # newer gcc versions like to bootstrap themselves with C++,
463 # so we need to manually disable it ourselves
464 - if tc_version_is_at_least 4.7 && ! is_cxx ; then
465 + if ! is_cxx ; then
466 confgcc+=" --disable-build-with-cxx --disable-build-poststage1-with-cxx"
467 fi
468
469 # newer gcc's come with libquadmath, but only fortran uses
470 # it, so auto punt it when we don't care
471 - if tc_version_is_at_least 4.6 && ! is_fortran ; then
472 + if ! is_fortran ; then
473 confgcc+=" --disable-libquadmath"
474 fi
475
476 @@ -847,8 +606,7 @@ gcc-compiler-configure() {
477 fi
478
479 # Enable hardvfp
480 - if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] && \
481 - tc_version_is_at_least "4.5" ; then
482 + if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] ; then
483 confgcc+=" --with-float=hard"
484 fi
485 ;;
486 @@ -886,9 +644,7 @@ gcc-compiler-configure() {
487 is_go && GCC_LANG+=",go"
488 if is_objc || is_objcxx ; then
489 GCC_LANG+=",objc"
490 - if tc_version_is_at_least "4.0" ; then
491 - use objc-gc && confgcc+=" --enable-objc-gc"
492 - fi
493 + use objc-gc && confgcc+=" --enable-objc-gc"
494 is_objcxx && GCC_LANG+=",obj-c++"
495 fi
496 is_treelang && GCC_LANG+=",treelang"
497 @@ -930,31 +686,7 @@ gcc_do_filter_flags() {
498 filter-flags '-mabi*' -m31 -m32 -m64
499
500 case ${GCC_BRANCH_VER} in
501 - 3.2|3.3)
502 - replace-cpu-flags k8 athlon64 opteron i686 x86-64
503 - replace-cpu-flags pentium-m pentium3m pentium3
504 - case $(tc-arch) in
505 - amd64|x86) filter-flags '-mtune=*' ;;
506 - # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used,
507 - # the compiler wrongly assumes a 32bit target
508 - ppc64) filter-flags "-mcpu=*";;
509 - esac
510 - case $(tc-arch) in
511 - amd64) replace-cpu-flags core2 nocona;;
512 - x86) replace-cpu-flags core2 prescott;;
513 - esac
514 -
515 - replace-cpu-flags G3 750
516 - replace-cpu-flags G4 7400
517 - replace-cpu-flags G5 7400
518 -
519 - # XXX: should add a sed or something to query all supported flags
520 - # from the gcc source and trim everything else ...
521 - filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
522 - filter-flags -f{no-,}stack-protector{,-all}
523 - filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
524 - ;;
525 - 3.4|4.*)
526 + 4.*)
527 case $(tc-arch) in
528 x86|amd64) filter-flags '-mcpu=*';;
529 *-macos)
530 @@ -1041,9 +773,6 @@ gcc_slot_java() {
531 # when installing gcc, it dumps internal libraries into /usr/lib
532 # instead of the private gcc lib path
533 gcc_movelibs() {
534 - # older versions of gcc did not support --print-multi-os-directory
535 - tc_version_is_at_least 3.0 || return 0
536 -
537 local multiarg removedirs=""
538 for multiarg in $($(XGCC) -print-multi-lib) ; do
539 multiarg=${multiarg#*;}
540 @@ -1084,58 +813,12 @@ gcc_movelibs() {
541 find "${D}" -type d | xargs rmdir >& /dev/null
542 }
543
544 -do_gcc_HTB_patches() {
545 - use_if_iuse boundschecking || return 0
546 -
547 - # modify the bounds checking patch with a regression patch
548 - epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
549 - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
550 -}
551 -
552 -# do various updates to PIE logic
553 -do_gcc_PIE_patches() {
554 - want_pie || return 0
555 -
556 - use vanilla && return 0
557 -
558 - if tc_version_is_at_least 4.3.2; then
559 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/
560 - EPATCH_MULTI_MSG="Applying pie patches ..." \
561 - epatch "${WORKDIR}"/piepatch/
562 - else
563 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
564 -
565 - # corrects startfile/endfile selection and shared/static/pie flag usage
566 - EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
567 - epatch "${WORKDIR}"/piepatch/upstream
568 - # adds non-default pie support (rs6000)
569 - EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
570 - epatch "${WORKDIR}"/piepatch/nondef
571 - # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
572 - EPATCH_MULTI_MSG="Applying default pie patches ..." \
573 - epatch "${WORKDIR}"/piepatch/def
574 - fi
575 -
576 - # we want to be able to control the pie patch logic via something other
577 - # than ALL_CFLAGS...
578 - sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
579 - -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
580 - -i "${S}"/gcc/Makefile.in
581 - # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
582 - if tc_version_is_at_least 4.7.0 ; then
583 - sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
584 - -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
585 - -i "${S}"/gcc/Makefile.in
586 - fi
587 -
588 - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
589 -}
590 -
591 #---->> some function for src_* <<----
592
593 #---->> src_* <<----
594 src_unpack() {
595 - [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
596 + [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && \
597 + die "Sorry, this version does not support uClibc"
598
599 if [[ ${PV} == *9999* ]]; then
600 git-2_src_unpack
601 @@ -1186,11 +869,10 @@ src_unpack() {
602 [[ -n ${UCLIBC_VER} ]] && \
603 unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
604
605 - if want_pie ; then
606 + [[ -n ${PIE_VER} ]] && \
607 unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
608 - [[ -n ${SPECS_VER} ]] && \
609 - unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
610 - fi
611 + [[ -n ${SPECS_VER} ]] && \
612 + unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
613
614 use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
615
616 @@ -1214,67 +896,46 @@ src_prepare() {
617 epatch "${WORKDIR}"/uclibc
618 fi
619 fi
620 - do_gcc_HTB_patches
621 - do_gcc_PIE_patches
622 + if use_if_iuse boundschecking ; then
623 + # modify the bounds checking patch with a regression patch
624 + epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
625 + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
626 + fi
627 + if use_if_iuse hardened && ! use_if_iuse nopie && [[ -n ${PIE_VER} ]] ; then
628 + guess_patch_type_in_dir "${WORKDIR}"/piepatch/
629 + EPATCH_MULTI_MSG="Applying pie patches ..." \
630 + epatch "${WORKDIR}"/piepatch/
631 + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
632 + fi
633 epatch_user
634
635 - use hardened && make_gcc_hard
636 + if use_if_iuse hardened ; then
637 + BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
638 + fi
639
640 # install the libstdc++ python into the right location
641 # http://gcc.gnu.org/PR51368
642 - if tc_version_is_at_least 4.5 ; then
643 - sed -i \
644 - '/^pythondir =/s:=.*:= $(datadir)/python:' \
645 - "${S}"/libstdc++-v3/python/Makefile.in || die
646 - fi
647 -
648 - # No idea when this first started being fixed, but let's go with 4.3.x for now
649 - if ! tc_version_is_at_least 4.3 ; then
650 - fix_files=""
651 - for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
652 - [[ -e ${x} ]] && fix_files="${fix_files} ${x}"
653 - done
654 - ht_fix_file ${fix_files} */configure *.sh */Makefile.in
655 - fi
656 -
657 + sed -i \
658 + '/^pythondir =/s:=.*:= $(datadir)/python:' \
659 + "${S}"/libstdc++-v3/python/Makefile.in || die
660 +
661 setup_multilib_osdirnames
662
663 - gcc_version_patch
664 - if tc_version_is_at_least 4.1 ; then
665 - if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
666 - # BASE-VER must be a three-digit version number
667 - # followed by an optional -pre string
668 - # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
669 - # If BASE-VER differs from ${PV/_/-} then libraries get installed in
670 - # the wrong directory.
671 - echo ${PV/_/-} > "${S}"/gcc/BASE-VER
672 - fi
673 + if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
674 + # BASE-VER must be a three-digit version number
675 + # followed by an optional -pre string
676 + # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
677 + # If BASE-VER differs from ${PV/_/-} then libraries get installed in
678 + # the wrong directory.
679 + echo ${PV/_/-} > "${S}"/gcc/BASE-VER
680 fi
681 -
682 +
683 # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
684 - if tc_version_is_at_least 4.3 && use gcj ; then
685 - if tc_version_is_at_least "4.5" ; then
686 - einfo "Copying ecj-4.5.jar"
687 - cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
688 - elif tc_version_is_at_least "4.3" ; then
689 - einfo "Copying ecj-4.3.jar"
690 - cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
691 - fi
692 - fi
693 -
694 - # disable --as-needed from being compiled into gcc specs
695 - # natively when using a gcc version < 3.4.4
696 - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992
697 - if ! tc_version_is_at_least 3.4.4 ; then
698 - sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
699 - fi
700 -
701 - # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
702 - # in line with gcc-4.
703 - if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then
704 - do_gcc_rename_java_bins
705 + if use gcj ; then
706 + einfo "Copying ecj-4.5.jar"
707 + cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
708 fi
709 -
710 +
711 # Prevent libffi from being installed
712 sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
713 sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
714 @@ -1288,7 +949,7 @@ src_prepare() {
715 # update configure files
716 local f
717 einfo "Fixing misc issues in configure files"
718 - tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
719 + epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
720 for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
721 ebegin " Updating ${f/${S}\/} [LANG]"
722 patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
723 @@ -1318,11 +979,6 @@ src_configure() {
724 # issues with 3rd party jar implementations. #384291
725 export JAR=no
726
727 - # For hardened gcc 4.3 piepatchset to build the hardened specs
728 - # file (build.specs) to use when building gcc.
729 - if ! tc_version_is_at_least 4.4 && want_minispecs ; then
730 - setup_minispecs_gcc_build_specs
731 - fi
732 # Build in a separate build tree
733 mkdir -p "${WORKDIR}"/build
734 pushd "${WORKDIR}"/build > /dev/null
735 @@ -1371,7 +1027,7 @@ src_configure() {
736 # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
737 # significantly increase compile time by several hours. This will allow
738 # users to control this feature in the event they need the support.
739 - tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
740 + confgcc+=" $(use_enable fixed-point)"
741
742 # Graphite support was added in 4.4, which depends on external libraries
743 # for optimizations. Current versions use cloog-ppl (cloog fork with Parma
744 @@ -1381,24 +1037,18 @@ src_configure() {
745 # names are different).
746 #
747 # We disable the PPL version check so we can use >=ppl-0.11.
748 - if tc_version_is_at_least "4.4"; then
749 - confgcc+=" $(use_with graphite ppl)"
750 - confgcc+=" $(use_with graphite cloog)"
751 - if use graphite; then
752 - confgcc+=" --disable-ppl-version-check"
753 - confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
754 - fi
755 + confgcc+=" $(use_with graphite ppl)"
756 + confgcc+=" $(use_with graphite cloog)"
757 + if use graphite; then
758 + confgcc+=" --disable-ppl-version-check"
759 + confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
760 fi
761 -
762 +
763 # LTO support was added in 4.5, which depends upon elfutils. This allows
764 # users to enable that option, and pull in the additional library. In 4.6,
765 # the dependency is no longer required.
766 - if tc_version_is_at_least "4.6" ; then
767 - confgcc+=" --enable-lto"
768 - elif tc_version_is_at_least "4.5" ; then
769 - confgcc+=" $(use_enable lto)"
770 - fi
771 -
772 + confgcc+=" --enable-lto"
773 +
774 [[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft"
775 [[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard"
776
777 @@ -1443,7 +1093,7 @@ src_configure() {
778 fi
779 fi
780
781 - tc_version_is_at_least 4.2 && confgcc+=" --disable-bootstrap"
782 + confgcc+=" --disable-bootstrap"
783 else
784 if tc-is-static-only ; then
785 confgcc+=" --disable-shared"
786 @@ -1462,10 +1112,6 @@ src_configure() {
787 case ${CTARGET} in
788 *-uclibc*)
789 confgcc+=" --disable-__cxa_atexit --enable-target-optspace $(use_enable nptl tls)"
790 - [[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=" --enable-sjlj-exceptions"
791 - if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then
792 - confgcc+=" --enable-clocale=uclibc"
793 - fi
794 ;;
795 *-elf|*-eabi)
796 confgcc+=" --with-newlib"
797 @@ -1481,18 +1127,17 @@ src_configure() {
798 confgcc+=" --enable-__cxa_atexit"
799 ;;
800 esac
801 - tc_version_is_at_least 3.4 || confgcc+=" --disable-libunwind-exceptions"
802 -
803 +
804 # if the target can do biarch (-m32/-m64), enable it. overhead should
805 # be small, and should simplify building of 64bit kernels in a 32bit
806 # userland by not needing sys-devel/kgcc64. #349405
807 case $(tc-arch) in
808 - ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=" --enable-targets=all" ;;
809 - sparc) tc_version_is_at_least 4.4 && confgcc+=" --enable-targets=all" ;;
810 - amd64|x86) tc_version_is_at_least 4.3 && confgcc+=" --enable-targets=all" ;;
811 + ppc|ppc64) confgcc+=" --enable-targets=all" ;;
812 + sparc) confgcc+=" --enable-targets=all" ;;
813 + amd64|x86) confgcc+=" --enable-targets=all" ;;
814 esac
815
816 - tc_version_is_at_least 4.3 && set -- "$@" \
817 + set -- "$@" \
818 --with-bugurl=http://bugs.gentoo.org/ \
819 --with-pkgversion="${BRANDING_GCC_PKGVERSION}"
820 set -- ${confgcc} "$@" ${EXTRA_ECONF}
821 @@ -1554,9 +1199,6 @@ src_compile() {
822
823 if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
824 STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
825 - elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
826 - # See bug #79852
827 - STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
828 fi
829
830 if is_crosscompile; then
831 @@ -1582,13 +1224,8 @@ src_compile() {
832
833 if ! is_crosscompile && use cxx && use doc ; then
834 if type -p doxygen > /dev/null ; then
835 - if tc_version_is_at_least 4.3 ; then
836 - cd "${CTARGET}"/libstdc++-v3/doc
837 - emake doc-man-doxygen || ewarn "failed to make docs"
838 - elif tc_version_is_at_least 3.0 ; then
839 - cd "${CTARGET}"/libstdc++-v3
840 - emake doxygen-man || ewarn "failed to make docs"
841 - fi
842 + cd "${CTARGET}"/libstdc++-v3/doc
843 + emake doc-man-doxygen || ewarn "failed to make docs"
844 else
845 ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
846 fi
847 @@ -1636,9 +1273,9 @@ src_install() {
848 create_gcc_env_entry
849
850 # Setup the gcc_env_entry for hardened gcc 4 with minispecs
851 - if want_minispecs ; then
852 - copy_minispecs_gcc_specs
853 - fi
854 + #if want_minispecs ; then
855 + # copy_minispecs_gcc_specs
856 + #fi
857 # Make sure we dont have stuff lying around that
858 # can nuke multiple versions of gcc
859
860 @@ -1745,10 +1382,8 @@ src_install() {
861 export QA_WX_LOAD="usr/lib*/go/*/*.gox"
862
863 # Disable RANDMMAP so PCH works. #301299
864 - if tc_version_is_at_least 4.3 ; then
865 - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
866 - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
867 - fi
868 + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
869 + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
870 }
871
872 #----<< src_* >>----
873 @@ -1829,27 +1464,6 @@ do_gcc_config() {
874 gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs}
875 }
876
877 -# This function allows us to gentoo-ize gcc's version number and bugzilla
878 -# URL without needing to use patches.
879 -gcc_version_patch() {
880 - # gcc-4.3+ has configure flags (whoo!)
881 - tc_version_is_at_least 4.3 && return 0
882 -
883 - local version_string=${GCC_CONFIG_VER}
884 - [[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
885 -
886 - einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
887 -
888 - local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
889 - if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
890 - gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
891 - else
892 - version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
893 - gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
894 - fi
895 - sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
896 -}
897 -
898 # This is a historical wart. The original Gentoo/amd64 port used:
899 # lib32 - 32bit binaries (x86)
900 # lib64 - 64bit binaries (x86_64)
901 @@ -1883,13 +1497,7 @@ setup_multilib_osdirnames() {
902 if [[ ${SYMLINK_LIB} == "yes" ]] ; then
903 einfo "updating multilib directories to be: ${libdirs}"
904 # drop the 4.6.2 stuff once 4.7 goes stable
905 - if tc_version_is_at_least 4.7 ||
906 - ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) )
907 - then
908 - set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:'
909 - else
910 - set -- -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:"
911 - fi
912 + set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:'
913 else
914 einfo "using upstream multilib; disabling lib32 autodetection"
915 set -- -r -e 's:[$][(]if.*,(.*)[)]:\1:'
916 @@ -1933,7 +1541,6 @@ fix_libtool_libdir_paths() {
917 }
918
919 is_multilib() {
920 - tc_version_is_at_least 3 || return 1
921 use multilib
922 }