aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim 'max_posedon' Melnikau <maxposedon@gmail.com>2009-05-10 23:55:51 +0000
committerMaksim 'max_posedon' Melnikau <maxposedon@gmail.com>2009-05-10 23:55:51 +0000
commit9a1ac9112c4fdaa68d1dcd03e149a1edce83fa9b (patch)
tree3d34a23d1734e6c04c6c0ec38875ea6bafbd9b1b /sys-devel
parentEven more dependencies... (diff)
downloadembedded-cross-9a1ac9112c4fdaa68d1dcd03e149a1edce83fa9b.tar.gz
embedded-cross-9a1ac9112c4fdaa68d1dcd03e149a1edce83fa9b.tar.bz2
embedded-cross-9a1ac9112c4fdaa68d1dcd03e149a1edce83fa9b.zip
gcc-4.4.0 with fixed softfloat patch
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/gcc/Manifest24
-rw-r--r--sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch89
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk314
-rw-r--r--sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la330
-rw-r--r--sys-devel/gcc/files/awk/scanforssp.awk225
-rwxr-xr-xsys-devel/gcc/files/c8920
-rwxr-xr-xsys-devel/gcc/files/c9921
-rw-r--r--sys-devel/gcc/files/fix_libtool_files.sh72
-rw-r--r--sys-devel/gcc/files/gcc-configure-LANG.patch64
-rw-r--r--sys-devel/gcc/files/gcc-configure-texinfo.patch16
-rw-r--r--sys-devel/gcc/files/gcc-spec-env.patch41
-rwxr-xr-xsys-devel/gcc/files/mkinfodir233
-rw-r--r--sys-devel/gcc/files/pro-police-docs.patch74
-rw-r--r--sys-devel/gcc/files/scan_libgcc_linked_ssp.sh42
-rw-r--r--sys-devel/gcc/files/stubs/gcc-3.3-htb-stub.patch59
-rw-r--r--sys-devel/gcc/files/stubs/gcc-3.3-ssp-stub.patch45
-rw-r--r--sys-devel/gcc/files/stubs/gcc-3.4-htb-stub.patch32
-rw-r--r--sys-devel/gcc/files/stubs/gcc-3.4-ssp-stub.patch44
-rw-r--r--sys-devel/gcc/files/stubs/gcc-4.0-htb-stub.patch32
-rw-r--r--sys-devel/gcc/files/stubs/gcc-4.0-ssp-stub.patch44
-rw-r--r--sys-devel/gcc/gcc-4.4.0.ebuild81
21 files changed, 1902 insertions, 0 deletions
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
new file mode 100644
index 0000000..66414f3
--- /dev/null
+++ b/sys-devel/gcc/Manifest
@@ -0,0 +1,24 @@
+AUX 4.4.0/gcc-4.4.0-softfloat.patch 2833 RMD160 3f6d8e13047cca3b3e5ede47e79d996f59290fbd SHA1 a72b456736485821d3579dd455941d3379af0057 SHA256 ddb7b8d9770f64a32096a32c4f5ad2571ffcafe617991b492e7eee823878c4fc
+AUX awk/fixlafiles.awk 7807 RMD160 749402c9c0a0f1e8755067c0e001f69d73edb09f SHA1 5fc91ce11eb93e989ae64470dba602fe534ac409 SHA256 3cae4890a295adef50c6cf8a7e14d1be4e7a2356479c073e5c29433c3cdf9c5c
+AUX awk/fixlafiles.awk-no_gcc_la 8556 RMD160 3afa96dbd24f15184fb3bef51c42244d2deba3c1 SHA1 f508fff289aa4d61857e00a6f8391ff4ecfa6e8b SHA256 0f425f8247e532eefd1ef909752d22607505e7c30df15cf40365e1171262eecd
+AUX awk/scanforssp.awk 5830 RMD160 43a8c09e4e16d9a78ab4d6263e74a1850f12eb9b SHA1 1d2756f5e75532a7068357404c39081a3c9d9a68 SHA256 236a2a7eea1ba540ca3be82b0fe2cdefd9ac76b061440918ffe52664edbbb98a
+AUX c89 412 RMD160 2b54e526a76ff0b2e0e8f4f7f9d6949ac45806fa SHA1 6f6ed5affc4ae906c5d8cbdda557d5bbf683d861 SHA256 29ad5dd697135c2892067e780447894dc1cd071708157e46d21773ab99c5022c
+AUX c99 446 RMD160 04ecc9ef9b7a1fd525768955ff6a67fc0d5a17f7 SHA1 312b3b47490d9f62656706908112f9331bc509a4 SHA256 057b348cf5be9b4fb9db99a4549f6433c89d21e5f91dc5e46b0b4dc6b70432f5
+AUX fix_libtool_files.sh 1735 RMD160 5035cd4a9995ea6207a8de95815921c3939395bd SHA1 57cd1babab4c6b142dd8cc58b36943442ff2af13 SHA256 b8d86b1db9453dff4c62b3467887bf1e04ecb483120185102122bda2581ed3f5
+AUX gcc-configure-LANG.patch 2052 RMD160 91f5b90600dfccb10c4e2308a5a1485275fdfeee SHA1 56ecd1d6f2e4bd0b35ac108be72a4f6f60212c38 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b
+AUX gcc-configure-texinfo.patch 337 RMD160 d0e872a9f0ccb5ab51d10f129acd7a19d76a7b75 SHA1 7e267fac540175ce848e563539db8c951cab557b SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98
+AUX gcc-spec-env.patch 1478 RMD160 c3b9071296dbb7a37901714ef4db75bf04211381 SHA1 1f3cd57bab7187947d244ca843b7bd485f72c633 SHA256 167f2a1994c51c1c82d62943fb214f13540859dc89fe578632f3b60daf79c289
+AUX mkinfodir 7324 RMD160 96bbe8860ae8c0a50db42fea01cc1c2216bd36c8 SHA1 3b8316da1a0fa94943e6b71be709827563af7058 SHA256 0565353e767e253207adb8b5c9be9ba215a628447e075a4dc7bb3183ed099d2a
+AUX pro-police-docs.patch 3287 RMD160 eef412d92bed145db05bffa3a3e54e2ba74ee50d SHA1 ca58eda97d80f3d51f4e383ad3053fcb13f7a91b SHA256 ec012aed77285545b9d993cba1bc5fdb402c8dc9a17040f48b8b354746ede627
+AUX scan_libgcc_linked_ssp.sh 885 RMD160 adb1365621b622eb843611f1aaf65ec823555491 SHA1 3027bcdbb1c42f161c3f93e92a18ae96db4d27e7 SHA256 0de8bae299e3333d3bba7af7f85427952f18b906b1a4832232ad15e73a3ddfa2
+AUX stubs/gcc-3.3-htb-stub.patch 2195 RMD160 0b067c3fda6631f2b327c566bdd3b030daa2f0a0 SHA1 8a687b84d5003eca986e03acab83cf8342b898e5 SHA256 36fd59370c87ac60c2fa1e98fc4a43dfc17ad8188d730b8c16fb680e83f7e9c2
+AUX stubs/gcc-3.3-ssp-stub.patch 1735 RMD160 a467bbaeaecc94cb3ef8582a7610c69a94337d2a SHA1 065441d4e986660be0e5586e72a0697098b620a5 SHA256 935863cad4820d7cf35b124efdeafeeab7e67a01da1cef161ef590f18d643beb
+AUX stubs/gcc-3.4-htb-stub.patch 722 RMD160 0769dbc28e18df8e0533d12b0a85fff727556a19 SHA1 ee55a300820330c23c22842ed48e5bd12919534c SHA256 0768dcafc35be6d35c9aa0106b0c8b87932e6b2ec7a82547b8cc7fc9c8b0e1f4
+AUX stubs/gcc-3.4-ssp-stub.patch 1068 RMD160 a72cfd5921084366d8ed93786254c37b3cd782e1 SHA1 84ff7b2dd5dadf996cc6ab7bf13f6e4e95ae85e6 SHA256 259b08fc6ba1a5fcc6848c1a0742e9b90dd43985c61fab4ea2e9e79ec795d982
+AUX stubs/gcc-4.0-htb-stub.patch 722 RMD160 c2f98915d90365d0823721ae6ad80bc6820eef65 SHA1 a1226eb412b98fb02d1bd3a5ab3b8a2a171a55fe SHA256 e9b63d3644c0c10e871d5bd94ceae55bec0726b76e9a7c43c83daf6c840dfb5c
+AUX stubs/gcc-4.0-ssp-stub.patch 1068 RMD160 a72cfd5921084366d8ed93786254c37b3cd782e1 SHA1 84ff7b2dd5dadf996cc6ab7bf13f6e4e95ae85e6 SHA256 259b08fc6ba1a5fcc6848c1a0742e9b90dd43985c61fab4ea2e9e79ec795d982
+DIST ecj-4.3.jar 1377431 RMD160 48fa985f763838bed750aa64a2fa997734438099 SHA1 da254944309a8387aa39323fe7bb7216a4518311 SHA256 9de193ea393ed50d868b730bad6916f7a8ef4ba80216f8606d3e1a0dd886e74b
+DIST gcc-4.4.0-patches-1.0.tar.bz2 11025 RMD160 902aa65dcf284430be336fa014dff6ba65b95fae SHA1 ecb7e9880c8cbb45b7e298513cc7accb2aab7723 SHA256 a8640fc6158dffa010ca47a98535f4aa4a848aae5924dcf3f515fdcc45e2d0c2
+DIST gcc-4.4.0-uclibc-patches-1.0.tar.bz2 2281 RMD160 a3314543c11c23664b7c07a0e73ee53730cd7024 SHA1 fbf2a53e8ec1868bddad7ad8037adbbe9a350e7f SHA256 d483c547357dd4b6de0ad7bc44ec77330caf9ecf97af41a52e49f76af8567709
+DIST gcc-4.4.0.tar.bz2 62708198 RMD160 174989b1b6b35d0c10cfa9eee1b51948bf5c4fb3 SHA1 9215af6beb900ca1eef1d6a40c3dabe990203b25 SHA256 c5fe6f4c62ee7288765c3800ec9d21ad936bdcb5a04374cc09bd5a4232b836c9
+EBUILD gcc-4.4.0.ebuild 2298 RMD160 9c72ad78685022b3ced933a1ca84d698cf8093bc SHA1 fadfcc446da63abd8098ae1e061597c1ca578c82 SHA256 e3c0042f7c87bf93b1fd756346338171d361f2f795c1d25b500cb698b5066022
diff --git a/sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch b/sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch
new file mode 100644
index 0000000..bf8d718
--- /dev/null
+++ b/sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch
@@ -0,0 +1,89 @@
+The hunk for gcc/config/arm/t-linux comes from:
+http://gcc.gnu.org/PR14352
+
+The rest is a custom job by Yuri Vasilevski.
+
+The idea here is that we add soft float support into the spec file
+so that we don't have to worry about packages stripping out softfloat
+flags from CFLAGS/CXXFLAGS.
+
+http://bugs.gentoo.org/75585
+
+--- gcc-4.0.2/gcc/config/arm/elf.h
++++ gcc-4.0.2/gcc/config/arm/elf.h
+@@ -45,8 +45,9 @@
+ #endif
+
+ #ifndef SUBTARGET_ASM_FLOAT_SPEC
+-#define SUBTARGET_ASM_FLOAT_SPEC "\
+-%{mapcs-float:-mfloat}"
++#define SUBTARGET_ASM_FLOAT_SPEC "%{mapcs-float:-mfloat} \
++ %{mhard-float:-mfpu=fpa} \
++ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
+ #endif
+
+ #ifndef ASM_SPEC
+@@ -58,8 +59,6 @@
+ %{mapcs-*:-mapcs-%*} \
+ %(subtarget_asm_float_spec) \
+ %{mthumb-interwork:-mthumb-interwork} \
+-%{msoft-float:-mfloat-abi=soft} %{mhard-float:-mfloat-abi=hard} \
+-%{mfloat-abi=*} %{mfpu=*} \
+ %(subtarget_extra_asm_spec)"
+ #endif
+
+--- gcc-4.0.2/gcc/config/arm/linux-elf.h
++++ gcc-4.0.2/gcc/config/arm/linux-elf.h
+@@ -28,7 +28,7 @@
+ #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
+
+ #undef TARGET_DEFAULT_FLOAT_ABI
+-#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
++#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
+ config.gcc for big endian configurations. */
+@@ -44,6 +44,10 @@
+
+ #undef TARGET_DEFAULT
+ #define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
++#undef SUBTARGET_EXTRA_ASM_SPEC
++#define SUBTARGET_EXTRA_ASM_SPEC "%{mhard-float:-mfpu=fpa} \
++ %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
++
+
+ #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
+
+@@ -51,7 +55,7 @@
+
+ #undef MULTILIB_DEFAULTS
+ #define MULTILIB_DEFAULTS \
+- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
++ { "marm", TARGET_ENDIAN_OPTION, "msoft-float", "mno-thumb-interwork" }
+
+ /* Now we define the strings used to build the spec file. */
+ #undef LIB_SPEC
+@@ -60,7 +64,7 @@
+ %{shared:-lc} \
+ %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
+
+-#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
++#define LIBGCC_SPEC "-lgcc"
+
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+--- gcc-4.0.2/gcc/config/arm/t-linux
++++ gcc-4.0.2/gcc/config/arm/t-linux
+@@ -3,8 +3,10 @@
+ TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
+
+ LIB1ASMSRC = arm/lib1funcs.asm
+-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
+- _arm_addsubdf3 _arm_addsubsf3
++LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
++ _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
++ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
++ _fixsfsi _fixunssfsi _floatdidf _floatdisf
+
+ # MULTILIB_OPTIONS = mhard-float/msoft-float
+ # MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk
new file mode 100644
index 0000000..ffade96
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk
@@ -0,0 +1,314 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.15 2008/02/19 05:47:29 vapier Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+ printf("%s", string)
+}
+function einfo(string) {
+ printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+ printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+ printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+ printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+ printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+# assert that a condition is true. Otherwise exit.
+#
+function assert(condition, string) {
+ if (! condition) {
+ printf("%s:%d: assertion failed: %s\n",
+ FILENAME, FNR, string) > "/dev/stderr"
+ _assert_exit = 1
+ exit 1
+ }
+}
+
+#
+# system(command, return)
+# wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+ ret = 0
+ ret = system(command)
+ if (ret == 0)
+ return 1
+ else
+ return 0
+}
+
+BEGIN {
+ #
+ # Get our variables from environment
+ #
+ OLDVER = ENVIRON["OLDVER"]
+ OLDCHOST = ENVIRON["OLDCHOST"]
+
+ if (OLDVER == "") {
+ eerror("Could not get OLDVER!");
+ exit 1
+ }
+
+ # Setup some sane defaults
+ LIBCOUNT = 2
+ HAVE_GCC34 = 0
+ DIRLIST[1] = "/lib"
+ DIRLIST[2] = "/usr/lib"
+
+ #
+ # Walk /etc/ld.so.conf to discover all our library paths
+ #
+ pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+ while(((pipe) | getline ldsoconf_data) > 0) {
+ if (ldsoconf_data !~ /^[[:space:]]*#/) {
+ if (ldsoconf_data == "") continue
+
+ # Remove any trailing comments
+ sub(/#.*$/, "", ldsoconf_data)
+ # Remove any trailing spaces
+ sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+ # If there's more than one path per line, split
+ # it up as if they were sep lines
+ split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+ # Now add the rest from ld.so.conf
+ for (x in nodes) {
+ # wtf does this line do ?
+ sub(/=.*/, "", nodes[x])
+ # Prune trailing /
+ sub(/\/$/, "", nodes[x])
+
+ if (nodes[x] == "") continue
+
+ #
+ # Drop the directory if its a child directory of
+ # one that was already added ...
+ # For example, if we have:
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+ # We really just want to save /usr/lib /usr/libexec
+ #
+ CHILD = 0
+ for (y in DIRLIST) {
+ if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") {
+ CHILD = 1
+ break
+ }
+ }
+ if (CHILD) continue
+
+ DIRLIST[++LIBCOUNT] = nodes[x]
+ }
+ }
+ }
+ close(pipe)
+
+ #
+ # Get line from gcc's output containing CHOST
+ #
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+ close(pipe)
+
+ # If we fail to get the CHOST, see if we can get the CHOST
+ # portage thinks we are using ...
+ pipe = "/usr/bin/portageq envvar 'CHOST'"
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+ } else {
+ # Check pre gcc-3.4.x versions
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+ if (CHOST == TMP_CHOST || CHOST == "") {
+ # Check gcc-3.4.x or later
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+ if (CHOST == TMP_CHOST || CHOST == "")
+ CHOST = ""
+ else
+ HAVE_GCC34 = 1
+ }
+ }
+ close(pipe)
+
+ if (CHOST == "") {
+ eerror("Could not get gcc's CHOST!")
+ exit 1
+ }
+
+ if (OLDCHOST != "")
+ if (OLDCHOST == CHOST)
+ OLDCHOST = ""
+
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+ if (HAVE_GCC34)
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW
+ else
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+ GCCLIB = GCCLIBPREFIX CHOST
+
+ if (OLDCHOST != "") {
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+ }
+
+ # Get current gcc's version
+ pipe = "gcc -dumpversion"
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+ close(pipe)
+
+ if (NEWVER == "") {
+ eerror("Could not get gcc's version!")
+ exit 1
+ }
+
+ # Nothing to do ?
+ if ((OLDVER == NEWVER) && (OLDCHOST == ""))
+ exit 0
+
+ #
+ # Ok, now let's scan for the .la files and actually fix them up
+ #
+ for (x = 1; x <= LIBCOUNT; x++) {
+ # Do nothing if the target dir is gcc's internal library path
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+ continue
+
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+ while (((pipe) | getline la_files) > 0) {
+
+ # Do nothing if the .la file is located in gcc's internal lib path
+ if (la_files ~ GCCLIBPREFIX_OLD ||
+ la_files ~ GCCLIBPREFIX_NEW)
+ continue
+
+ CHANGED = 0
+ CHOST_CHANGED = 0
+
+ # See if we need to fix the .la file
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+ GCCLIB, la_data) > 0) ||
+ (gsub(OLDGCCLIB2 "[/[:space:]]+",
+ GCCLIB, la_data) > 0)) {
+ CHANGED = 1
+ CHOST_CHANGED = 1
+ }
+ }
+ if (OLDVER != NEWVER) {
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0) ||
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0))
+ CHANGED = 1
+ }
+ }
+ close(la_files)
+
+ # Do the actual changes in a second loop, as we can then
+ # verify that CHOST_CHANGED among things is correct ...
+ if (CHANGED) {
+ ewarnn(" FIXING: " la_files " ...")
+
+ if (CHANGED)
+ printn("[")
+
+ # Clear the temp file (removing rather than '>foo' is better
+ # out of a security point of view?)
+ dosystem("rm -f " la_files ".new")
+
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", la_data)
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ printn("c")
+ la_data = tmpstr
+ }
+
+ if (CHOST_CHANGED > 0) {
+ # We try to be careful about CHOST changes outside
+ # the gcc library path (meaning we cannot match it
+ # via /GCCLIBPREFIX CHOST/) ...
+
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}'
+ #
+ gsub("-L/usr/" OLDCHOST "/",
+ "-L/usr/" CHOST "/", la_data)
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+ #
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+ "\\1/" CHOST "/", "g", la_data)
+ }
+ }
+
+ if (OLDVER != NEWVER) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+ #
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", la_data)
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+ #
+ # in cases where we have gcc34
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ printn("v")
+ la_data = tmpstr
+ }
+ }
+
+ print la_data >> (la_files ".new")
+ }
+
+ if (CHANGED)
+ print "]"
+
+ close(la_files)
+ close(la_files ".new")
+
+ assert(dosystem("mv -f " la_files ".new " la_files),
+ "dosystem(\"mv -f " la_files ".new " la_files "\")")
+ }
+ }
+
+ close(pipe)
+ }
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
new file mode 100644
index 0000000..855b23d
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
@@ -0,0 +1,330 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la,v 1.3 2009/03/31 07:59:19 drizzt Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+ printf("%s", string)
+}
+function einfo(string) {
+ printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+ printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+ printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+ printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+ printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+# assert that a condition is true. Otherwise exit.
+#
+function assert(condition, string) {
+ if (! condition) {
+ printf("%s:%d: assertion failed: %s\n",
+ FILENAME, FNR, string) > "/dev/stderr"
+ _assert_exit = 1
+ exit 1
+ }
+}
+
+#
+# system(command, return)
+# wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+ ret = 0
+ ret = system(command)
+ if (ret == 0)
+ return 1
+ else
+ return 0
+}
+
+BEGIN {
+ #
+ # Get our variables from environment
+ #
+ OLDVER = ENVIRON["OLDVER"]
+ OLDCHOST = ENVIRON["OLDCHOST"]
+
+ if (OLDVER == "") {
+ eerror("Could not get OLDVER!");
+ exit 1
+ }
+
+ # Setup some sane defaults
+ LIBCOUNT = 2
+ HAVE_GCC34 = 0
+ DIRLIST[1] = "/lib"
+ DIRLIST[2] = "/usr/lib"
+
+ #
+ # Walk /etc/ld.so.conf to discover all our library paths
+ #
+ pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+ while(((pipe) | getline ldsoconf_data) > 0) {
+ if (ldsoconf_data !~ /^[[:space:]]*#/) {
+ if (ldsoconf_data == "") continue
+
+ # Remove any trailing comments
+ sub(/#.*$/, "", ldsoconf_data)
+ # Remove any trailing spaces
+ sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+ # If there's more than one path per line, split
+ # it up as if they were sep lines
+ split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+ # Now add the rest from ld.so.conf
+ for (x in nodes) {
+ # wtf does this line do ?
+ sub(/=.*/, "", nodes[x])
+ # Prune trailing /
+ sub(/\/$/, "", nodes[x])
+
+ if (nodes[x] == "") continue
+
+ #
+ # Drop the directory if its a child directory of
+ # one that was already added ...
+ # For example, if we have:
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+ # We really just want to save /usr/lib /usr/libexec
+ #
+ CHILD = 0
+ for (y in DIRLIST) {
+ if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") {
+ CHILD = 1
+ break
+ }
+ }
+ if (CHILD) continue
+
+ DIRLIST[++LIBCOUNT] = nodes[x]
+ }
+ }
+ }
+ close(pipe)
+
+ #
+ # Get line from gcc's output containing CHOST
+ #
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+ close(pipe)
+
+ # If we fail to get the CHOST, see if we can get the CHOST
+ # portage thinks we are using ...
+ pipe = "/usr/bin/portageq envvar 'CHOST'"
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+ } else {
+ # Check pre gcc-3.4.x versions
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+ if (CHOST == TMP_CHOST || CHOST == "") {
+ # Check gcc-3.4.x or later
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+ if (CHOST == TMP_CHOST || CHOST == "")
+ CHOST = ""
+ else
+ HAVE_GCC34 = 1
+ }
+ }
+ close(pipe)
+
+ if (CHOST == "") {
+ eerror("Could not get gcc's CHOST!")
+ exit 1
+ }
+
+ if (OLDCHOST != "")
+ if (OLDCHOST == CHOST)
+ OLDCHOST = ""
+
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+ if (HAVE_GCC34)
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW
+ else
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+ GCCLIB = GCCLIBPREFIX CHOST
+
+ if (OLDCHOST != "") {
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+ }
+
+ # Get current gcc's version
+ pipe = "gcc -dumpversion"
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+ close(pipe)
+
+ if (NEWVER == "") {
+ eerror("Could not get gcc's version!")
+ exit 1
+ }
+
+ # Nothing to do ?
+ # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to
+ # replace libstdc++.la ....
+ if ((OLDVER == "") && (OLDCHOST == ""))
+ exit 0
+
+ #
+ # Ok, now let's scan for the .la files and actually fix them up
+ #
+ for (x = 1; x <= LIBCOUNT; x++) {
+ # Do nothing if the target dir is gcc's internal library path
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+ continue
+
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+ while (((pipe) | getline la_files) > 0) {
+
+ # Do nothing if the .la file is located in gcc's internal lib path
+ if (la_files ~ GCCLIBPREFIX_OLD ||
+ la_files ~ GCCLIBPREFIX_NEW)
+ continue
+
+ CHANGED = 0
+ CHOST_CHANGED = 0
+
+ # See if we need to fix the .la file
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+ GCCLIB, la_data) > 0) ||
+ (gsub(OLDGCCLIB2 "[/[:space:]]+",
+ GCCLIB, la_data) > 0)) {
+ CHANGED = 1
+ CHOST_CHANGED = 1
+ }
+ }
+ if (OLDVER != NEWVER) {
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0) ||
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+ GCCLIB "/" NEWVER, la_data) > 0))
+ CHANGED = 1
+ }
+ # We now check if we have libstdc++.la, as we remove the
+ # libtool linker scripts for gcc ...
+ # We do this last, as we only match the new paths
+ if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+ "-lstdc++", la_data) > 0)
+ CHANGED = 1
+ }
+ close(la_files)
+
+ # Do the actual changes in a second loop, as we can then
+ # verify that CHOST_CHANGED among things is correct ...
+ if (CHANGED) {
+ ewarnn(" FIXING: " la_files " ...[")
+
+ # Clear the temp file (removing rather than '>foo' is better
+ # out of a security point of view?)
+ dosystem("rm -f " la_files ".new")
+
+ while ((getline la_data < (la_files)) > 0) {
+ if (OLDCHOST != "") {
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", la_data)
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+ GCCLIB "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ printn("c")
+ la_data = tmpstr
+ }
+
+ if (CHOST_CHANGED > 0) {
+ # We try to be careful about CHOST changes outside
+ # the gcc library path (meaning we cannot match it
+ # via /GCCLIBPREFIX CHOST/) ...
+
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}'
+ #
+ gsub("-L/usr/" OLDCHOST "/",
+ "-L/usr/" CHOST "/", la_data)
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+ #
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+ "\\1/" CHOST "/", "g", la_data)
+ }
+ }
+
+ if (OLDVER != NEWVER) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+ #
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", la_data)
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+ if (la_data != tmpstr) {
+ # Catch:
+ #
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+ #
+ # in cases where we have gcc34
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+ GCCLIBPREFIX "\\1", "g", tmpstr)
+ printn("v")
+ la_data = tmpstr
+ }
+ }
+
+ # We now check if we have libstdc++.la, as we remove the
+ # libtool linker scripts for gcc and any referencese in any
+ # libtool linker scripts.
+ # We do this last, as we only match the new paths
+ tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+ "-lstdc++", "g", la_data);
+ if (la_data != tmpstr) {
+ printn("l")
+ la_data = tmpstr
+ }
+
+ print la_data >> (la_files ".new")
+ }
+
+ if (CHANGED)
+ print "]"
+
+ close(la_files)
+ close(la_files ".new")
+
+ assert(dosystem("mv -f " la_files ".new " la_files),
+ "dosystem(\"mv -f " la_files ".new " la_files "\")")
+ }
+ }
+
+ close(pipe)
+ }
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/awk/scanforssp.awk b/sys-devel/gcc/files/awk/scanforssp.awk
new file mode 100644
index 0000000..e8a1fe8
--- /dev/null
+++ b/sys-devel/gcc/files/awk/scanforssp.awk
@@ -0,0 +1,225 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Author: Martin Schlemmer <azarah@gentoo.org>
+# Contributor: Ned Ludd <solar@gentoo.org>
+# Contributor: Natanael Copa <nat@c2i.net>
+# Contributor: Carter Smithhart <derheld42@derheld.net>
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/scanforssp.awk,v 1.7 2004/07/15 00:59:02 agriffis Exp $
+
+
+# Does not seem to be used in this script.
+function printn(string)
+{
+ printf("%s", string)
+}
+
+function einfo(string)
+{
+ printf(" %s %s%s", "\033[32;01m*\033[0m", string, "\n")
+}
+
+# Does not seem to be used in this script.
+function einfon(string)
+{
+ printf(" %s %s" , "\033[32;01m*\033[0m", string)
+}
+
+function ewarn(string)
+{
+ printf(" %s %s%s" , "\033[33;01m*\033[0m", string, "\n")
+}
+
+# Does not seem to be used in this script.
+function ewarnn(string)
+{
+ printf("%s %s" , "\032[33;01m*\033[0m", string)
+}
+
+function eerror(string)
+{
+ printf(" %s %s%s" , "\033[31;01m*\033[0m", string, "\n")
+}
+
+ # These are private, else wierd things
+ # might happen ...
+function iself(scan_files, scan_file_pipe, scan_data) {
+ # Can we open() a file and read() 4 bytes?
+ scan_file_pipe = ("head -c 4 " scan_files " 2>/dev/null | tail -c 3")
+ scan_file_pipe | getline scan_data
+ close(scan_file_pipe)
+ return ((scan_data == "ELF") ? 0 : 1)
+}
+
+BEGIN {
+ # Do we have etcat ?
+ pipe = ("which etcat 2>/dev/null")
+ if ((((pipe) | getline etcat_data) > 0) && (etcat_data != ""))
+ auto_etcat = 1
+ else
+ auto_etcat = 0
+
+ # Fix bug that causes script to fail when pipe is not closed. Closes bug #36792
+ close(pipe)
+
+ DIRCOUNT = 0
+ # Add the two default library paths
+ DIRLIST[1] = "/lib"
+ DIRLIST[2] = "/usr/lib"
+
+ # Walk /etc/ld.so.conf line for line and get any library paths
+ pipe = ("cat /etc/ld.so.conf 2>/dev/null | sort")
+ while(((pipe) | getline ldsoconf_data) > 0) {
+
+ if (ldsoconf_data !~ /^[[:space:]]*#/) {
+
+ if (ldsoconf_data == "") continue
+
+ # Remove any trailing comments
+ sub(/#.*$/, "", ldsoconf_data)
+ # Remove any trailing spaces
+ sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+ split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+ # Now add the rest from ld.so.conf
+ for (x in nodes) {
+
+ sub(/=.*/, "", nodes[x])
+ sub(/\/$/, "", nodes[x])
+
+ if (nodes[x] == "") continue
+
+ CHILD = 0
+
+ # Drop the directory if its a child directory of
+ # one that was already added ...
+ for (y in DIRLIST) {
+
+ if (nodes[x] ~ "^" DIRLIST[y]) {
+
+ CHILD = 1
+ break
+ }
+ }
+
+ if (CHILD) continue
+
+ DIRLIST[++DIRCOUNT + 2] = nodes[x]
+ }
+ }
+ }
+
+# We have no guarantee that ld.so.conf have more library paths than
+# the default, and its better scan files only in /lib and /usr/lib
+# than nothing at all ...
+#
+# exit_val = close(pipe)
+# if (exit_val != 0)
+# print(exit_val " - " ERRNO)
+#
+# if (DIRCOUNT == 0) {
+# eerror("Could not read from /etc/ld.so.conf!")
+# exit 1
+# }
+
+ # Correct DIRCOUNT, as we already added /lib and /usr/lib
+ DIRCOUNT += 2
+
+ # Add all the dirs in $PATH
+ split(ENVIRON["PATH"], TMPPATHLIST, ":")
+ count = asort(TMPPATHLIST, PATHLIST)
+ for (x = 1;x <= count;x++) {
+
+ ADDED = 0
+
+ # Already added?
+ for (dnode in DIRLIST)
+ if (PATHLIST[x] == DIRLIST[dnode])
+ ADDED = 1
+
+ if (ADDED)
+ continue
+
+ # Valid? If so, add it ...
+ if (((PATHLIST[x] != "") && (PATHLIST[x] != "/") && (PATHLIST[x] != ".")))
+ DIRLIST[++DIRCOUNT] = PATHLIST[x]
+
+ }
+
+ GCCLIBPREFIX = "/usr/lib/gcc-lib/"
+
+ for (x = 1;x <= DIRCOUNT;x++) {
+
+ # Do nothing if the target dir is gcc's internal library path
+ if (DIRLIST[x] ~ GCCLIBPREFIX) continue
+
+ einfo(" Scanning " ((x <= 9) ? "0"x : x)" of " DIRCOUNT " " DIRLIST[x] "...")
+
+ pipe = ("find " DIRLIST[x] "/ -type f -perm -1 2>/dev/null")
+ while ( (pipe | getline scan_files) > 0) {
+
+ #print scan_files
+ # Do nothing if the file is located in gcc's internal lib path ...
+ if (scan_files ~ GCCLIBPREFIX) continue
+ # Or if its hardend files ...
+ if (scan_files ~ "/lib/libgcc-3" ) continue
+ # Or not a elf image ...
+ if (iself(scan_files)) continue
+
+ scan_file_pipe = ("readelf -s " scan_files " 2>&1")
+ while (((scan_file_pipe) | getline scan_data) > 0) {
+ bad = 0;
+ if (scan_data ~ /__guard@GCC/ || scan_data ~ /__guard@@GCC/) {
+ bad = 1;
+ print
+
+ # 194: 00000000 32 OBJECT GLOBAL DEFAULT UND __guard@GCC_3.0 (3)
+ # 59: 00008ee0 32 OBJECT GLOBAL DEFAULT 22 __guard@@GCC_3.0
+ split(scan_data, scan_data_nodes)
+ ewarn("Found " scan_data_nodes[8] " in " scan_files "!")
+ print
+ }
+ if (scan_data ~ /readelf: Error: Unable to seek/) {
+ bad = 1;
+ print
+ ewarn("Error executing readelf. Bad block? Filesystem error? in " scan_files)
+ print
+ }
+
+ if (bad) {
+
+ if (auto_etcat) {
+
+ # Use etcat that comes with gentoolkit if auto_etcat is true.
+ etcat_pipe = ("etcat belongs " scan_files)
+ (etcat_pipe) | getline etcat_belongs
+
+ while(((etcat_pipe) | getline etcat_belongs) > 0)
+ eerror(etcat_belongs != "" ? "Please emerge '>=" etcat_belongs "'": "")
+ close(etcat_pipe)
+ } else {
+
+ eerror("You need to remerge package that above file belongs to!")
+ eerror("To find out what package it is, please emerge gentoolkit,")
+ eerror("and then run:")
+ print
+ print " # etcat belongs " scan_files
+ }
+
+ print
+
+ close(scan_file_pipe)
+ close(pipe)
+ exit(1)
+ }
+ }
+ close(scan_file_pipe)
+ }
+ close(pipe)
+ }
+
+ exit(0)
+}
+
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89
new file mode 100755
index 0000000..cee0325
--- /dev/null
+++ b/sys-devel/gcc/files/c89
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-2.95):
+# -ansi
+# -std=c89
+# -std=iso9899:1990
+
+for i; do
+ case "$i" in
+ -ansi|-std=c89|-std=iso9899:1990)
+ ;;
+ -std=*)
+ echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i"
+ exit 1
+ ;;
+ esac
+done
+
+exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@"
diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99
new file mode 100755
index 0000000..c954209
--- /dev/null
+++ b/sys-devel/gcc/files/c99
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-3.3):
+# -std=c99
+# -std=c9x
+# -std=iso9899:1999
+# -std=iso9899:199x
+
+for i; do
+ case "$i" in
+ -std=c9[9x]|-std=iso9899:199[9x])
+ ;;
+ -ansi|-std=*)
+ echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i"
+ exit 1
+ ;;
+ esac
+done
+
+exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"}
diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh
new file mode 100644
index 0000000..c3a3c61
--- /dev/null
+++ b/sys-devel/gcc/files/fix_libtool_files.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.14 2007/09/06 11:00:44 uberlord Exp $
+
+usage() {
+cat << "USAGE_END"
+Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
+
+ Where <old-gcc-version> is the version number of the
+ previous gcc version. For example, if you updated to
+ gcc-3.2.1, and you had gcc-3.2 installed, run:
+
+ # fix_libtool_files.sh 3.2
+
+ If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu
+ but you now have CHOST as i686-pc-linux-gnu, run:
+
+ # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
+
+ Note that if only the CHOST and not the version changed, you can run
+ it with the current version and the '--oldarch <old-CHOST>' arguments,
+ and it will do the expected:
+
+ # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
+
+USAGE_END
+ exit 1
+}
+
+if [[ $2 != "--oldarch" && $# -ne 1 ]] || \
+ [[ $2 == "--oldarch" && $# -ne 3 ]]
+then
+ usage
+fi
+
+ARGV1=$1
+ARGV2=$2
+ARGV3=$3
+
+source /etc/profile || exit 1
+source /etc/init.d/functions.sh || exit 1
+
+if [[ ${EUID} -ne 0 ]] ; then
+ eerror "${0##*/}: Must be root."
+ exit 1
+fi
+
+# make sure the files come out sane
+umask 0022
+
+if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then
+ OLDCHOST=${ARGV3}
+else
+ OLDCHOST=
+fi
+
+AWKDIR="/lib/rcscripts/awk"
+
+if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then
+ eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
+ exit 1
+fi
+
+OLDVER=${ARGV1}
+
+export OLDVER OLDCHOST
+
+einfo "Scanning libtool files for hardcoded gcc library paths..."
+gawk -f "${AWKDIR}/fixlafiles.awk"
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch
new file mode 100644
index 0000000..d1b1b03
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-LANG.patch
@@ -0,0 +1,64 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++ eval $as_var=C; export $as_var
++ else
++ unset $as_var
++ fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+ esac
+ done
+
+-# NLS nuisances.
+-# Only set these to C if already set. These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+
++# NLS nuisances.
++for as_var in \
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
++ LC_TELEPHONE LC_TIME
++do
++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++ eval \$as_var=C; export \$as_var
++ else
++ unset \$as_var
++ fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch
new file mode 100644
index 0000000..ddc098d
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- configure
++++ configure
+@@ -3573,6 +3573,6 @@
+ :
+ else
+- MAKEINFO="$MISSING makeinfo"
++ :
+ fi
+ ;;
+
diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch
new file mode 100644
index 0000000..9d5e666
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-spec-env.patch
@@ -0,0 +1,41 @@
+ Add support for external spec file via the GCC_SPECS env var. This
+ allows us to easily control pie/ssp defaults with gcc-config profiles.
+
+ Original patch by Rob Holland. Extended to support multiple
+ entries separated by ':' by Kevin F. Quinn
+
+--- gcc-4/gcc/gcc.c
++++ gcc-4/gcc/gcc.c
+@@ -6482,6 +6482,32 @@
+
+ /* Process any user specified specs in the order given on the command
+ line. */
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating
++ * each spec listed, the string is overwritten at token boundaries
++ * (':') with '\0', an effect of strtok_r().
++ */
++ GET_ENVIRONMENT (specs_file, "GCC_SPECS");
++ if (specs_file && (strlen(specs_file) > 0))
++ {
++ char *spec, *saveptr;
++ for (spec=strtok_r(specs_file,":",&saveptr);
++ spec!=NULL;
++ spec=strtok_r(NULL,":",&saveptr))
++ {
++ struct user_specs *user = (struct user_specs *)
++ xmalloc (sizeof (struct user_specs));
++
++ user->next = (struct user_specs *) 0;
++ user->filename = spec;
++ if (user_specs_tail)
++ user_specs_tail->next = user;
++ else
++ user_specs_head = user;
++ user_specs_tail = user;
++ }
++ }
++#endif
+ for (uptr = user_specs_head; uptr; uptr = uptr->next)
+ {
+ char *filename = find_a_file (&startfile_prefixes, uptr->filename,
diff --git a/sys-devel/gcc/files/mkinfodir b/sys-devel/gcc/files/mkinfodir
new file mode 100755
index 0000000..a62840e
--- /dev/null
+++ b/sys-devel/gcc/files/mkinfodir
@@ -0,0 +1,233 @@
+#!/bin/bash
+# $Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+# Generate the top-level Info node, given a directory of Info files
+# and (optionally) a skeleton file. The output will be suitable for a
+# top-level dir file. The skeleton file contains info topic names in the
+# order they should appear in the output. There are three special
+# lines that alter the behavior: a line consisting of just "--" causes
+# the next line to be echoed verbatim to the output. A line
+# containing just "%%" causes all the remaining filenames (wildcards
+# allowed) in the rest of the file to be ignored. A line containing
+# just "!!" exits the script when reached (unless preceded by a line
+# containing just "--"). Once the script reaches the end of the
+# skeleton file, it goes through the remaining files in the directory
+# in order, putting their entries at the end. The script will use the
+# ENTRY information in each info file if it exists. Otherwise it will
+# make a minimal entry.
+
+# sent by Jeffrey Osier <jeffrey@cygnus.com>, who thinks it came from
+# zoo@winternet.com (david d `zoo' zuhn)
+
+# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to
+# take special flags
+
+INFODIR=$1
+if [ $# = 2 ] ; then
+ SKELETON=$2
+else
+ SKELETON=/dev/null
+fi
+
+skip=
+
+if [ $# -gt 2 ] ; then
+ echo usage: $0 info-directory [ skeleton-file ] 1>&2
+ exit 1
+elif [ -z "${INFODIR}" ] ; then
+ INFODIR="%%DEFAULT_INFO_DIR%%"
+else
+ true
+fi
+
+if [ ! -d ${INFODIR} ] ; then
+ echo "$0: first argument must specify a directory"
+ exit 1
+fi
+
+### output the dir header
+echo "-*- Text -*-"
+echo "This file was generated automatically by $0."
+echo "This version was generated on `date`"
+echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
+
+cat << moobler
+\$Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+This is the file .../info/dir, which contains the topmost node of the
+Info hierarchy. The first time you invoke Info you start off
+looking at that node, which is (dir)Top.
+
+File: dir Node: Top This is the top of the INFO tree
+
+ This (the Directory node) gives a menu of major topics.
+ Typing "q" exits, "?" lists all Info commands, "d" returns here,
+ "h" gives a primer for first-timers,
+ "mEmacs<Return>" visits the Emacs topic, etc.
+
+ In Emacs, you can click mouse button 2 on a menu item or cross reference
+ to select it.
+
+* Menu: The list of major topics begins on the next line.
+
+moobler
+
+### go through the list of files in the skeleton. If an info file
+### exists, grab the ENTRY information from it. If an entry exists
+### use it, otherwise create a minimal dir entry.
+###
+### Then remove that file from the list of existing files. If any
+### additional files remain (ones that don't have a skeleton entry),
+### then generate entries for those in the same way, putting the info for
+### those at the end....
+
+infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*\.gz$' | grep -v '\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')`
+
+# echoing gets clobbered by backquotes; we do it the hard way...
+lines=`wc $SKELETON | awk '{print $1}'`
+line=1
+while [ $lines -ge $line ] ; do
+ # Read one line from the file. This is so that we can echo lines with
+ # whitespace and quoted characters in them.
+ fileline=`awk NR==$line $SKELETON`
+
+ # flag fancy features
+ if [ ! -z "$echoline" ] ; then # echo line
+ echo "$fileline"
+ fileline=
+ echoline=
+ elif [ "${fileline}" = "--" ] ; then # should we echo the next line?
+ echoline=1
+ elif [ "${fileline}" = "%%" ] ; then # eliminate remaining files from dir?
+ skip=1
+ elif [ "${fileline}" = "!!" ] ; then # quit now
+ exit 0
+ fi
+
+ # handle files if they exist
+ for file in $fileline"" ; do # expand wildcards ("" handles blank lines)
+
+ fname=
+
+ if [ -z "$echoline" -a ! -z "$file" ] ; then
+
+ # Find the file to operate upon. Check both possible names.
+ infoname=`echo $file | sed 's/\.gz$//'`
+ infoname=`echo $infoname | sed 's/\.info$//'`
+ noext=
+ ext=
+ if [ -f ${INFODIR}/$infoname ] ; then
+ noext=$infoname
+ fi
+ if [ -f ${INFODIR}/${infoname}.info ] ; then
+ ext=${infoname}.info
+ fi
+ if [ -f ${INFODIR}/${infoname}.info.gz ] ; then
+ ext=${infoname}.info.gz
+ fi
+ # If it exists with both names take what was said in the file.
+ if [ ! -z "$ext" -a ! -z "$noext" ]; then
+ fname=$file
+ warn="### Warning: $ext and $noext both exist! Using ${file}. ###"
+ elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
+ # just take the name if it exists only once
+ fname=${noext}${ext}
+ fi
+
+ # if we found something and aren't skipping, do the entry
+ if [ ! -z "$fname" ] ; then
+ if [ -z "$skip" ] ; then
+
+ if [ ! -z "$warn" ] ; then # issue any warning
+ echo $warn
+ warn=
+ fi
+ if [ "${fname##*.}" = "gz" ] ; then
+ entry=`zcat ${INFODIR}/${fname} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d' `
+ else
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
+ fi
+ if [ ! -z "${entry}" ] ; then
+ echo "${entry}"
+ else
+ echo "* ${infoname}: (${infoname})."
+ fi
+ fi
+
+ # remove the name from the directory listing
+ infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/ / /g"`
+
+ fi
+
+ fi
+
+ done
+
+ line=`expr $line + 1`
+done
+
+if [ -z "${infofiles}" ] ; then
+ exit 0
+elif [ $lines -gt 0 ]; then
+ echo
+fi
+
+# Sort remaining files by INFO-DIR-SECTION.
+prevsect=
+filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
+ fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
+ sort -t: -k2 -k1 | tr ' ' '_')`
+for sectdata in ${filesectdata}; do
+ file=`echo ${sectdata} | cut -d: -f1`
+ section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}`
+ infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/ / /g"`
+
+ if [ "${prevsect}" != "${section}" ] ; then
+ if [ ! -z "${prevsect}" ] ; then
+ echo ""
+ fi
+ echo "${section}"
+ prevsect="${section}"
+ fi
+ infoname=`echo $file | sed 's/\.gz$//'`
+ infoname=`echo $infoname | sed 's/\.info$//'`
+ if [ "${file##*.}" = "gz" ] ; then
+ entry=`zcat ${INFODIR}/$file | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d' `
+ else
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+ fi
+ if [ ! -z "${entry}" ] ; then
+ echo "${entry}"
+ elif [ ! -d "${INFODIR}/${file}" ] ; then
+ echo "* ${infoname}: (${infoname})."
+ fi
+done
+
+# Process miscellaneous files.
+for file in ${infofiles}; do
+ if [ ! -z "${prevsect}" ] ; then
+ echo ""
+ echo "Miscellaneous"
+ prevsect=""
+ fi
+
+ infoname=`echo $file | sed 's/\.gz$//'`
+ infoname=`echo $infoname | sed 's/\.info$//'`
+ if [ "${file##*.}" = "gz" ] ; then
+ entry=`zcat ${INFODIR}/${file} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d'`
+ else
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+ fi
+
+
+ if [ ! -z "${entry}" ] ; then
+ echo "${entry}"
+ elif [ ! -d "${INFODIR}/${file}" ] ; then
+ echo "* ${infoname}: (${infoname})."
+ fi
+done
+
diff --git a/sys-devel/gcc/files/pro-police-docs.patch b/sys-devel/gcc/files/pro-police-docs.patch
new file mode 100644
index 0000000..091ea44
--- /dev/null
+++ b/sys-devel/gcc/files/pro-police-docs.patch
@@ -0,0 +1,74 @@
+Index: gcc/doc/invoke.texi
+===================================================================
+RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
+retrieving revision 1.364
+diff -c -3 -p -r1.364 invoke.texi
+*** gcc/doc/invoke.texi 21 Nov 2003 11:42:58 -0000 1.364
+--- gcc/doc/invoke.texi 22 Nov 2003 08:12:35 -0000
+*************** in the following sections.
+*** 228,234 ****
+ -Wno-multichar -Wnonnull -Wpacked -Wpadded @gol
+ -Wparentheses -Wpointer-arith -Wredundant-decls @gol
+ -Wreturn-type -Wsequence-point -Wshadow @gol
+! -Wsign-compare -Wstrict-aliasing @gol
+ -Wswitch -Wswitch-default -Wswitch-enum @gol
+ -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
+ -Wunknown-pragmas -Wunreachable-code @gol
+--- 228,234 ----
+ -Wno-multichar -Wnonnull -Wpacked -Wpadded @gol
+ -Wparentheses -Wpointer-arith -Wredundant-decls @gol
+ -Wreturn-type -Wsequence-point -Wshadow @gol
+! -Wsign-compare -Wstack-protector -Wstrict-aliasing @gol
+ -Wswitch -Wswitch-default -Wswitch-enum @gol
+ -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
+ -Wunknown-pragmas -Wunreachable-code @gol
+*************** in the following sections.
+*** 681,686 ****
+--- 681,687 ----
+ -fshort-double -fshort-wchar @gol
+ -fverbose-asm -fpack-struct -fstack-check @gol
+ -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
++ -fstack-protector -fstack-protector-all @gol
+ -fargument-alias -fargument-noalias @gol
+ -fargument-noalias-global -fleading-underscore @gol
+ -ftls-model=@var{model} @gol
+*************** effectively. Often, the problem is that
+*** 3014,3019 ****
+--- 3015,3024 ----
+ complex; GCC will refuse to optimize programs when the optimization
+ itself is likely to take inordinate amounts of time.
+
++ @item -Wstack-protector
++ @opindex Wstack-protector
++ Warn when not issuing stack smashing protection for some reason
++
+ @item -Werror
+ @opindex Werror
+ Make all warnings into errors.
+*************** and grows downwards, you can use the fla
+*** 11474,11479 ****
+--- 11479,11502 ----
+ @option{-fstack-limit-symbol=__stack_limit} and
+ @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
+ of 128KB@. Note that this may only work with the GNU linker.
++
++ @item -fstack-protector
++ @item -fstack-protector-all
++ @opindex fstack-protector
++ @opindex fstack-protector-all
++ @opindex fno-stack-protector
++ Generate code to protect an application from a stack smashing
++ attack. The features are (1) the insertion of random value next to the
++ frame pointer to detect the integrity of the stack, (2) the reordering
++ of local variables to place buffers after pointers to avoid the
++ corruption of pointers that could be used to further corrupt arbitrary
++ memory locations, (3) the copying of pointers in function arguments to
++ an area preceding local variable buffers to prevent the corruption of
++ pointers that could be used to further corrupt arbitrary memory
++ locations, and the (4) omission of instrumentation code from some
++ functions to decrease the performance overhead. If the integrity
++ would be broken, the program is aborted. If no-stack-protector is
++ specified, instrumentation codes are generated at every functions.
+
+ @cindex aliasing of parameters
+ @cindex parameters, aliased
diff --git a/sys-devel/gcc/files/scan_libgcc_linked_ssp.sh b/sys-devel/gcc/files/scan_libgcc_linked_ssp.sh
new file mode 100644
index 0000000..35119e5
--- /dev/null
+++ b/sys-devel/gcc/files/scan_libgcc_linked_ssp.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Author: Martin Schlemmer <azarah@gentoo.org>
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/scan_libgcc_linked_ssp.sh,v 1.4 2007/05/05 05:13:15 vapier Exp $
+
+usage() {
+cat << "USAGE_END"
+Usage: can_libgcc_linked_ssp.sh
+
+ This scans the system for files that contains the __guard symbol, that was
+ linked against libgcc.
+
+
+USAGE_END
+
+ exit 1
+}
+
+if [ "$#" -ne 0 ]
+then
+ usage
+fi
+
+source /etc/profile || exit 1
+source /etc/init.d/functions.sh || exit 1
+
+AWKDIR="$(portageq envvar PORTDIR)/sys-devel/gcc/files/awk"
+
+if [ ! -r "${AWKDIR}/scanforssp.awk" ]
+then
+ eerror "${0##*/}: ${AWKDIR}/scanforssp.awk does not exist!"
+ exit 1
+fi
+
+einfo "Scanning system for __guard@GCC symbols..."
+/bin/gawk -f "${AWKDIR}/scanforssp.awk"
+
+exit $?
+
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/stubs/gcc-3.3-htb-stub.patch b/sys-devel/gcc/files/stubs/gcc-3.3-htb-stub.patch
new file mode 100644
index 0000000..f6d8104
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-3.3-htb-stub.patch
@@ -0,0 +1,59 @@
+--- gcc-3.3.6/gcc/c-opts.c
++++ gcc-3.3.6/gcc/c-opts.c
+@@ -193,6 +193,8 @@ static void sanitize_cpp_opts PARAMS ((v
+ OPT("fall-virtual", CL_CXX, OPT_fall_virtual) \
+ OPT("falt-external-templates",CL_CXX, OPT_falt_external_templates) \
+ OPT("fasm", CL_ALL, OPT_fasm) \
++ OPT("fbc-strings-only", CL_ALL, OPT_fbc_strings_only) \
++ OPT("fbounds-checking", CL_ALL, OPT_fbounds_checking) \
+ OPT("fbuiltin", CL_ALL, OPT_fbuiltin) \
+ OPT("fbuiltin-", CL_ALL | CL_JOINED, OPT_fbuiltin_) \
+ OPT("fcheck-new", CL_CXX, OPT_fcheck_new) \
+@@ -1037,6 +1039,11 @@ c_common_decode_option (argc, argv)
+ flag_no_asm = !on;
+ break;
+
++ case OPT_fbounds_checking:
++ case OPT_fbc_strings_only:
++ warning ("htb stub: bounds checking is not supported");
++ break;
++
+ case OPT_fbuiltin:
+ flag_no_builtin = !on;
+ break;
+--- gcc-3.3.6/gcc/cp/lang-options.h
++++ gcc-3.3.6/gcc/cp/lang-options.h
+@@ -32,6 +32,8 @@ DEFINE_LANG_NAME ("C++")
+ { "-fno-alt-external-templates", "" },
+ { "-fansi-overloading", "" },
+ { "-fno-ansi-overloading", "" },
++ { "-fbounds-checking", "" },
++ { "-fno-bounds-checking", "" },
+ { "-fcheck-new",
+ N_("Check the return value of new") },
+ { "-fno-check-new", "" },
+@@ -117,6 +119,9 @@ DEFINE_LANG_NAME ("C++")
+ { "-fxref",
+ N_("Emit cross referencing information") },
+ { "-fno-xref", "" },
++ { "-fbounds-checking",
++ N_("Generate array and pointer bounds checking code") },
++ { "-fno-bounds-checking", "" },
+
+ { "-Wreturn-type",
+ N_("Warn about inconsistent return types") },
+--- gcc-3.3.6/gcc/toplev.c
++++ gcc-3.3.6/gcc/toplev.c
+@@ -1249,6 +1267,12 @@ documented_lang_options[] =
+ { "-fshort-wchar",
+ N_("Override the underlying type for wchar_t to `unsigned short'") },
+ { "-fno-short-wchar", "" },
++ { "-fbounds-checking",
++ N_("Generate array and pointer bounds checking code") },
++ { "-fno-bounds-checking", "" },
++ { "-fbc-strings-only",
++ N_("Restrict bounds checking to strings only") },
++ { "-fno-bc-strings-only", "" },
+
+ { "-Wall",
+ N_("Enable most warning messages") },
diff --git a/sys-devel/gcc/files/stubs/gcc-3.3-ssp-stub.patch b/sys-devel/gcc/files/stubs/gcc-3.3-ssp-stub.patch
new file mode 100644
index 0000000..ed996e7
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-3.3-ssp-stub.patch
@@ -0,0 +1,45 @@
+--- gcc-3.3.6/gcc/toplev.c
++++ gcc-3.3.6/gcc/toplev.c
+@@ -904,6 +904,10 @@ int align_functions_log;
+ minimum function alignment. Zero means no alignment is forced. */
+ int force_align_functions_log;
+
++int flag_propolice_protection = 0;
++int flag_stack_protection = 0;
++int warn_stack_protector = 0;
++
+ /* Table of supported debugging formats. */
+ static const struct
+ {
+@@ -1188,6 +1197,10 @@ static const lang_independent_options f_
+ N_("Trap for signed overflow in addition / subtraction / multiplication") },
+ { "new-ra", &flag_new_regalloc, 1,
+ N_("Use graph coloring register allocation.") },
++ {"stack-protector", &flag_propolice_protection, 1,
++ N_("Enables stack protection") },
++ {"stack-protector-all", &flag_stack_protection, 1,
++ N_("Enables stack protection of every function") } ,
+ };
+
+ /* Table of language-specific options. */
+@@ -1547,7 +1560,9 @@ static const lang_independent_options W_
+ {"missing-noreturn", &warn_missing_noreturn, 1,
+ N_("Warn about functions which might be candidates for attribute noreturn") },
+ {"strict-aliasing", &warn_strict_aliasing, 1,
+- N_ ("Warn about code which might break the strict aliasing rules") }
++ N_ ("Warn about code which might break the strict aliasing rules") },
++ {"stack-protector", &warn_stack_protector, 1,
++ N_("Warn when disabling stack protector for some reason")}
+ };
+
+ void
+@@ -5230,6 +5247,9 @@ process_options ()
+ /* The presence of IEEE signaling NaNs, implies all math can trap. */
+ if (flag_signaling_nans)
+ flag_trapping_math = 1;
++
++ if (flag_stack_protection || flag_propolice_protection)
++ warning ("ssp stub: stack protector is not supported");
+ }
+
+ /* Initialize the compiler back end. */
diff --git a/sys-devel/gcc/files/stubs/gcc-3.4-htb-stub.patch b/sys-devel/gcc/files/stubs/gcc-3.4-htb-stub.patch
new file mode 100644
index 0000000..2be61a2
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-3.4-htb-stub.patch
@@ -0,0 +1,32 @@
+--- gcc-3.4.4/gcc/c.opt
++++ gcc-3.4.4/gcc/c.opt
+@@ -426,6 +426,14 @@ fasm
+ C ObjC C++ ObjC++
+ Recognize the \"asm\" keyword
+
++fbounds-checking
++C
++Generate code to check bounds before indexing arrays
++
++fbc-strings-only
++C
++Restrict bounds checking to strings only
++
+ fbuiltin
+ C ObjC C++ ObjC++
+ Recognize built-in functions
+--- gcc-3.4.4/gcc/c-opts.c
++++ gcc-3.4.4/gcc/c-opts.c
+@@ -708,6 +708,12 @@ c_common_handle_option (size_t scode, co
+ flag_no_asm = !value;
+ break;
+
++ case OPT_fbounds_checking:
++ case OPT_fbc_strings_only:
++ if (value)
++ warning ("htb stub: bounds checking is not supported");
++ break;
++
+ case OPT_fbuiltin:
+ flag_no_builtin = !value;
+ break;
diff --git a/sys-devel/gcc/files/stubs/gcc-3.4-ssp-stub.patch b/sys-devel/gcc/files/stubs/gcc-3.4-ssp-stub.patch
new file mode 100644
index 0000000..3f620f3
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-3.4-ssp-stub.patch
@@ -0,0 +1,44 @@
+--- gcc-3.4.3/gcc/common.opt
++++ gcc-3.4.3/gcc/common.opt
+@@ -152,6 +152,10 @@ Wunused-variable
+ Common
+ Warn when a variable is unused
+
++Wstack-protector
++Common
++Warn when not issuing stack smashing protection for some reason
++
+ aux-info
+ Common Separate
+ -aux-info <file> Emit declaration information into <file>
+@@ -743,6 +747,14 @@ fzero-initialized-in-bss
+ Common
+ Put zero initialized data in the bss section
+
++fstack-protector
++Common
++Enables stack protection
++
++fstack-protector-all
++Common
++Enables stack protection of every function
++
+ g
+ Common JoinedOrMissing
+ Generate debug information in default format
+--- gcc-3.4.3/gcc/opts.c
++++ gcc-3.4.3/gcc/opts.c
+@@ -804,6 +807,13 @@ common_handle_option (size_t scode, cons
+ warn_unused_variable = value;
+ break;
+
++ case OPT_fstack_protector:
++ case OPT_fstack_protector_all:
++ case OPT_Wstack_protector:
++ if (value)
++ warning ("ssp stub: stack protector is not supported");
++ break;
++
+ case OPT_aux_info:
+ case OPT_aux_info_:
+ aux_info_file_name = arg;
diff --git a/sys-devel/gcc/files/stubs/gcc-4.0-htb-stub.patch b/sys-devel/gcc/files/stubs/gcc-4.0-htb-stub.patch
new file mode 100644
index 0000000..4a515c5
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-4.0-htb-stub.patch
@@ -0,0 +1,32 @@
+--- gcc-4.0.0/gcc/c.opt
++++ gcc-4.0.0/gcc/c.opt
+@@ -457,6 +457,14 @@ fasm
+ C ObjC C++ ObjC++
+ Recognize the \"asm\" keyword
+
++fbounds-checking
++C
++Generate code to check bounds before indexing arrays
++
++fbc-strings-only
++C
++Restrict bounds checking to strings only
++
+ fbuiltin
+ C ObjC C++ ObjC++
+ Recognize built-in functions
+--- gcc-4.0.0/gcc/c-opts.c
++++ gcc-4.0.0/gcc/c-opts.c
+@@ -548,6 +549,12 @@ c_common_handle_option (size_t scode, co
+ flag_no_asm = !value;
+ break;
+
++ case OPT_fbc_strings_only:
++ case OPT_fbounds_checking:
++ if (value)
++ warning ("htb stub: bounds checking is not supported");
++ break;
++
+ case OPT_fbuiltin:
+ flag_no_builtin = !value;
+ break;
diff --git a/sys-devel/gcc/files/stubs/gcc-4.0-ssp-stub.patch b/sys-devel/gcc/files/stubs/gcc-4.0-ssp-stub.patch
new file mode 100644
index 0000000..3f620f3
--- /dev/null
+++ b/sys-devel/gcc/files/stubs/gcc-4.0-ssp-stub.patch
@@ -0,0 +1,44 @@
+--- gcc-3.4.3/gcc/common.opt
++++ gcc-3.4.3/gcc/common.opt
+@@ -152,6 +152,10 @@ Wunused-variable
+ Common
+ Warn when a variable is unused
+
++Wstack-protector
++Common
++Warn when not issuing stack smashing protection for some reason
++
+ aux-info
+ Common Separate
+ -aux-info <file> Emit declaration information into <file>
+@@ -743,6 +747,14 @@ fzero-initialized-in-bss
+ Common
+ Put zero initialized data in the bss section
+
++fstack-protector
++Common
++Enables stack protection
++
++fstack-protector-all
++Common
++Enables stack protection of every function
++
+ g
+ Common JoinedOrMissing
+ Generate debug information in default format
+--- gcc-3.4.3/gcc/opts.c
++++ gcc-3.4.3/gcc/opts.c
+@@ -804,6 +807,13 @@ common_handle_option (size_t scode, cons
+ warn_unused_variable = value;
+ break;
+
++ case OPT_fstack_protector:
++ case OPT_fstack_protector_all:
++ case OPT_Wstack_protector:
++ if (value)
++ warning ("ssp stub: stack protector is not supported");
++ break;
++
+ case OPT_aux_info:
+ case OPT_aux_info_:
+ aux_info_file_name = arg;
diff --git a/sys-devel/gcc/gcc-4.4.0.ebuild b/sys-devel/gcc/gcc-4.4.0.ebuild
new file mode 100644
index 0000000..d4c6e1f
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.4.0.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.4.0.ebuild,v 1.3 2009/05/09 21:26:12 halcy0n Exp $
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+ETYPE="gcc-compiler"
+
+# Hardened gcc 4 stuff
+#PIE_VER="10.1.5"
+#SPECS_VER="0.9.4"
+
+# arch/libc configurations known to be stable or untested with {PIE,SSP,FORTIFY}-by-default
+#PIE_GLIBC_STABLE="x86 amd64 ~ppc ~ppc64 ~arm ~sparc"
+#PIE_UCLIBC_STABLE="x86 arm"
+#SSP_STABLE="amd64 x86 ppc ppc64 ~arm ~sparc"
+#SSP_UCLIBC_STABLE=""
+
+# whether we should split out specs files for multiple {PIE,SSP}-by-default
+# and vanilla configurations.
+SPLIT_SPECS=no #${SPLIT_SPECS-true} hard disable until #106690 is fixed
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection. Includes C/C++, java compilers, pie+ssp extensions, Haj Ten Brugge runtime bounds checking"
+
+LICENSE="GPL-3 LGPL-2.1 libgcc libstdc++ gcc-runtime-library-exception-3.1"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+ >=sys-devel/gcc-config-1.4
+ virtual/libiconv
+ >=dev-libs/gmp-4.2.1
+ >=dev-libs/mpfr-2.3
+ graphite? (
+ >=dev-libs/ppl-0.10
+ >=dev-libs/cloog-ppl-0.15
+ )
+ !build? (
+ gcj? (
+ gtk? (
+ x11-libs/libXt
+ x11-libs/libX11
+ x11-libs/libXtst
+ x11-proto/xproto
+ x11-proto/xextproto
+ >=x11-libs/gtk+-2.2
+ x11-libs/pango
+ )
+ >=media-libs/libart_lgpl-2.1
+ app-arch/zip
+ app-arch/unzip
+ )
+ >=sys-libs/ncurses-5.2-r2
+ nls? ( sys-devel/gettext )
+ )"
+DEPEND="${RDEPEND}
+ test? ( sys-devel/autogen dev-util/dejagnu )
+ >=sys-apps/texinfo-4.2-r4
+ >=sys-devel/bison-1.875
+ amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )
+ ppc? ( >=${CATEGORY}/binutils-2.17 )
+ ppc64? ( >=${CATEGORY}/binutils-2.17 )
+ >=${CATEGORY}/binutils-2.15.94"
+PDEPEND=">=sys-devel/gcc-config-1.4"
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_unpack() {
+ gcc_src_unpack
+
+ use vanilla && return 0
+
+ sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+
+ [[ ${CTARGET} == *-softfloat-* ]] && epatch "${FILESDIR}"/4.4.0/gcc-4.4.0-softfloat.patch
+}