aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-11-14 12:17:37 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-11-14 12:17:37 +0000
commit7302771c39779f185af8a4c34f5d8cb2e35aacd4 (patch)
tree3408c8f2efd4312551aca7618ef4079a6f248334
parent5c33ddd595358812dc26437a936e4a1a02e9fc8e (diff)
core/gcc: new aport
-rw-r--r--core/gcc/00_all_gcc-4.0-cvs-incompat.patch11
-rw-r--r--core/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch10
-rw-r--r--core/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch91
-rw-r--r--core/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch384
-rw-r--r--core/gcc/APKBUILD79
-rw-r--r--core/gcc/gcc-4.2.0-cc1-no-stack-protector.patch11
6 files changed, 586 insertions, 0 deletions
diff --git a/core/gcc/00_all_gcc-4.0-cvs-incompat.patch b/core/gcc/00_all_gcc-4.0-cvs-incompat.patch
new file mode 100644
index 00000000000..e5bc302e265
--- /dev/null
+++ b/core/gcc/00_all_gcc-4.0-cvs-incompat.patch
@@ -0,0 +1,11 @@
+--- gcc-4.0.old/gcc/gcc.c.mps Sun Nov 14 21:10:35 2004
++++ gcc-4.0/gcc/gcc.c Sun Nov 14 21:43:17 2004
+@@ -794,6 +794,8 @@
+ /* NB: This is shared amongst all front-ends. */
+ static const char *cc1_options =
+ "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
++ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
++ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
+ %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
+ %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
+ %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\
diff --git a/core/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch b/core/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
new file mode 100644
index 00000000000..88715061957
--- /dev/null
+++ b/core/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
@@ -0,0 +1,10 @@
+--- gcc-4.0.2/gcc/gcc.c.nondef~ 2006-01-09 00:09:50 +0100
++++ gcc-4.0.2/gcc/gcc.c 2006-01-09 00:15:31 +0100
+@@ -764,6 +764,6 @@
+
+ static const char *asm_debug;
+ static const char *cpp_spec = CPP_SPEC;
+-static const char *cc1_spec = CC1_SPEC;
++static const char *cc1_spec = CC1_SPEC CC1_HARDENED_SPEC;
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
diff --git a/core/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch b/core/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch
new file mode 100644
index 00000000000..8bc9a705679
--- /dev/null
+++ b/core/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch
@@ -0,0 +1,91 @@
+diff -Nru /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config.gcc /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config.gcc
+--- gcc-4.3.1/gcc/config.gcc 2008-06-11 04:13:33.000000000 +0200
++++ gcc-4.3.1/gcc/config.gcc 2008-06-11 04:41:39.000000000 +0200
+@@ -493,7 +493,7 @@
+ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+ # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
+- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
++ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o"
+ extra_options="${extra_options} linux.opt"
+ gas=yes
+ gnu_ld=yes
+diff -Nru /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/Makefile.in /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/Makefile.in
+--- gcc-4.3.1/gcc/Makefile.in 2008-06-11 04:13:37.000000000 +0200
++++ gcc-4.3.1/gcc/Makefile.in 2008-06-11 04:42:27.000000000 +0200
+@@ -1665,36 +1665,43 @@
+ # constructors.
+ $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
+ -o $(T)crtbegin$(objext)
+
+ $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+ -c $(srcdir)/crtstuff.c -DCRT_END \
+ -o $(T)crtend$(objext)
+
+ # These are versions of crtbegin and crtend for shared libraries.
+ $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
+ -o $(T)crtbeginS$(objext)
+
+ $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
+ -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
+ -o $(T)crtendS$(objext)
+
+ # This is a version of crtbegin for -static links.
+ $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
+- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
+ -o $(T)crtbeginT$(objext)
+
++# This is a version of crtbegin for -static -fPIE links.
++$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
++ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
++ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \
++ -o $(T)crtbeginTS$(objext)
++
+ # Compile the start modules crt0.o and mcrt0.o that are linked with
+ # every program
+ $(T)crt0.o: s-crt0 ; @true
+diff -Nru /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/libgcc/config.host /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/libgcc/config.host
+--- gcc-4.3.1/libgcc/config.host 2008-01-25 21:49:04.000000000 +0100
++++ gcc-4.3.1/libgcc/config.host 2008-06-11 04:42:09.000000000 +0200
+@@ -164,7 +164,7 @@
+ ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+ # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
+- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
++ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o"
+ ;;
+ *-*-gnu*)
+ ;;
+diff -Nru /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/libgcc/Makefile.in /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/libgcc/Makefile.in
+--- gcc-4.3.1/libgcc/Makefile.in 2008-06-11 04:13:37.000000000 +0200
++++ gcc-4.3.1/libgcc/Makefile.in 2008-06-11 04:42:09.000000000 +0200
+@@ -783,6 +783,11 @@
+ crtbeginT.o: $(gcc_srcdir)/crtstuff.c
+ $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
++
++# This is a version of crtbegin for -static -fPIE links.
++crtbeginTS.o: $(gcc_srcdir)/crtstuff.c
++ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
++ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
+ endif
+
+ # Build extra startfiles in the libgcc directory.
diff --git a/core/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch b/core/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
new file mode 100644
index 00000000000..75b3654c8e0
--- /dev/null
+++ b/core/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
@@ -0,0 +1,384 @@
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/alpha/elf.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/alpha/elf.h
+--- gcc-4.3.1.orig/gcc/config/alpha/elf.h 2007-08-02 12:49:31.000000000 +0200
++++ gcc-4.3.1/gcc/config/alpha/elf.h 2008-06-10 05:50:16.000000000 +0200
+@@ -362,12 +362,12 @@
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
++ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
+@@ -376,9 +376,15 @@
+ `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* We support #pragma. */
+ #define HANDLE_SYSV_PRAGMA 1
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/i386/linux64.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/i386/linux64.h
+--- gcc-4.3.1.orig/gcc/config/i386/linux64.h 2007-08-02 12:49:31.000000000 +0200
++++ gcc-4.3.1/gcc/config/i386/linux64.h 2008-06-10 06:10:18.000000000 +0200
+@@ -76,12 +76,21 @@
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{mpc32:crtprec32.o%s} \
+ %{mpc64:crtprec64.o%s} \
+ %{mpc80:crtprec80.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{mpc32:crtprec32.o%s} \
++ %{mpc64:crtprec64.o%s} \
++ %{mpc80:crtprec80.o%s} \
++ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#endif
+
+ #if TARGET_64BIT_DEFAULT
+ #define MULTILIB_DEFAULTS { "m64" }
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/i386/linux.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/i386/linux.h
+--- gcc-4.3.1/gcc/config/i386/linux.h 2007-11-28 02:04:27.000000000 +0100
++++ gcc-4.3.1/gcc/config/i386/linux.h 2008-06-10 06:11:35.000000000 +0200
+@@ -118,12 +118,21 @@
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{mpc32:crtprec32.o%s} \
++ %{mpc64:crtprec64.o%s} \
++ %{mpc80:crtprec80.o%s} \
++ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#else
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{mpc32:crtprec32.o%s} \
+ %{mpc64:crtprec64.o%s} \
+ %{mpc80:crtprec80.o%s} \
+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* A C statement (sans semicolon) to output to the stdio stream
+ FILE the assembler definition of uninitialized global DECL named
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/ia64/linux.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/ia64/linux.h
+--- gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 06:15:58.000000000 +0200
++++ gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 05:50:16.000000000 +0200
+@@ -22,19 +22,25 @@
+ #undef STARTFILE_SPEC
+ #ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} }\
++ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie)}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Similar to standard Linux, but adding -ffast-math support. */
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* Define this for shared library support because it isn't in the main
+ linux.h file. */
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/linux.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/linux.h
+--- gcc-4.3.1/gcc/config/linux.h 2007-08-02 12:49:31.000000000 +0200
++++ gcc-4.3.1/gcc/config/linux.h 2008-06-10 05:50:16.000000000 +0200
+@@ -40,12 +40,12 @@
+ #undef STARTFILE_SPEC
+ #if defined HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} } \
++ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -55,8 +55,13 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++ "%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #ifndef CC1_SPEC
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/rs6000/linux64.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/rs6000/linux64.h
+--- gcc-4.3.1/gcc/config/rs6000/linux64.h 2007-08-02 12:49:31.000000000 +0200
++++ gcc-4.3.1/gcc/config/rs6000/linux64.h 2008-06-10 05:50:16.000000000 +0200
+@@ -151,7 +151,7 @@
+ #endif
+
+ #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
+-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
++%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \
+ %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-freebsd: -mbig} \
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/rs6000/sysv4.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/rs6000/sysv4.h
+--- gcc-4.3.1/gcc/config/rs6000/sysv4.h 2007-08-08 21:33:24.000000000 +0200
++++ gcc-4.3.1/gcc/config/rs6000/sysv4.h 2008-06-10 05:50:16.000000000 +0200
+@@ -875,19 +875,25 @@
+
+ #ifdef HAVE_LD_PIE
+ #define STARTFILE_LINUX_SPEC "\
+-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
++%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} } \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++%{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
+ #else
+ #define STARTFILE_LINUX_SPEC "\
+ %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+ %{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++%{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_LINUX_SPEC "\
+-%{shared|pie:crtendS.o%s;:crtend.o%s} \
++%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} \
+ %{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#else
++#define ENDFILE_LINUX_SPEC "\
++%{shared:crtendS.o%s;:crtend.o%s} \
++%{mnewlib:ecrtn.o%s;:crtn.o%s}"
++#endif
+
+ #define LINK_START_LINUX_SPEC ""
+
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/sparc/linux64.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/sparc/linux64.h
+--- gcc-4.3.1/gcc/config/sparc/linux64.h 2007-10-19 06:29:38.000000000 +0200
++++ gcc-4.3.1/gcc/config/sparc/linux64.h 2008-06-10 05:50:16.000000000 +0200
+@@ -66,12 +66,12 @@
+
+ #ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
++ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
++ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbeginS.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -81,10 +81,15 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
+-
++#ifdef HAVE_LD_PIE
++#define ENDFILE_SPEC \
++ "%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s\
++ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#else
+ #define ENDFILE_SPEC \
+- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
++ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s\
+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
++#endif
+
+ /* The GNU C++ standard library requires that these macros be defined. */
+ #undef CPLUSPLUS_CPP_SPEC
+@@ -281,7 +286,7 @@
+ %{T} \
+ %{Ym,*} \
+ %{Wa,*:%*} \
+--s %{fpic|fPIC|fpie|fPIE:-K PIC} \
++-s %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \
+ %{mlittle-endian:-EL} \
+ %(asm_cpu) %(asm_arch) %(asm_relax)"
+
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/sparc/linux.h /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/config/sparc/linux.h
+--- gcc-4.3.1/gcc/config/sparc/linux.h 2007-08-02 12:49:31.000000000 +0200
++++ gcc-4.3.1/gcc/config/sparc/linux.h 2008-06-10 05:50:16.000000000 +0200
+@@ -45,14 +45,14 @@
+ object constructed before entering `main'. */
+
+ #undef STARTFILE_SPEC
+-#if defined HAVE_LD_PIE
++#ifdef HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
++ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
+@@ -62,9 +62,15 @@
+ GNU/Linux "finalizer" file, `crtn.o'. */
+
+ #undef ENDFILE_SPEC
++#ifdef HAVE_LD_PIE
+ #define ENDFILE_SPEC \
+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
++ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
++#else
++#define ENDFILE_SPEC \
++ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
++ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
++#endif
+
+ /* This is for -profile to use -lc_p instead of -lc. */
+ #undef CC1_SPEC
+@@ -146,7 +152,7 @@
+ #undef ASM_SPEC
+ #define ASM_SPEC \
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
+- %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)"
++ %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) %(asm_cpu) %(asm_relax)"
+
+ /* Same as sparc.h */
+ #undef DBX_REGISTER_NUMBER
+diff -ruN /var/tmp/portage/sys-devel/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/gcc.c /root/hardened/gcc-4.3.1-r1/work/gcc-4.3.1/gcc/gcc.c
+--- gcc-4.3.1/gcc/gcc.c 2008-06-10 06:16:06.000000000 +0200
++++ gcc-4.3.1/gcc/gcc.c 2008-06-10 05:50:16.000000000 +0200
+@@ -704,11 +704,43 @@
+ #ifndef LINK_PIE_SPEC
+ #ifdef HAVE_LD_PIE
+ #define LINK_PIE_SPEC "%{pie:-pie} "
++#define CC1_PIE_SPEC "%{pie:-fPIE}"
++#define ASM_PIE_SPEC "%{pie:-K PIC}"
+ #else
+ #define LINK_PIE_SPEC "%{pie:} "
++#define CC1_PIE_SPEC ""
++#define ASM_PIE_SPEC ""
+ #endif
+ #endif
+
++#ifndef CC1_HARDENED_SPEC
++#define CC1_HARDENED_SPEC " %{!D__KERNEL__: %(cc1_pie) %(cc1_ssp) %(cc1_fortify) %(cc1_strict) }"
++#endif
++#ifndef CC1_SSP_SPEC
++#define CC1_SSP_SPEC ""
++#endif
++#ifndef CC1_SSP_ALL_SPEC
++#define CC1_SSP_ALL_SPEC ""
++#endif
++#ifndef CRTFILE_PIE_SPEC
++#define CRTFILE_PIE_SPEC "%{static:crt1.o%s;pie:Scrt1.o%s;:crt1.o%s}"
++#endif
++#ifndef STARTFILE_PIE_SPEC
++#define STARTFILE_PIE_SPEC "%{static:crtbegin.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
++#endif
++#ifndef STARTFILE_PIE_T_SPEC
++#define STARTFILE_PIE_T_SPEC "%{static:crtbeginT.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
++#endif
++#ifndef ENDFILE_PIE_SPEC
++#define ENDFILE_PIE_SPEC "%{pie:crtendS.o%s;:crtend.o%s}"
++#endif
++#ifndef LINK_RELRO_SPEC
++#define LINK_RELRO_SPEC "%{norelro:}"
++#endif
++#ifndef LINK_NOW_SPEC
++#define LINK_NOW_SPEC "%{nonow:}"
++#endif
++
+ /* -u* was put back because both BSD and SysV seem to support it. */
+ /* %{static:} simply prevents an error message if the target machine
+ doesn't handle -static. */
+@@ -718,7 +750,7 @@
+ #ifndef LINK_COMMAND_SPEC
+ #define LINK_COMMAND_SPEC "\
+ %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+- %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
++ %(linker) %l %(link_pie) %(link_relro) %(link_now) %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
+@@ -772,6 +804,17 @@
+ static const char *sysroot_spec = SYSROOT_SPEC;
+ static const char *sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC;
+ static const char *sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC;
++static const char *asm_pie_spec = ASM_PIE_SPEC;
++static const char *cc1_ssp_spec = CC1_SSP_SPEC;
++static const char *cc1_ssp_all_spec = CC1_SSP_ALL_SPEC;
++static const char *cc1_pie_spec = CC1_PIE_SPEC;
++static const char *crtfile_pie_spec = CRTFILE_PIE_SPEC;
++static const char *endfile_pie_spec = ENDFILE_PIE_SPEC;
++static const char *startfile_pie_spec = STARTFILE_PIE_SPEC;
++static const char *startfile_pie_t_spec = STARTFILE_PIE_T_SPEC;
++static const char *link_relro_spec = LINK_RELRO_SPEC;
++static const char *link_now_spec = LINK_NOW_SPEC;
++static const char *link_pie_spec = LINK_PIE_SPEC;
+
+ /* Standard options to cpp, cc1, and as, to reduce duplication in specs.
+ There should be no need to override these in target dependent files,
+@@ -1605,6 +1648,17 @@
+ INIT_STATIC_SPEC ("sysroot_spec", &sysroot_spec),
+ INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec),
+ INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec),
++ INIT_STATIC_SPEC ("asm_pie", &asm_pie_spec),
++ INIT_STATIC_SPEC ("cc1_ssp", &cc1_ssp_spec),
++ INIT_STATIC_SPEC ("cc1_ssp_all", &cc1_ssp_all_spec),
++ INIT_STATIC_SPEC ("cc1_pie", &cc1_pie_spec),
++ INIT_STATIC_SPEC ("crtfile_pie", &crtfile_pie_spec),
++ INIT_STATIC_SPEC ("endfile_pie", &endfile_pie_spec),
++ INIT_STATIC_SPEC ("startfile_pie", &startfile_pie_spec),
++ INIT_STATIC_SPEC ("startfile_pie_t", &startfile_pie_t_spec),
++ INIT_STATIC_SPEC ("link_relro", &link_relro_spec),
++ INIT_STATIC_SPEC ("link_now", &link_now_spec),
++ INIT_STATIC_SPEC ("link_pie", &link_pie_spec),
+ };
+
+ #ifdef EXTRA_SPECS /* additional specs needed */
diff --git a/core/gcc/APKBUILD b/core/gcc/APKBUILD
new file mode 100644
index 00000000000..b257fcf21b9
--- /dev/null
+++ b/core/gcc/APKBUILD
@@ -0,0 +1,79 @@
+pkgname=gcc
+pkgver=4.3.2
+pkgrel=0
+pkgdesc="The GNU Compiler Collection"
+url="http://gcc.gnu.org"
+license="GPL LGPL"
+depends="gmp mpfr"
+makedepends="bison flex texinfo"
+subpackages="$pkgname-doc g++:gpp"
+source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.3.2/gcc-core-4.3.2.tar.bz2
+ ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.3.2/gcc-g++-4.3.2.tar.bz2
+ 00_all_gcc-4.0-cvs-incompat.patch
+ 01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
+ 01_all_gcc-4.3.1-crtbeginTS-stuff.patch
+ 02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
+ gcc-4.2.0-cc1-no-stack-protector.patch
+ "
+
+build ()
+{
+ cd ${srcdir}/gcc-${pkgver};
+ for i in ../*.patch; do
+ if ! patch -p1 -i $i; then
+ error "$i failed"
+ return 1
+ fi
+ done
+
+ echo ${pkgver} > gcc/BASE-VER;
+
+ # Don't build crtbegin/end with ssp
+ sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |' \
+ -i gcc/Makefile.in || die "Failed to update crtstuff!"
+
+ mkdir build;
+ cd build;
+ ../configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --build=${CHOST:-i486-alpine-linux-uclibc} \
+ --disable-altivec \
+ --disable-checking \
+ --disable-fixed-point \
+ --disable-libstdcxx-pch \
+ --disable-multilib \
+ --disable-nls \
+ --disable-werror \
+ --enable-__cxa_atexit \
+ --enable-languages=c,c++ \
+ --enable-shared \
+ --enable-target-optspace \
+ --disable-threads \
+ --with-arch=i486 \
+ --with-system-zlib
+
+ make || return 1;
+ make -j1 DESTDIR="${pkgdir}" install || return 1;
+}
+
+gpp() {
+ local libexec=usr/libexec/gcc/${CHOST:-i486-alpine-linux-uclibc}/$pkgver
+ mkdir -p "$subpkgdir/$libexec" \
+ "$subpkgdir"/usr/bin \
+ "$subpkgdir"/usr/include \
+ "$subpkgdir"/usr/lib \
+
+ mv "$pkgdir/$libexec/cc1plus" "$subpkgdir/$libexec/"
+ mv "$pkgdir"/usr/lib/*++* "$subpkgdir"/usr/lib/
+ mv "$pkgdir"/usr/include/c++ "$subpkgdir"/usr/include/
+ mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
+}
+
+md5sums="dd8048b43d3d4e5595bcade47b9144c6 gcc-core-4.3.2.tar.bz2
+bfdf8d19e1b85f522f8b8d48d25e7aaa gcc-g++-4.3.2.tar.bz2
+f0c6c419318537505ec2717a139a091b 00_all_gcc-4.0-cvs-incompat.patch
+3cb2148075e818f09c34718725f335d9 01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
+1c6294b95f13a59ed7cbf7be2dde7804 01_all_gcc-4.3.1-crtbeginTS-stuff.patch
+019522a38f2e25b6a820766402ff2ee4 02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
+cff2e73a8455bfa844dcdd9c229b0875 gcc-4.2.0-cc1-no-stack-protector.patch"
diff --git a/core/gcc/gcc-4.2.0-cc1-no-stack-protector.patch b/core/gcc/gcc-4.2.0-cc1-no-stack-protector.patch
new file mode 100644
index 00000000000..cc80d1bc75b
--- /dev/null
+++ b/core/gcc/gcc-4.2.0-cc1-no-stack-protector.patch
@@ -0,0 +1,11 @@
+--- a/gcc/Makefile.in.orig 2007-05-20 14:44:14.000000000 +0200
++++ b/gcc/Makefile.in 2007-05-20 14:44:27.000000000 +0200
+@@ -2641,7 +2641,7 @@
+ output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \
+ $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \
+ langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h
+- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
++ $(CC) -c $(ALL_CFLAGS) -fno-stack-protector $(ALL_CPPFLAGS) \
+ $(out_file) $(OUTPUT_OPTION)
+
+ # Build auxiliary files that support ecoff format.