aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-08-05 14:35:01 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-08-05 14:35:01 +0000
commitaf3ef82a15ac611eeea4beec92050f80839f4e5e (patch)
tree362ea1e37d29373c5ae07abab3d2bbc395a6682c
parentb2140f790dc858f0e55c995227177d8428f0cc65 (diff)
downloadalpine_aports-af3ef82a15ac611eeea4beec92050f80839f4e5e.tar.bz2
alpine_aports-af3ef82a15ac611eeea4beec92050f80839f4e5e.tar.xz
alpine_aports-af3ef82a15ac611eeea4beec92050f80839f4e5e.zip
main/gcc: moved 4.4.1 from testing to main
-rw-r--r--main/gcc/00_all_gcc-4.0-cvs-incompat.patch11
-rw-r--r--main/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch10
-rw-r--r--main/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch91
-rw-r--r--main/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch384
-rw-r--r--main/gcc/03_all_gcc-4.3.2-hardened-default.patch53
-rw-r--r--main/gcc/APKBUILD99
-rw-r--r--main/gcc/gcc-4.2.0-cc1-no-stack-protector.patch11
-rw-r--r--main/gcc/gcc-spec-env.patch41
-rw-r--r--main/gcc/uclibc-getipinfo.patch (renamed from testing/gcc/uclibc-getipinfo.patch)0
-rw-r--r--testing/gcc/APKBUILD125
-rw-r--r--testing/gcc/gcc4-stack-protector-uclibc-no_tls.patch84
-rw-r--r--testing/gcc/pt_gnu_eh_frame.patch12
12 files changed, 52 insertions, 869 deletions
diff --git a/main/gcc/00_all_gcc-4.0-cvs-incompat.patch b/main/gcc/00_all_gcc-4.0-cvs-incompat.patch
deleted file mode 100644
index e5bc302e26..0000000000
--- a/main/gcc/00_all_gcc-4.0-cvs-incompat.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- gcc-4.0.old/gcc/gcc.c.mps Sun Nov 14 21:10:35 2004
2+++ gcc-4.0/gcc/gcc.c Sun Nov 14 21:43:17 2004
3@@ -794,6 +794,8 @@
4 /* NB: This is shared amongst all front-ends. */
5 static const char *cc1_options =
6 "%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
7+ %{shared:%{static|pie|fPIE|fpie|fno-PIC|fno-pic:%e-shared and -static|pie|fPIE|fpie|fno-PIC|fno-pic are incompatible}}\
8+ %{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible}}\
9 %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
10 %{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}}\
11 %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi}\
diff --git a/main/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch b/main/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
deleted file mode 100644
index 8871506195..0000000000
--- a/main/gcc/01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch
+++ /dev/null
@@ -1,10 +0,0 @@
1--- gcc-4.0.2/gcc/gcc.c.nondef~ 2006-01-09 00:09:50 +0100
2+++ gcc-4.0.2/gcc/gcc.c 2006-01-09 00:15:31 +0100
3@@ -764,6 +764,6 @@
4
5 static const char *asm_debug;
6 static const char *cpp_spec = CPP_SPEC;
7-static const char *cc1_spec = CC1_SPEC;
8+static const char *cc1_spec = CC1_SPEC CC1_HARDENED_SPEC;
9 static const char *cc1plus_spec = CC1PLUS_SPEC;
10 static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
diff --git a/main/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch b/main/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch
deleted file mode 100644
index 8bc9a70567..0000000000
--- a/main/gcc/01_all_gcc-4.3.1-crtbeginTS-stuff.patch
+++ /dev/null
@@ -1,91 +0,0 @@
1diff -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
2--- gcc-4.3.1/gcc/config.gcc 2008-06-11 04:13:33.000000000 +0200
3+++ gcc-4.3.1/gcc/config.gcc 2008-06-11 04:41:39.000000000 +0200
4@@ -493,7 +493,7 @@
5 ;;
6 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
7 # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
8- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
9+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o"
10 extra_options="${extra_options} linux.opt"
11 gas=yes
12 gnu_ld=yes
13diff -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
14--- gcc-4.3.1/gcc/Makefile.in 2008-06-11 04:13:37.000000000 +0200
15+++ gcc-4.3.1/gcc/Makefile.in 2008-06-11 04:42:27.000000000 +0200
16@@ -1665,36 +1665,43 @@
17 # constructors.
18 $(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
19 gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
20- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
21+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
22 -c $(srcdir)/crtstuff.c -DCRT_BEGIN \
23 -o $(T)crtbegin$(objext)
24
25 $(T)crtend.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
26 gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
27- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
28+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
29 -c $(srcdir)/crtstuff.c -DCRT_END \
30 -o $(T)crtend$(objext)
31
32 # These are versions of crtbegin and crtend for shared libraries.
33 $(T)crtbeginS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
34 gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
35- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
36+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
37 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O \
38 -o $(T)crtbeginS$(objext)
39
40 $(T)crtendS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
41 gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
42- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
43+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
44 -c $(srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O \
45 -o $(T)crtendS$(objext)
46
47 # This is a version of crtbegin for -static links.
48 $(T)crtbeginT.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
49 gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
50- $(GCC_FOR_TARGET) $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
51+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS) \
52 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O \
53 -o $(T)crtbeginT$(objext)
54
55+# This is a version of crtbegin for -static -fPIE links.
56+$(T)crtbeginTS.o: crtstuff.c $(GCC_PASSES) $(TCONFIG_H) auto-host.h \
57+ gbl-ctors.h stmp-int-hdrs tsystem.h coretypes.h $(TM_H)
58+ $(GCC_FOR_TARGET) -fno-PIE $(CRTSTUFF_CFLAGS) $(CRTSTUFF_T_CFLAGS_S) \
59+ -c $(srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O \
60+ -o $(T)crtbeginTS$(objext)
61+
62 # Compile the start modules crt0.o and mcrt0.o that are linked with
63 # every program
64 $(T)crt0.o: s-crt0 ; @true
65diff -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
66--- gcc-4.3.1/libgcc/config.host 2008-01-25 21:49:04.000000000 +0100
67+++ gcc-4.3.1/libgcc/config.host 2008-06-11 04:42:09.000000000 +0200
68@@ -164,7 +164,7 @@
69 ;;
70 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
71 # Must come before *-*-gnu* (because of *-*-linux-gnu* systems).
72- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
73+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtbeginTS.o crtend.o crtendS.o"
74 ;;
75 *-*-gnu*)
76 ;;
77diff -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
78--- gcc-4.3.1/libgcc/Makefile.in 2008-06-11 04:13:37.000000000 +0200
79+++ gcc-4.3.1/libgcc/Makefile.in 2008-06-11 04:42:09.000000000 +0200
80@@ -783,6 +783,11 @@
81 crtbeginT.o: $(gcc_srcdir)/crtstuff.c
82 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
83 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
84+
85+# This is a version of crtbegin for -static -fPIE links.
86+crtbeginTS.o: $(gcc_srcdir)/crtstuff.c
87+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
88+ -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O
89 endif
90
91 # Build extra startfiles in the libgcc directory.
diff --git a/main/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch b/main/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
deleted file mode 100644
index 75b3654c8e..0000000000
--- a/main/gcc/02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
+++ /dev/null
@@ -1,384 +0,0 @@
1diff -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
2--- gcc-4.3.1.orig/gcc/config/alpha/elf.h 2007-08-02 12:49:31.000000000 +0200
3+++ gcc-4.3.1/gcc/config/alpha/elf.h 2008-06-10 05:50:16.000000000 +0200
4@@ -362,12 +362,12 @@
5 #undef STARTFILE_SPEC
6 #ifdef HAVE_LD_PIE
7 #define STARTFILE_SPEC \
8- "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
9- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
10+ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
11+ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
12 #else
13 #define STARTFILE_SPEC \
14 "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
15- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
16+ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
17 #endif
18
19 /* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
20@@ -376,9 +376,15 @@
21 `main', followed by a normal ELF "finalizer" file, `crtn.o'. */
22
23 #undef ENDFILE_SPEC
24+#ifdef HAVE_LD_PIE
25 #define ENDFILE_SPEC \
26 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
27- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
28+ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
29+#else
30+#define ENDFILE_SPEC \
31+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
32+ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
33+#endif
34
35 /* We support #pragma. */
36 #define HANDLE_SYSV_PRAGMA 1
37diff -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
38--- gcc-4.3.1.orig/gcc/config/i386/linux64.h 2007-08-02 12:49:31.000000000 +0200
39+++ gcc-4.3.1/gcc/config/i386/linux64.h 2008-06-10 06:10:18.000000000 +0200
40@@ -76,12 +76,21 @@
41
42 /* Similar to standard Linux, but adding -ffast-math support. */
43 #undef ENDFILE_SPEC
44+#ifdef HAVE_LD_PIE
45 #define ENDFILE_SPEC \
46 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
47 %{mpc32:crtprec32.o%s} \
48 %{mpc64:crtprec64.o%s} \
49 %{mpc80:crtprec80.o%s} \
50 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
51+#else
52+#define ENDFILE_SPEC \
53+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
54+ %{mpc32:crtprec32.o%s} \
55+ %{mpc64:crtprec64.o%s} \
56+ %{mpc80:crtprec80.o%s} \
57+ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
58+#endif
59
60 #if TARGET_64BIT_DEFAULT
61 #define MULTILIB_DEFAULTS { "m64" }
62diff -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
63--- gcc-4.3.1/gcc/config/i386/linux.h 2007-11-28 02:04:27.000000000 +0100
64+++ gcc-4.3.1/gcc/config/i386/linux.h 2008-06-10 06:11:35.000000000 +0200
65@@ -118,12 +118,21 @@
66
67 /* Similar to standard Linux, but adding -ffast-math support. */
68 #undef ENDFILE_SPEC
69+#ifdef HAVE_LD_PIE
70+#define ENDFILE_SPEC \
71+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
72+ %{mpc32:crtprec32.o%s} \
73+ %{mpc64:crtprec64.o%s} \
74+ %{mpc80:crtprec80.o%s} \
75+ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
76+#else
77 #define ENDFILE_SPEC \
78 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
79 %{mpc32:crtprec32.o%s} \
80 %{mpc64:crtprec64.o%s} \
81 %{mpc80:crtprec80.o%s} \
82 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
83+#endif
84
85 /* A C statement (sans semicolon) to output to the stdio stream
86 FILE the assembler definition of uninitialized global DECL named
87diff -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
88--- gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 06:15:58.000000000 +0200
89+++ gcc-4.3.1/gcc/config/ia64/linux.h 2008-06-10 05:50:16.000000000 +0200
90@@ -22,19 +22,25 @@
91 #undef STARTFILE_SPEC
92 #ifdef HAVE_LD_PIE
93 #define STARTFILE_SPEC \
94- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
95- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
96+ "%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} }\
97+ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie)}"
98 #else
99 #define STARTFILE_SPEC \
100 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}}\
101- crti.o%s %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
102+ crti.o%s %{shared:crtbeginS.o%s;:crtbegin.o%s}"
103 #endif
104
105 /* Similar to standard Linux, but adding -ffast-math support. */
106 #undef ENDFILE_SPEC
107+#ifdef HAVE_LD_PIE
108 #define ENDFILE_SPEC \
109 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
110- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
111+ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
112+#else
113+#define ENDFILE_SPEC \
114+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
115+ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
116+#endif
117
118 /* Define this for shared library support because it isn't in the main
119 linux.h file. */
120diff -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
121--- gcc-4.3.1/gcc/config/linux.h 2007-08-02 12:49:31.000000000 +0200
122+++ gcc-4.3.1/gcc/config/linux.h 2008-06-10 05:50:16.000000000 +0200
123@@ -40,12 +40,12 @@
124 #undef STARTFILE_SPEC
125 #if defined HAVE_LD_PIE
126 #define STARTFILE_SPEC \
127- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
128- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
129+ "%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} } \
130+ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
131 #else
132 #define STARTFILE_SPEC \
133 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
134- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
135+ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
136 #endif
137
138 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
139@@ -55,8 +55,13 @@
140 GNU/Linux "finalizer" file, `crtn.o'. */
141
142 #undef ENDFILE_SPEC
143+#ifdef HAVE_LD_PIE
144 #define ENDFILE_SPEC \
145- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
146+ "%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
147+#else
148+#define ENDFILE_SPEC \
149+ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
150+#endif
151
152 /* This is for -profile to use -lc_p instead of -lc. */
153 #ifndef CC1_SPEC
154diff -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
155--- gcc-4.3.1/gcc/config/rs6000/linux64.h 2007-08-02 12:49:31.000000000 +0200
156+++ gcc-4.3.1/gcc/config/rs6000/linux64.h 2008-06-10 05:50:16.000000000 +0200
157@@ -151,7 +151,7 @@
158 #endif
159
160 #define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \
161-%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \
162+%{mrelocatable} %{mrelocatable-lib} %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \
163 %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \
164 %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
165 %{mcall-freebsd: -mbig} \
166diff -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
167--- gcc-4.3.1/gcc/config/rs6000/sysv4.h 2007-08-08 21:33:24.000000000 +0200
168+++ gcc-4.3.1/gcc/config/rs6000/sysv4.h 2008-06-10 05:50:16.000000000 +0200
169@@ -875,19 +875,25 @@
170
171 #ifdef HAVE_LD_PIE
172 #define STARTFILE_LINUX_SPEC "\
173-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
174+%{!shared: %{pg|p|profile:gcrt1.o%s} %{!pg:%{!p:%{!profile:%(crtfile_pie)}}} } \
175 %{mnewlib:ecrti.o%s;:crti.o%s} \
176-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
177+%{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
178 #else
179 #define STARTFILE_LINUX_SPEC "\
180 %{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
181 %{mnewlib:ecrti.o%s;:crti.o%s} \
182-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
183+%{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
184 #endif
185
186+#ifdef HAVE_LD_PIE
187 #define ENDFILE_LINUX_SPEC "\
188-%{shared|pie:crtendS.o%s;:crtend.o%s} \
189+%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} \
190 %{mnewlib:ecrtn.o%s;:crtn.o%s}"
191+#else
192+#define ENDFILE_LINUX_SPEC "\
193+%{shared:crtendS.o%s;:crtend.o%s} \
194+%{mnewlib:ecrtn.o%s;:crtn.o%s}"
195+#endif
196
197 #define LINK_START_LINUX_SPEC ""
198
199diff -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
200--- gcc-4.3.1/gcc/config/sparc/linux64.h 2007-10-19 06:29:38.000000000 +0200
201+++ gcc-4.3.1/gcc/config/sparc/linux64.h 2008-06-10 05:50:16.000000000 +0200
202@@ -66,12 +66,12 @@
203
204 #ifdef HAVE_LD_PIE
205 #define STARTFILE_SPEC \
206- "%{!shared:%{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
207- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
208+ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
209+ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
210 #else
211 #define STARTFILE_SPEC \
212 "%{!shared:%{pg|p:gcrt1.o%s;:crt1.o%s}}\
213- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbeginS.o%s}"
214+ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbeginS.o%s}"
215 #endif
216
217 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
218@@ -81,10 +81,15 @@
219 GNU/Linux "finalizer" file, `crtn.o'. */
220
221 #undef ENDFILE_SPEC
222-
223+#ifdef HAVE_LD_PIE
224+#define ENDFILE_SPEC \
225+ "%{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s\
226+ %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
227+#else
228 #define ENDFILE_SPEC \
229- "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
230+ "%{shared:crtendS.o%s;:crtend.o%s} crtn.o%s\
231 %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
232+#endif
233
234 /* The GNU C++ standard library requires that these macros be defined. */
235 #undef CPLUSPLUS_CPP_SPEC
236@@ -281,7 +286,7 @@
237 %{T} \
238 %{Ym,*} \
239 %{Wa,*:%*} \
240--s %{fpic|fPIC|fpie|fPIE:-K PIC} \
241+-s %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) \
242 %{mlittle-endian:-EL} \
243 %(asm_cpu) %(asm_arch) %(asm_relax)"
244
245diff -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
246--- gcc-4.3.1/gcc/config/sparc/linux.h 2007-08-02 12:49:31.000000000 +0200
247+++ gcc-4.3.1/gcc/config/sparc/linux.h 2008-06-10 05:50:16.000000000 +0200
248@@ -45,14 +45,14 @@
249 object constructed before entering `main'. */
250
251 #undef STARTFILE_SPEC
252-#if defined HAVE_LD_PIE
253+#ifdef HAVE_LD_PIE
254 #define STARTFILE_SPEC \
255- "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\
256- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
257+ "%{!shared: %{pg|p:gcrt1.o%s} %{!pg:%{!p:%(crtfile_pie)}} }\
258+ crti.o%s %{shared:crtbeginS.o%s} %{!shared:%(startfile_pie_t)}"
259 #else
260 #define STARTFILE_SPEC \
261 "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\
262- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
263+ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
264 #endif
265
266 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
267@@ -62,9 +62,15 @@
268 GNU/Linux "finalizer" file, `crtn.o'. */
269
270 #undef ENDFILE_SPEC
271+#ifdef HAVE_LD_PIE
272 #define ENDFILE_SPEC \
273 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
274- %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
275+ %{shared:crtendS.o%s} %{!shared:%(endfile_pie)} crtn.o%s"
276+#else
277+#define ENDFILE_SPEC \
278+ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
279+ %{shared:crtendS.o%s;:crtend.o%s} crtn.o%s"
280+#endif
281
282 /* This is for -profile to use -lc_p instead of -lc. */
283 #undef CC1_SPEC
284@@ -146,7 +152,7 @@
285 #undef ASM_SPEC
286 #define ASM_SPEC \
287 "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
288- %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)"
289+ %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_pie) %(asm_cpu) %(asm_relax)"
290
291 /* Same as sparc.h */
292 #undef DBX_REGISTER_NUMBER
293diff -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
294--- gcc-4.3.1/gcc/gcc.c 2008-06-10 06:16:06.000000000 +0200
295+++ gcc-4.3.1/gcc/gcc.c 2008-06-10 05:50:16.000000000 +0200
296@@ -704,11 +704,43 @@
297 #ifndef LINK_PIE_SPEC
298 #ifdef HAVE_LD_PIE
299 #define LINK_PIE_SPEC "%{pie:-pie} "
300+#define CC1_PIE_SPEC "%{pie:-fPIE}"
301+#define ASM_PIE_SPEC "%{pie:-K PIC}"
302 #else
303 #define LINK_PIE_SPEC "%{pie:} "
304+#define CC1_PIE_SPEC ""
305+#define ASM_PIE_SPEC ""
306 #endif
307 #endif
308
309+#ifndef CC1_HARDENED_SPEC
310+#define CC1_HARDENED_SPEC " %{!D__KERNEL__: %(cc1_pie) %(cc1_ssp) %(cc1_fortify) %(cc1_strict) }"
311+#endif
312+#ifndef CC1_SSP_SPEC
313+#define CC1_SSP_SPEC ""
314+#endif
315+#ifndef CC1_SSP_ALL_SPEC
316+#define CC1_SSP_ALL_SPEC ""
317+#endif
318+#ifndef CRTFILE_PIE_SPEC
319+#define CRTFILE_PIE_SPEC "%{static:crt1.o%s;pie:Scrt1.o%s;:crt1.o%s}"
320+#endif
321+#ifndef STARTFILE_PIE_SPEC
322+#define STARTFILE_PIE_SPEC "%{static:crtbegin.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
323+#endif
324+#ifndef STARTFILE_PIE_T_SPEC
325+#define STARTFILE_PIE_T_SPEC "%{static:crtbeginT.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
326+#endif
327+#ifndef ENDFILE_PIE_SPEC
328+#define ENDFILE_PIE_SPEC "%{pie:crtendS.o%s;:crtend.o%s}"
329+#endif
330+#ifndef LINK_RELRO_SPEC
331+#define LINK_RELRO_SPEC "%{norelro:}"
332+#endif
333+#ifndef LINK_NOW_SPEC
334+#define LINK_NOW_SPEC "%{nonow:}"
335+#endif
336+
337 /* -u* was put back because both BSD and SysV seem to support it. */
338 /* %{static:} simply prevents an error message if the target machine
339 doesn't handle -static. */
340@@ -718,7 +750,7 @@
341 #ifndef LINK_COMMAND_SPEC
342 #define LINK_COMMAND_SPEC "\
343 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
344- %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
345+ %(linker) %l %(link_pie) %(link_relro) %(link_now) %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
346 %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
347 %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
348 %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib)\
349@@ -772,6 +804,17 @@
350 static const char *sysroot_spec = SYSROOT_SPEC;
351 static const char *sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC;
352 static const char *sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC;
353+static const char *asm_pie_spec = ASM_PIE_SPEC;
354+static const char *cc1_ssp_spec = CC1_SSP_SPEC;
355+static const char *cc1_ssp_all_spec = CC1_SSP_ALL_SPEC;
356+static const char *cc1_pie_spec = CC1_PIE_SPEC;
357+static const char *crtfile_pie_spec = CRTFILE_PIE_SPEC;
358+static const char *endfile_pie_spec = ENDFILE_PIE_SPEC;
359+static const char *startfile_pie_spec = STARTFILE_PIE_SPEC;
360+static const char *startfile_pie_t_spec = STARTFILE_PIE_T_SPEC;
361+static const char *link_relro_spec = LINK_RELRO_SPEC;
362+static const char *link_now_spec = LINK_NOW_SPEC;
363+static const char *link_pie_spec = LINK_PIE_SPEC;
364
365 /* Standard options to cpp, cc1, and as, to reduce duplication in specs.
366 There should be no need to override these in target dependent files,
367@@ -1605,6 +1648,17 @@
368 INIT_STATIC_SPEC ("sysroot_spec", &sysroot_spec),
369 INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec),
370 INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec),
371+ INIT_STATIC_SPEC ("asm_pie", &asm_pie_spec),
372+ INIT_STATIC_SPEC ("cc1_ssp", &cc1_ssp_spec),
373+ INIT_STATIC_SPEC ("cc1_ssp_all", &cc1_ssp_all_spec),
374+ INIT_STATIC_SPEC ("cc1_pie", &cc1_pie_spec),
375+ INIT_STATIC_SPEC ("crtfile_pie", &crtfile_pie_spec),
376+ INIT_STATIC_SPEC ("endfile_pie", &endfile_pie_spec),
377+ INIT_STATIC_SPEC ("startfile_pie", &startfile_pie_spec),
378+ INIT_STATIC_SPEC ("startfile_pie_t", &startfile_pie_t_spec),
379+ INIT_STATIC_SPEC ("link_relro", &link_relro_spec),
380+ INIT_STATIC_SPEC ("link_now", &link_now_spec),
381+ INIT_STATIC_SPEC ("link_pie", &link_pie_spec),
382 };
383
384 #ifdef EXTRA_SPECS /* additional specs needed */
diff --git a/main/gcc/03_all_gcc-4.3.2-hardened-default.patch b/main/gcc/03_all_gcc-4.3.2-hardened-default.patch
deleted file mode 100644
index 04da4ea11b..0000000000
--- a/main/gcc/03_all_gcc-4.3.2-hardened-default.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1This patch defines the hardened specs hard in the gcc.c file.
2--- gcc-4.3.2/gcc/gcc.c.orig2 Sun Nov 23 11:35:41 2008
3+++ gcc-4.3.2/gcc/gcc.c Sun Nov 23 11:51:58 2008
4@@ -703,9 +703,9 @@
5
6 #ifndef LINK_PIE_SPEC
7 #ifdef HAVE_LD_PIE
8-#define LINK_PIE_SPEC "%{pie:-pie} "
9-#define CC1_PIE_SPEC "%{pie:-fPIE}"
10-#define ASM_PIE_SPEC "%{pie:-K PIC}"
11+#define LINK_PIE_SPEC "%{pie:-pie} %{!pie: %{!A: %{!fno-pie:%{!fno-PIE: %{!shared:%{!static:%{!r: %{!nopie:-pie} }}} }} } }%{pie:-pie} %{!pie: %{!A: %{!fno-pie:%{!fno-PIE: %{!shared:%{!static:%{!r: %{!nopie:-pie} }}} }} } } "
12+#define CC1_PIE_SPEC "%{pie:-fPIE} %{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: %{!shared: %{!nopie:-fPIE} } }}}} }}}} }"
13+#define ASM_PIE_SPEC "%{pie:-K PIC} %{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: %{!shared: %{!nopie:-K PIC} } }}}} }}}} }"
14 #else
15 #define LINK_PIE_SPEC "%{pie:} "
16 #define CC1_PIE_SPEC ""
17@@ -717,28 +717,28 @@
18 #define CC1_HARDENED_SPEC " %{!D__KERNEL__: %(cc1_pie) %(cc1_ssp) %(cc1_fortify) %(cc1_strict) }"
19 #endif
20 #ifndef CC1_SSP_SPEC
21-#define CC1_SSP_SPEC ""
22+#define CC1_SSP_SPEC "%{!nostdlib:%{!nodefaultlibs: %{!fno-stack-protector:%{!fstack-protector:%{!fstack-protector-all:-fstack-protector %(cc1_ssp_all) }}} }}"
23 #endif
24 #ifndef CC1_SSP_ALL_SPEC
25-#define CC1_SSP_ALL_SPEC ""
26+#define CC1_SSP_ALL_SPEC ""
27 #endif
28 #ifndef CRTFILE_PIE_SPEC
29-#define CRTFILE_PIE_SPEC "%{static:crt1.o%s;pie:Scrt1.o%s;:crt1.o%s}"
30+#define CRTFILE_PIE_SPEC "%{fno-pie|fno-PIE|nopie:crt1.o%s;:Scrt1.o%s}"
31 #endif
32 #ifndef STARTFILE_PIE_SPEC
33-#define STARTFILE_PIE_SPEC "%{static:crtbegin.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
34+#define STARTFILE_PIE_SPEC "%{fno-pie|fno-PIE|nopie:crtbegin.o%s;:crtbeginS.o%s}"
35 #endif
36 #ifndef STARTFILE_PIE_T_SPEC
37-#define STARTFILE_PIE_T_SPEC "%{static:crtbeginT.o%s;pie:crtbeginS.o%s;:crtbegin.o%s}"
38+#define STARTFILE_PIE_T_SPEC "%{static: %{fno-pie|fno-PIE|nopie:crtbeginT.o%s;:crtbeginTS.o%s} } %{!static: %{fno-pie|fno-PIE|nopie:crtbegin.o%s;:crtbeginS.o%s} }"
39 #endif
40 #ifndef ENDFILE_PIE_SPEC
41-#define ENDFILE_PIE_SPEC "%{pie:crtendS.o%s;:crtend.o%s}"
42+#define ENDFILE_PIE_SPEC "%{fno-pie|fno-PIE|nopie:crtend.o%s;:crtendS.o%s}"
43 #endif
44 #ifndef LINK_RELRO_SPEC
45-#define LINK_RELRO_SPEC "%{norelro:}"
46+#define LINK_RELRO_SPEC "%{!norelro:-z relro}"
47 #endif
48 #ifndef LINK_NOW_SPEC
49-#define LINK_NOW_SPEC "%{nonow:}"
50+#define LINK_NOW_SPEC "%{!nonow:-z now}"
51 #endif
52
53 /* -u* was put back because both BSD and SysV seem to support it. */
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index dbb656603a..0dd1f35bcd 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -1,51 +1,43 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=gcc 2pkgname=gcc
3pkgver=4.3.3 3pkgver=4.4.1
4pkgrel=2 4_specsver=0.1.4
5_espfver=0.3.1
6pkgrel=1
5pkgdesc="The GNU Compiler Collection" 7pkgdesc="The GNU Compiler Collection"
6url="http://gcc.gnu.org" 8url="http://gcc.gnu.org"
7license="GPL LGPL" 9license="GPL LGPL"
8depends="gmp mpfr libgcc binutils" 10depends="binutils"
9makedepends="bison flex gmp-dev mpfr-dev texinfo" 11makedepends="bison flex gmp-dev mpfr-dev texinfo"
10subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc" 12subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc libgomp"
11source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-core-$pkgver.tar.bz2 13source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-core-$pkgver.tar.bz2
12 ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-g++-$pkgver.tar.bz2 14 ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-g++-$pkgver.tar.bz2
13 00_all_gcc-4.0-cvs-incompat.patch 15 http://weaver.gentooenterprise.com/hardened/patches/gcc-$pkgver-espf-$_espfver.tar.bz2
14 01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch 16 http://weaver.gentooenterprise.com/hardened/patches/gcc-$pkgver-specs-$_specsver.tar.bz2
15 01_all_gcc-4.3.1-crtbeginTS-stuff.patch
16 02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
17 03_all_gcc-4.3.2-hardened-default.patch
18 gcc4-stack-protector-uclibc-no_tls.patch 17 gcc4-stack-protector-uclibc-no_tls.patch
19 gcc-4.2.0-cc1-no-stack-protector.patch
20 pt_gnu_eh_frame.patch 18 pt_gnu_eh_frame.patch
21 gcc-spec-env.patch 19 uclibc-getipinfo.patch
22 " 20 "
21# ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-objc-$pkgver.tar.bz2
22build ()
23{
24 cd ${srcdir}/gcc-${pkgver}
23 25
24build () 26 # uclibc patches
25{
26 cd ${srcdir}/gcc-${pkgver};
27 for i in ../*.patch; do 27 for i in ../*.patch; do
28 if ! patch -p1 -i $i; then 28 msg "Applying $i"
29 error "$i failed" 29 patch -p1 -i $i || return 1
30 return 1
31 fi
32 done 30 done
33 31
34 echo ${pkgver} > gcc/BASE-VER; 32 # ESPF patches. we dont use objc yet
35 33 rm -f ../espf-gcc-$pkgver/*_objc*lang-specs*.patch
36 # Don't build crtbegin/end with ssp 34 # thanks to Zorry for hard work on those patches
37 sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |' \ 35 for i in ../espf-gcc-$pkgver/*.patch; do
38 -i gcc/Makefile.in || return 1 36 msg "Applying $i"
39 37 patch -p0 -i $i || return 1
40 # Don't build libgcc with SSP 38 done
41 sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -fno-stack-protector -U_FORTIFY_SOURCE |' \
42 -i gcc/Makefile.in || return 1
43
44 # Use SSP from libc
45 msg "Enabling SSP from libc"
46 sed -e 's|^LIBGCC2_CFLAGS = |LIBGCC2_CFLAGS = -D_LIBC_PROVIDES_SSP_ |' \
47 -i gcc/Makefile.in || return 1
48 39
40 echo ${pkgver} > gcc/BASE-VER
49 mkdir build 41 mkdir build
50 cd build 42 cd build
51 ../configure --prefix=/usr \ 43 ../configure --prefix=/usr \
@@ -59,15 +51,18 @@ build ()
59 --disable-libstdcxx-pch \ 51 --disable-libstdcxx-pch \
60 --disable-multilib \ 52 --disable-multilib \
61 --disable-nls \ 53 --disable-nls \
54 --disable-threads \
55 --disable-tls \
62 --disable-werror \ 56 --disable-werror \
63 --enable-__cxa_atexit \ 57 --enable-__cxa_atexit \
64 --enable-cld \ 58 --enable-cld \
59 --enable-espf \
65 --enable-languages=c,c++ \ 60 --enable-languages=c,c++ \
66 --enable-shared \ 61 --enable-shared \
67 --enable-target-optspace \ 62 --enable-target-optspace \
68 --disable-threads \
69 --with-arch=i486 \ 63 --with-arch=i486 \
70 --with-system-zlib 64 --with-system-zlib \
65 --without-system-libunwind
71 66
72 make || return 1 67 make || return 1
73 make -j1 DESTDIR="${pkgdir}" install || return 1 68 make -j1 DESTDIR="${pkgdir}" install || return 1
@@ -75,18 +70,25 @@ build ()
75 70
76 # binutils provides libiberty.a 71 # binutils provides libiberty.a
77 rm -f "$pkgdir"/usr/lib/libiberty.a 72 rm -f "$pkgdir"/usr/lib/libiberty.a
73
74 # install the specs
75 cd "$srcdir"/specs
76 install -d "$pkgdir"/usr/share/gcc
77 for i in *.specs; do
78 install -m644 $i "$pkgdir"/usr/share/gcc/$i || return 1
79 done
78} 80}
79 81
80libcxx() { 82libcxx() {
81 pkgdesc="GNU C++ standard runtime library" 83 pkgdesc="GNU C++ standard runtime library"
82 depends="uclibc libgcc" 84 depends=
83 mkdir -p "$subpkgdir"/usr/lib 85 mkdir -p "$subpkgdir"/usr/lib
84 mv "$pkgdir"/usr/lib/libstdc++.so* "$subpkgdir"/usr/lib/ 86 mv "$pkgdir"/usr/lib/libstdc++.so* "$subpkgdir"/usr/lib/
85} 87}
86 88
87gpp() { 89gpp() {
88 pkgdesc="GNU C++ standard library and compiler" 90 pkgdesc="GNU C++ standard library and compiler"
89 depends="uclibc libstdc++" 91 depends=
90 local libexec=usr/libexec/gcc/${CHOST:-i486-alpine-linux-uclibc}/$pkgver 92 local libexec=usr/libexec/gcc/${CHOST:-i486-alpine-linux-uclibc}/$pkgver
91 mkdir -p "$subpkgdir/$libexec" \ 93 mkdir -p "$subpkgdir/$libexec" \
92 "$subpkgdir"/usr/bin \ 94 "$subpkgdir"/usr/bin \
@@ -100,21 +102,24 @@ gpp() {
100} 102}
101 103
102libgcc() { 104libgcc() {
103 pkgdesc="GNU C compiler runtime library" 105 pkgdesc="GNU C compiler runtime libraries"
104 depends="uclibc" 106 depends=
105 mkdir -p "$subpkgdir"/usr/lib 107 mkdir -p "$subpkgdir"/usr/lib
106 mv "$pkgdir"/usr/lib/libgcc_s.so* "$subpkgdir"/usr/lib/ 108 mv "$pkgdir"/usr/lib/libgcc_s.so* "$subpkgdir"/usr/lib/
107} 109}
108 110
111libgomp() {
112 pkgdesc="GCC shared-memory parallel programming API library"
113 depends=
114 replaces="gcc"
115 mkdir -p "$subpkgdir"/usr/lib
116 mv "$pkgdir"/usr/lib/libgomp.so* "$subpkgdir"/usr/lib/
117}
109 118
110md5sums="1739288c2c7b1472796b33d641dbdbbd gcc-core-4.3.3.tar.bz2 119md5sums="d19693308aa6b2052e14c071111df59f gcc-core-4.4.1.tar.bz2
11118428e313a9927d38b313e688c62219b gcc-g++-4.3.3.tar.bz2 120d449047b5761348ceec23739f5553e0b gcc-g++-4.4.1.tar.bz2
112f0c6c419318537505ec2717a139a091b 00_all_gcc-4.0-cvs-incompat.patch 12143d0bbd676bbb2acd67ddabd0ea1bc2b gcc-4.4.1-espf-0.3.1.tar.bz2
1133cb2148075e818f09c34718725f335d9 01_all_gcc-4.0.2-v9.0.0-start_endfile-boundschecking-no.patch 122da8d9165e828bbb9809ef86f1c72886f gcc-4.4.1-specs-0.1.4.tar.bz2
1141c6294b95f13a59ed7cbf7be2dde7804 01_all_gcc-4.3.1-crtbeginTS-stuff.patch
115019522a38f2e25b6a820766402ff2ee4 02_all_gcc-4.3.1-v10.0.1-start_endfile.patch
116ed3f5a947fed432fbef1dc0e71977ae7 03_all_gcc-4.3.2-hardened-default.patch
11715e77082db0e1a131af98debd3016290 gcc4-stack-protector-uclibc-no_tls.patch 12315e77082db0e1a131af98debd3016290 gcc4-stack-protector-uclibc-no_tls.patch
118cff2e73a8455bfa844dcdd9c229b0875 gcc-4.2.0-cc1-no-stack-protector.patch
1192db1e3482c5dd59dab70f701afa2ca80 pt_gnu_eh_frame.patch 1242db1e3482c5dd59dab70f701afa2ca80 pt_gnu_eh_frame.patch
120c4045bfa85d8be780affd465be9d8ca8 gcc-spec-env.patch" 1256cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch"
diff --git a/main/gcc/gcc-4.2.0-cc1-no-stack-protector.patch b/main/gcc/gcc-4.2.0-cc1-no-stack-protector.patch
deleted file mode 100644
index cc80d1bc75..0000000000
--- a/main/gcc/gcc-4.2.0-cc1-no-stack-protector.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- a/gcc/Makefile.in.orig 2007-05-20 14:44:14.000000000 +0200
2+++ b/gcc/Makefile.in 2007-05-20 14:44:27.000000000 +0200
3@@ -2641,7 +2641,7 @@
4 output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \
5 $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) $(TM_P_H) $(EXPR_H) \
6 langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) tm-constrs.h
7- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
8+ $(CC) -c $(ALL_CFLAGS) -fno-stack-protector $(ALL_CPPFLAGS) \
9 $(out_file) $(OUTPUT_OPTION)
10
11 # Build auxiliary files that support ecoff format.
diff --git a/main/gcc/gcc-spec-env.patch b/main/gcc/gcc-spec-env.patch
deleted file mode 100644
index 9d5e666a54..0000000000
--- a/main/gcc/gcc-spec-env.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1 Add support for external spec file via the GCC_SPECS env var. This
2 allows us to easily control pie/ssp defaults with gcc-config profiles.
3
4 Original patch by Rob Holland. Extended to support multiple
5 entries separated by ':' by Kevin F. Quinn
6
7--- gcc-4/gcc/gcc.c
8+++ gcc-4/gcc/gcc.c
9@@ -6482,6 +6482,32 @@
10
11 /* Process any user specified specs in the order given on the command
12 line. */
13+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
14+ /* Add specs listed in GCC_SPECS. Note; in the process of separating
15+ * each spec listed, the string is overwritten at token boundaries
16+ * (':') with '\0', an effect of strtok_r().
17+ */
18+ GET_ENVIRONMENT (specs_file, "GCC_SPECS");
19+ if (specs_file && (strlen(specs_file) > 0))
20+ {
21+ char *spec, *saveptr;
22+ for (spec=strtok_r(specs_file,":",&saveptr);
23+ spec!=NULL;
24+ spec=strtok_r(NULL,":",&saveptr))
25+ {
26+ struct user_specs *user = (struct user_specs *)
27+ xmalloc (sizeof (struct user_specs));
28+
29+ user->next = (struct user_specs *) 0;
30+ user->filename = spec;
31+ if (user_specs_tail)
32+ user_specs_tail->next = user;
33+ else
34+ user_specs_head = user;
35+ user_specs_tail = user;
36+ }
37+ }
38+#endif
39 for (uptr = user_specs_head; uptr; uptr = uptr->next)
40 {
41 char *filename = find_a_file (&startfile_prefixes, uptr->filename,
diff --git a/testing/gcc/uclibc-getipinfo.patch b/main/gcc/uclibc-getipinfo.patch
index 3abbbdd7ae..3abbbdd7ae 100644
--- a/testing/gcc/uclibc-getipinfo.patch
+++ b/main/gcc/uclibc-getipinfo.patch
diff --git a/testing/gcc/APKBUILD b/testing/gcc/APKBUILD
deleted file mode 100644
index 0dd1f35bcd..0000000000
--- a/testing/gcc/APKBUILD
+++ /dev/null
@@ -1,125 +0,0 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=gcc
3pkgver=4.4.1
4_specsver=0.1.4
5_espfver=0.3.1
6pkgrel=1
7pkgdesc="The GNU Compiler Collection"
8url="http://gcc.gnu.org"
9license="GPL LGPL"
10depends="binutils"
11makedepends="bison flex gmp-dev mpfr-dev texinfo"
12subpackages="$pkgname-doc libstdc++:libcxx g++:gpp libgcc libgomp"
13source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-core-$pkgver.tar.bz2
14 ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-g++-$pkgver.tar.bz2
15 http://weaver.gentooenterprise.com/hardened/patches/gcc-$pkgver-espf-$_espfver.tar.bz2
16 http://weaver.gentooenterprise.com/hardened/patches/gcc-$pkgver-specs-$_specsver.tar.bz2
17 gcc4-stack-protector-uclibc-no_tls.patch
18 pt_gnu_eh_frame.patch
19 uclibc-getipinfo.patch
20 "
21# ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-objc-$pkgver.tar.bz2
22build ()
23{
24 cd ${srcdir}/gcc-${pkgver}
25
26 # uclibc patches
27 for i in ../*.patch; do
28 msg "Applying $i"
29 patch -p1 -i $i || return 1
30 done
31
32 # ESPF patches. we dont use objc yet
33 rm -f ../espf-gcc-$pkgver/*_objc*lang-specs*.patch
34 # thanks to Zorry for hard work on those patches
35 for i in ../espf-gcc-$pkgver/*.patch; do
36 msg "Applying $i"
37 patch -p0 -i $i || return 1
38 done
39
40 echo ${pkgver} > gcc/BASE-VER
41 mkdir build
42 cd build
43 ../configure --prefix=/usr \
44 --mandir=/usr/share/man \
45 --infodir=/usr/share/info \
46 --build=${CHOST:-i486-alpine-linux-uclibc} \
47 --disable-altivec \
48 --disable-checking \
49 --disable-fixed-point \
50 --disable-libssp \
51 --disable-libstdcxx-pch \
52 --disable-multilib \
53 --disable-nls \
54 --disable-threads \
55 --disable-tls \
56 --disable-werror \
57 --enable-__cxa_atexit \
58 --enable-cld \
59 --enable-espf \
60 --enable-languages=c,c++ \
61 --enable-shared \
62 --enable-target-optspace \
63 --with-arch=i486 \
64 --with-system-zlib \
65 --without-system-libunwind
66
67 make || return 1
68 make -j1 DESTDIR="${pkgdir}" install || return 1
69 ln -s gcc "$pkgdir"/usr/bin/cc
70
71 # binutils provides libiberty.a
72 rm -f "$pkgdir"/usr/lib/libiberty.a
73
74 # install the specs
75 cd "$srcdir"/specs
76 install -d "$pkgdir"/usr/share/gcc
77 for i in *.specs; do
78 install -m644 $i "$pkgdir"/usr/share/gcc/$i || return 1
79 done
80}
81
82libcxx() {
83 pkgdesc="GNU C++ standard runtime library"
84 depends=
85 mkdir -p "$subpkgdir"/usr/lib
86 mv "$pkgdir"/usr/lib/libstdc++.so* "$subpkgdir"/usr/lib/
87}
88
89gpp() {
90 pkgdesc="GNU C++ standard library and compiler"
91 depends=
92 local libexec=usr/libexec/gcc/${CHOST:-i486-alpine-linux-uclibc}/$pkgver
93 mkdir -p "$subpkgdir/$libexec" \
94 "$subpkgdir"/usr/bin \
95 "$subpkgdir"/usr/include \
96 "$subpkgdir"/usr/lib \
97
98 mv "$pkgdir/$libexec/cc1plus" "$subpkgdir/$libexec/"
99 mv "$pkgdir"/usr/lib/*++* "$subpkgdir"/usr/lib/
100 mv "$pkgdir"/usr/include/c++ "$subpkgdir"/usr/include/
101 mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
102}
103
104libgcc() {
105 pkgdesc="GNU C compiler runtime libraries"
106 depends=
107 mkdir -p "$subpkgdir"/usr/lib
108 mv "$pkgdir"/usr/lib/libgcc_s.so* "$subpkgdir"/usr/lib/
109}
110
111libgomp() {
112 pkgdesc="GCC shared-memory parallel programming API library"
113 depends=
114 replaces="gcc"
115 mkdir -p "$subpkgdir"/usr/lib
116 mv "$pkgdir"/usr/lib/libgomp.so* "$subpkgdir"/usr/lib/
117}
118
119md5sums="d19693308aa6b2052e14c071111df59f gcc-core-4.4.1.tar.bz2
120d449047b5761348ceec23739f5553e0b gcc-g++-4.4.1.tar.bz2
12143d0bbd676bbb2acd67ddabd0ea1bc2b gcc-4.4.1-espf-0.3.1.tar.bz2
122da8d9165e828bbb9809ef86f1c72886f gcc-4.4.1-specs-0.1.4.tar.bz2
12315e77082db0e1a131af98debd3016290 gcc4-stack-protector-uclibc-no_tls.patch
1242db1e3482c5dd59dab70f701afa2ca80 pt_gnu_eh_frame.patch
1256cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch"
diff --git a/testing/gcc/gcc4-stack-protector-uclibc-no_tls.patch b/testing/gcc/gcc4-stack-protector-uclibc-no_tls.patch
deleted file mode 100644
index c9b54adbe1..0000000000
--- a/testing/gcc/gcc4-stack-protector-uclibc-no_tls.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1diff -u gcc/config/i386/linux.h gcc/config/i386/linux.h
2--- a/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60
3+++ b/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60
4@@ -186,7 +186,7 @@
5 /* This macro may be overridden in i386/k*bsd-gnu.h. */
6 #define REG_NAME(reg) reg
7
8-#ifdef TARGET_LIBC_PROVIDES_SSP
9+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
10 /* i386 glibc provides __stack_chk_guard in %gs:0x14. */
11 #define TARGET_THREAD_SSP_OFFSET 0x14
12 #endif
13diff -u gcc/config/i386/linux64.h gcc/config/i386/linux64.h
14--- a/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33
15+++ b/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33
16@@ -74,7 +74,7 @@
17 /* This macro may be overridden in i386/k*bsd-gnu.h. */
18 #define REG_NAME(reg) reg
19
20-#ifdef TARGET_LIBC_PROVIDES_SSP
21+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
22 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
23 x86_64 glibc provides it in %fs:0x28. */
24 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
25diff -u gcc/config/rs6000/linux.h gcc/config/rs6000/linux.h
26--- a/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53
27+++ b/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53
28@@ -114,7 +114,7 @@
29
30 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
31
32-#ifdef TARGET_LIBC_PROVIDES_SSP
33+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
34 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
35 #define TARGET_THREAD_SSP_OFFSET -0x7008
36 #endif
37diff -u gcc/config/rs6000/linux64.h gcc/config/rs6000/linux64.h
38--- a/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81
39+++ b/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81
40@@ -548,7 +548,7 @@
41
42 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
43
44-#ifdef TARGET_LIBC_PROVIDES_SSP
45+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
46 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
47 ppc64 glibc provides it at -0x7010(13). */
48 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)
49diff -u gcc/config/s390/linux.h gcc/config/s390/linux.h
50--- a/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40
51+++ b/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40
52@@ -94,7 +94,7 @@
53
54 #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
55
56-#ifdef TARGET_LIBC_PROVIDES_SSP
57+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
58 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
59 s390x glibc provides it at 0x28(tp). */
60 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
61diff -u gcc/config/sparc/linux.h gcc/config/sparc/linux.h
62--- a/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72
63+++ b/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72
64@@ -230,7 +230,7 @@
65 #undef NEED_INDICATE_EXEC_STACK
66 #define NEED_INDICATE_EXEC_STACK 1
67
68-#ifdef TARGET_LIBC_PROVIDES_SSP
69+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
70 /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */
71 #define TARGET_THREAD_SSP_OFFSET 0x14
72 #endif
73diff -u gcc/config/sparc/linux64.h gcc/config/sparc/linux64.h
74--- a/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95
75+++ b/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95
76@@ -364,7 +364,7 @@
77 #undef NEED_INDICATE_EXEC_STACK
78 #define NEED_INDICATE_EXEC_STACK 1
79
80-#ifdef TARGET_LIBC_PROVIDES_SSP
81+#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__
82 /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
83 sparc64 glibc provides it at [%g7 + 0x28]. */
84 #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
diff --git a/testing/gcc/pt_gnu_eh_frame.patch b/testing/gcc/pt_gnu_eh_frame.patch
deleted file mode 100644
index 3e029104aa..0000000000
--- a/testing/gcc/pt_gnu_eh_frame.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1--- gcc-4.3.2/gcc/crtstuff.c.orig Mon Nov 17 16:02:38 2008
2+++ gcc-4.3.2/gcc/crtstuff.c Mon Nov 17 16:02:52 2008
3@@ -94,8 +94,7 @@
4 #include <link.h>
5 /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
6 But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
7-# if !defined(__UCLIBC__) \
8- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
9+# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
10 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
11 # define USE_PT_GNU_EH_FRAME
12 # endif