summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass3
-rw-r--r--hardened/toolchain/branches/pieworld/eclass/toolchain-funcs.eclass161
-rw-r--r--hardened/toolchain/branches/pieworld/eclass/toolchain.eclass29
3 files changed, 143 insertions, 50 deletions
diff --git a/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass b/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
index 229b30a..02255cb 100644
--- a/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
+++ b/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.119 2007/05/12 11:45:51 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.120 2007/07/22 08:21:09 dberkholz Exp $
#
# Maintainer: toolchain@gentoo.org
@@ -102,6 +102,7 @@ setup-allowed-flags() {
-g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+ \
-fno-unit-at-a-time -fno-ident"
# allow a bunch of flags that negate features / control ABI - these
+ export ALLOWED_FLAGS="${ALLOWED_FLAGS} -W* -w"
# are always allowed.
# ? Why is -fPIC here? It should be covered by -m<something> where
# necessary. Setting -fPIC in C[XX]FLAGS isn't sensible, in general.
diff --git a/hardened/toolchain/branches/pieworld/eclass/toolchain-funcs.eclass b/hardened/toolchain/branches/pieworld/eclass/toolchain-funcs.eclass
index 851065f..aaf82c9 100644
--- a/hardened/toolchain/branches/pieworld/eclass/toolchain-funcs.eclass
+++ b/hardened/toolchain/branches/pieworld/eclass/toolchain-funcs.eclass
@@ -1,11 +1,17 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.69 2007/03/27 01:46:50 vapier Exp $
-#
-# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
-#
-# This eclass contains (or should) functions to get common info
-# about the toolchain (libc/compiler/binutils/etc...)
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.74 2007/08/17 10:14:13 vapier Exp $
+
+# @ECLASS: toolchain-funcs.eclass
+# @MAINTAINER:
+# Toolchain Ninjas <toolchain@gentoo.org>
+# @BLURB: functions to query common info about the toolchain
+# @DESCRIPTION:
+# The toolchain-funcs aims to provide a complete suite of functions
+# for gleaning useful information about the toolchain and to simplify
+# ugly things like cross-compiling and multilib. All of this is done
+# in such a way that you can rely on the function always returning
+# something sane.
___ECLASS_RECUR_TOOLCHAIN_FUNCS="yes"
[[ -z ${___ECLASS_RECUR_MULTILIB} ]] && inherit multilib
@@ -30,34 +36,62 @@ tc-getPROG() {
echo "${!var}"
}
-# Returns the name of the archiver
+# @FUNCTION: tc-getAR
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the archiver
tc-getAR() { tc-getPROG AR ar "$@"; }
-# Returns the name of the assembler
+# @FUNCTION: tc-getAS
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the assembler
tc-getAS() { tc-getPROG AS as "$@"; }
-# Returns the name of the C compiler
+# @FUNCTION: tc-getCC
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C compiler
tc-getCC() { tc-getPROG CC gcc "$@"; }
-# Returns the name of the C preprocessor
+# @FUNCTION: tc-getCPP
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C preprocessor
tc-getCPP() { tc-getPROG CPP cpp "$@"; }
-# Returns the name of the C++ compiler
+# @FUNCTION: tc-getCXX
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C++ compiler
tc-getCXX() { tc-getPROG CXX g++ "$@"; }
-# Returns the name of the linker
+# @FUNCTION: tc-getLD
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the linker
tc-getLD() { tc-getPROG LD ld "$@"; }
-# Returns the name of the strip prog
+# @FUNCTION: tc-getSTRIP
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the strip program
tc-getSTRIP() { tc-getPROG STRIP strip "$@"; }
-# Returns the name of the symbol/object thingy
+# @FUNCTION: tc-getNM
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the symbol/object thingy
tc-getNM() { tc-getPROG NM nm "$@"; }
-# Returns the name of the archiver indexer
+# @FUNCTION: tc-getRANLIB
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the archiver indexer
tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; }
-# Returns the name of the fortran 77 compiler
+# @FUNCTION: tc-getF77
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the Fortran 77 compiler
tc-getF77() { tc-getPROG F77 f77 "$@"; }
-# Returns the name of the fortran 90 compiler
+# @FUNCTION: tc-getF90
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the Fortran 90 compiler
tc-getF90() { tc-getPROG F90 gfortran "$@"; }
-# Returns the name of the fortran compiler
+# @FUNCTION: tc-getFORTRAN
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the Fortran compiler
tc-getFORTRAN() { tc-getPROG FORTRAN gfortran "$@"; }
-# Returns the name of the java compiler
+# @FUNCTION: tc-getGCJ
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the java compiler
tc-getGCJ() { tc-getPROG GCJ gcj "$@"; }
-# Returns the name of the C compiler for build
+# @FUNCTION: tc-getBUILD_CC
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C compiler for building binaries to run on the build machine
tc-getBUILD_CC() {
local v
for v in CC_FOR_BUILD BUILD_CC HOSTCC ; do
@@ -79,7 +113,10 @@ tc-getBUILD_CC() {
echo "${search}"
}
-# Quick way to export a bunch of vars at once
+# @FUNCTION: tc-export
+# @USAGE: <list of toolchain variables>
+# @DESCRIPTION:
+# Quick way to export a bunch of compiler vars at once.
tc-export() {
local var
for var in "$@" ; do
@@ -87,16 +124,21 @@ tc-export() {
done
}
-# A simple way to see if we're using a cross-compiler ...
+# @FUNCTION: tc-is-cross-compiler
+# @RETURN: Shell true if we are using a cross-compiler, shell false otherwise
tc-is-cross-compiler() {
return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]])
}
+# @FUNCTION: tc-is-softfloat
+# @DESCRIPTION:
# See if this toolchain is a softfloat based one.
+# @CODE
# The possible return values:
# - only: the target is always softfloat (never had fpu)
# - yes: the target should support softfloat
# - no: the target should support hardfloat
+# @CODE
# This allows us to react differently where packages accept
# softfloat flags in the case where support is optional, but
# rejects softfloat flags where the target always lacks an fpu.
@@ -124,6 +166,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
case ${host} in
alpha*) echo alpha;;
arm*) echo arm;;
+ avr*) ninj avr32 avr;;
bfin*) ninj blackfin bfin;;
cris*) echo cris;;
hppa*) ninj parisc hppa;;
@@ -163,36 +206,78 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
;;
vax*) echo vax;;
x86_64*) ninj x86_64 amd64;;
- *) echo ${ARCH};;
+
+ # since our usage of tc-arch is largely concerned with
+ # normalizing inputs for testing ${CTARGET}, let's filter
+ # other cross targets (mingw and such) into the unknown.
+ *) echo unknown;;
esac
}
+# @FUNCTION: tc-arch-kernel
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the kernel arch according to the compiler target
tc-arch-kernel() {
- tc-ninja_magic_to_arch kern $@
+ tc-ninja_magic_to_arch kern "$@"
}
+# @FUNCTION: tc-arch
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the portage arch according to the compiler target
tc-arch() {
- tc-ninja_magic_to_arch portage $@
+ tc-ninja_magic_to_arch portage "$@"
}
-# Returns the version as by `$CC -dumpversion`
+tc-endian() {
+ local host=$1
+ [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
+ host=${host%%-*}
+
+ case ${host} in
+ alpha*) echo big;;
+ arm*b*) echo big;;
+ arm*) echo little;;
+ cris*) echo little;;
+ hppa*) echo big;;
+ i?86*) echo little;;
+ ia64*) echo little;;
+ m68*) echo big;;
+ mips*l*) echo little;;
+ mips*) echo big;;
+ powerpc*) echo big;;
+ s390*) echo big;;
+ sh*b*) echo big;;
+ sh*) echo little;;
+ sparc*) echo big;;
+ x86_64*) echo little;;
+ *) echo wtf;;
+ esac
+}
+
+# @FUNCTION: gcc-fullversion
+# @RETURN: compiler version (major.minor.micro: [3.4.6])
gcc-fullversion() {
$(tc-getCC "$@") -dumpversion
}
-# Returns the version, but only the <major>.<minor>
+# @FUNCTION: gcc-version
+# @RETURN: compiler version (major.minor: [3.4].6)
gcc-version() {
gcc-fullversion "$@" | cut -f1,2 -d.
}
-# Returns the Major version
+# @FUNCTION: gcc-major-version
+# @RETURN: major compiler version (major: [3].4.6)
gcc-major-version() {
gcc-version "$@" | cut -f1 -d.
}
-# Returns the Minor version
+# @FUNCTION: gcc-minor-version
+# @RETURN: minor compiler version (minor: 3.[4].6)
gcc-minor-version() {
gcc-version "$@" | cut -f2 -d.
}
-# Returns the Micro version
+# @FUNCTION: gcc-micro-version
+# @RETURN: micro compiler version (micro: 3.4.[6])
gcc-micro-version() {
gcc-fullversion "$@" | cut -f3 -d. | cut -f1 -d-
}
+
# Returns the installation directory - internal toolchain
# function for use by _gcc-specs-exists (for flag-o-matic).
_gcc-install-dir() {
@@ -278,22 +363,21 @@ gcc-specs-ssp-to-all() {
}
+# @FUNCTION: gen_usr_ldscript
+# @USAGE: <list of libs to create linker scripts for>
+# @DESCRIPTION:
# This function generate linker scripts in /usr/lib for dynamic
# libs in /lib. This is to fix linking problems when you have
# the .so in /lib, and the .a in /usr/lib. What happens is that
# in some cases when linking dynamic, the .a in /usr/lib is used
# instead of the .so in /lib due to gcc/libtool tweaking ld's
-# library search path. This cause many builds to fail.
+# library search path. This causes many builds to fail.
# See bug #4411 for more info.
#
-# To use, simply call:
-#
-# gen_usr_ldscript libfoo.so
-#
# Note that you should in general use the unversioned name of
-# the library, as ldconfig should usually update it correctly
-# to point to the latest version of the library present.
-_tc_gen_usr_ldscript() {
+# the library (libfoo.so), as ldconfig should usually update it
+# correctly to point to the latest version of the library present.
+gen_usr_ldscript() {
local lib libdir=$(get_libdir) output_format=""
# Just make sure it exists
dodir /usr/${libdir}
@@ -325,4 +409,3 @@ _tc_gen_usr_ldscript() {
fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"
done
}
-gen_usr_ldscript() { _tc_gen_usr_ldscript "$@" ; }
diff --git a/hardened/toolchain/branches/pieworld/eclass/toolchain.eclass b/hardened/toolchain/branches/pieworld/eclass/toolchain.eclass
index b4152b8..92543d7 100644
--- a/hardened/toolchain/branches/pieworld/eclass/toolchain.eclass
+++ b/hardened/toolchain/branches/pieworld/eclass/toolchain.eclass
@@ -1,12 +1,12 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.334 2007/05/19 03:16:40 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.339 2007/07/20 04:59:51 vapier Exp $
#
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
HOMEPAGE="http://gcc.gnu.org/"
LICENSE="GPL-2 LGPL-2.1"
-RESTRICT="nostrip" # cross-compilers need controlled stripping
+RESTRICT="strip" # cross-compilers need controlled stripping
#---->> eclass stuff <<----
inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails
@@ -1016,6 +1016,7 @@ gcc-library_src_unpack() {
:
}
guess_patch_type_in_dir() {
+ release_version="${release_version} p${PATCH_VER}"
[[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
&& EPATCH_SUFFIX="patch.bz2" \
|| EPATCH_SUFFIX="patch"
@@ -1056,7 +1057,6 @@ do_gcc_rename_java_bins() {
}
gcc_src_unpack() {
local release_version="Gentoo ${GCC_PVR}"
-
[[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
gcc_quick_unpack
@@ -1184,7 +1184,11 @@ gcc-compiler-configure() {
fi
if tc_version_is_at_least "4.0" ; then
- confgcc="${confgcc} $(use_enable mudflap libmudflap)"
+ if has mudflap ${IUSE} ; then
+ confgcc="${confgcc} $(use_enable mudflap libmudflap)"
+ else
+ confgcc="${confgcc} --disable-libmudflap"
+ fi
if want_libssp ; then
confgcc="${confgcc} --enable-libssp"
@@ -1206,16 +1210,21 @@ gcc-compiler-configure() {
case $(tc-arch) in
# Add --with-abi flags to set default MIPS ABI
mips)
- local mips_abi=""
- use n64 && mips_abi="--with-abi=64"
- use n32 && mips_abi="--with-abi=n32"
- [[ -n ${mips_abi} ]] && confgcc="${confgcc} ${mips_abi}"
- ;;
+ local mips_abi=""
+ use n64 && mips_abi="--with-abi=64"
+ use n32 && mips_abi="--with-abi=n32"
+ [[ -n ${mips_abi} ]] && confgcc="${confgcc} ${mips_abi}"
+ ;;
+ # Default arch for x86 is normally i386, lets give it a bump
+ # since glibc will do so based on CTARGET anyways
+ x86)
+ confgcc="${confgcc} --with-arch=${CTARGET%%-*}"
+ ;;
# Enable sjlj exceptions for backward compatibility on hppa
hppa)
[[ ${GCC_PV:0:1} == "3" ]] && \
confgcc="${confgcc} --enable-sjlj-exceptions"
- ;;
+ ;;
esac
GCC_LANG="c"