1 |
commit: 8d6f5eeaafc371ae241c52e6acdc5fa8a5613f64 |
2 |
Author: layman <layman <AT> localhost> |
3 |
AuthorDate: Sat Jan 25 19:48:13 2014 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 25 19:51:06 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=8d6f5eea |
7 |
|
8 |
sys-devel/gcc: cp libgcc_s.so.1 to /usr/lib/ in musl's library path |
9 |
|
10 |
--- |
11 |
.../gcc/files/gcc-4.7.3-musl-linker-path.patch | 10 +++ |
12 |
sys-devel/gcc/files/gcc-spec-env-r1.patch | 87 ++++++++++++++++++++++ |
13 |
sys-devel/gcc/gcc-4.7.3-r99.ebuild | 13 ++++ |
14 |
.../{gcc-4.7.3-r99.ebuild => gcc-4.8.2-r99.ebuild} | 46 +++++++----- |
15 |
sys-devel/gcc/metadata.xml | 6 +- |
16 |
5 files changed, 140 insertions(+), 22 deletions(-) |
17 |
|
18 |
diff --git a/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch b/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch |
19 |
new file mode 100644 |
20 |
index 0000000..875a2d6 |
21 |
--- /dev/null |
22 |
+++ b/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch |
23 |
@@ -0,0 +1,10 @@ |
24 |
+diff -Nuar gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/linux64.h |
25 |
+--- gcc-4.7.3.orig/gcc/config/i386/linux64.h 2011-07-07 15:38:34.000000000 +0000 |
26 |
++++ gcc-4.7.3/gcc/config/i386/linux64.h 2014-01-25 17:11:52.126098018 +0000 |
27 |
+@@ -29,5 +29,5 @@ |
28 |
+ #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64" |
29 |
+ |
30 |
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" |
31 |
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" |
32 |
++#define GLIBC_DYNAMIC_LINKER64 "/usr/lib/libc.so" |
33 |
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" |
34 |
|
35 |
diff --git a/sys-devel/gcc/files/gcc-spec-env-r1.patch b/sys-devel/gcc/files/gcc-spec-env-r1.patch |
36 |
new file mode 100644 |
37 |
index 0000000..a589268 |
38 |
--- /dev/null |
39 |
+++ b/sys-devel/gcc/files/gcc-spec-env-r1.patch |
40 |
@@ -0,0 +1,87 @@ |
41 |
+2013-08-22 Magnus Granberg <zorry@g.o> |
42 |
+ |
43 |
+ * gcc/gcc.c (main): Add support for external spec file via the GCC_SPECS env var |
44 |
+ and move the process of the user specifed specs. |
45 |
+ |
46 |
+ This allows us to easily control pie/ssp defaults with gcc-config profiles. |
47 |
+ Original patch by Rob Holland |
48 |
+ Extended to support multiple entries separated by ':' by Kevin F. Quinn |
49 |
+ Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill |
50 |
+ Modified to process the GCC_SPECS env var befor DRIVER_SELF_SPECS by Magnus Granberg |
51 |
+ |
52 |
+--- gcc-4.8-20130210/gcc/gcc.c 2013-02-05 16:55:31.000000000 +0100 |
53 |
++++ gcc-4.8-20130210-work/gcc/gcc.c 2013-07-26 02:32:14.625089864 +0200 |
54 |
+@@ -6427,6 +6428,48 @@ main (int argc, char **argv) |
55 |
+ do_option_spec (option_default_specs[i].name, |
56 |
+ option_default_specs[i].spec); |
57 |
+ |
58 |
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) |
59 |
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating |
60 |
++ * each spec listed, the string is overwritten at token boundaries |
61 |
++ * (':') with '\0', an effect of strtok_r(). |
62 |
++ */ |
63 |
++ specs_file = getenv ("GCC_SPECS"); |
64 |
++ if (specs_file && (strlen(specs_file) > 0)) |
65 |
++ { |
66 |
++ char *spec, *saveptr; |
67 |
++ for (spec=strtok_r(specs_file,":",&saveptr); |
68 |
++ spec!=NULL; |
69 |
++ spec=strtok_r(NULL,":",&saveptr)) |
70 |
++ { |
71 |
++ struct user_specs *user = (struct user_specs *) |
72 |
++ xmalloc (sizeof (struct user_specs)); |
73 |
++ user->next = (struct user_specs *) 0; |
74 |
++ user->filename = spec; |
75 |
++ if (user_specs_tail) |
76 |
++ user_specs_tail->next = user; |
77 |
++ else |
78 |
++ user_specs_head = user; |
79 |
++ user_specs_tail = user; |
80 |
++ } |
81 |
++ } |
82 |
++#endif |
83 |
++ /* Process any user specified specs in the order given on the command |
84 |
++ * line. */ |
85 |
++ for (uptr = user_specs_head; uptr; uptr = uptr->next) |
86 |
++ { |
87 |
++ char *filename = find_a_file (&startfile_prefixes, uptr->filename, |
88 |
++ R_OK, true); |
89 |
++ read_specs (filename ? filename : uptr->filename, false, true); |
90 |
++ } |
91 |
++ /* Process any user self specs. */ |
92 |
++ { |
93 |
++ struct spec_list *sl; |
94 |
++ for (sl = specs; sl; sl = sl->next) |
95 |
++ if (sl->name_len == sizeof "self_spec" - 1 |
96 |
++ && !strcmp (sl->name, "self_spec")) |
97 |
++ do_self_spec (*sl->ptr_spec); |
98 |
++ } |
99 |
++ |
100 |
+ /* Process DRIVER_SELF_SPECS, adding any new options to the end |
101 |
+ of the command line. */ |
102 |
+ |
103 |
+@@ -6535,24 +6578,6 @@ main (int argc, char **argv) |
104 |
+ PREFIX_PRIORITY_LAST, 0, 1); |
105 |
+ } |
106 |
+ |
107 |
+- /* Process any user specified specs in the order given on the command |
108 |
+- line. */ |
109 |
+- for (uptr = user_specs_head; uptr; uptr = uptr->next) |
110 |
+- { |
111 |
+- char *filename = find_a_file (&startfile_prefixes, uptr->filename, |
112 |
+- R_OK, true); |
113 |
+- read_specs (filename ? filename : uptr->filename, false, true); |
114 |
+- } |
115 |
+- |
116 |
+- /* Process any user self specs. */ |
117 |
+- { |
118 |
+- struct spec_list *sl; |
119 |
+- for (sl = specs; sl; sl = sl->next) |
120 |
+- if (sl->name_len == sizeof "self_spec" - 1 |
121 |
+- && !strcmp (sl->name, "self_spec")) |
122 |
+- do_self_spec (*sl->ptr_spec); |
123 |
+- } |
124 |
+- |
125 |
+ if (compare_debug) |
126 |
+ { |
127 |
+ enum save_temps save; |
128 |
|
129 |
diff --git a/sys-devel/gcc/gcc-4.7.3-r99.ebuild b/sys-devel/gcc/gcc-4.7.3-r99.ebuild |
130 |
index d7de607..3a5a93d 100644 |
131 |
--- a/sys-devel/gcc/gcc-4.7.3-r99.ebuild |
132 |
+++ b/sys-devel/gcc/gcc-4.7.3-r99.ebuild |
133 |
@@ -2,6 +2,8 @@ |
134 |
# Distributed under the terms of the GNU General Public License v2 |
135 |
# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.7.3.ebuild,v 1.2 2013/05/20 10:56:06 aballier Exp $ |
136 |
|
137 |
+EAPI=4 |
138 |
+ |
139 |
PATCH_VER="1.0" |
140 |
UCLIBC_VER="1.0" |
141 |
|
142 |
@@ -41,6 +43,8 @@ src_unpack() { |
143 |
cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/ |
144 |
mv libitm/config/linux/x86 libitm/config/linux/x86_glibc |
145 |
cp -r libitm/config/generic libitm/config/linux/x86 |
146 |
+ |
147 |
+ epatch "${FILESDIR}"/${P}-musl-linker-path.patch |
148 |
fi |
149 |
|
150 |
use vanilla && return 0 |
151 |
@@ -48,6 +52,15 @@ src_unpack() { |
152 |
[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch |
153 |
} |
154 |
|
155 |
+src_install() { |
156 |
+ toolchain_src_install |
157 |
+ |
158 |
+ # Because /usr/lib/gcc/.. is not in musl search path |
159 |
+ # cp-ing libgcc_s.so.1 is the safest way but it does |
160 |
+ # mess up gcc-config which will need patching for this. |
161 |
+ cp "${D}"/usr/lib/gcc/${CHOST}/${PV}/libgcc_s.so.1 "${D}"/usr/lib |
162 |
+} |
163 |
+ |
164 |
pkg_setup() { |
165 |
toolchain_pkg_setup |
166 |
} |
167 |
|
168 |
diff --git a/sys-devel/gcc/gcc-4.7.3-r99.ebuild b/sys-devel/gcc/gcc-4.8.2-r99.ebuild |
169 |
similarity index 51% |
170 |
copy from sys-devel/gcc/gcc-4.7.3-r99.ebuild |
171 |
copy to sys-devel/gcc/gcc-4.8.2-r99.ebuild |
172 |
index d7de607..d99fab3 100644 |
173 |
--- a/sys-devel/gcc/gcc-4.7.3-r99.ebuild |
174 |
+++ b/sys-devel/gcc/gcc-4.8.2-r99.ebuild |
175 |
@@ -1,37 +1,50 @@ |
176 |
-# Copyright 1999-2013 Gentoo Foundation |
177 |
+# Copyright 1999-2014 Gentoo Foundation |
178 |
# Distributed under the terms of the GNU General Public License v2 |
179 |
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.7.3.ebuild,v 1.2 2013/05/20 10:56:06 aballier Exp $ |
180 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.8.2.ebuild,v 1.9 2014/01/19 01:51:34 dirtyepic Exp $ |
181 |
|
182 |
-PATCH_VER="1.0" |
183 |
+EAPI="2" |
184 |
+ |
185 |
+PATCH_VER="1.3r1" |
186 |
UCLIBC_VER="1.0" |
187 |
|
188 |
# Hardened gcc 4 stuff |
189 |
-PIE_VER="0.5.5" |
190 |
+PIE_VER="0.5.8r1" |
191 |
SPECS_VER="0.2.0" |
192 |
SPECS_GCC_VER="4.4.3" |
193 |
# arch/libc configurations known to be stable with {PIE,SSP}-by-default |
194 |
-PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64" |
195 |
-PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64" |
196 |
-SSP_STABLE="amd64 x86 ppc ppc64 arm" |
197 |
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64" |
198 |
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64" |
199 |
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm" |
200 |
# uclibc need tls and nptl support for SSP support |
201 |
# uclibc need to be >= 0.9.33 |
202 |
-SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm" |
203 |
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm" |
204 |
#end Hardened stuff |
205 |
|
206 |
-inherit toolchain eutils |
207 |
+inherit eutils toolchain |
208 |
|
209 |
DESCRIPTION="The GNU Compiler Collection" |
210 |
|
211 |
LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+" |
212 |
|
213 |
-KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 -amd64-fbsd -x86-fbsd" |
214 |
+KEYWORDS="" |
215 |
|
216 |
RDEPEND="" |
217 |
DEPEND="${RDEPEND} |
218 |
- >=${CATEGORY}/binutils-2.18" |
219 |
+ elibc_glibc? ( >=sys-libs/glibc-2.8 ) |
220 |
+ >=${CATEGORY}/binutils-2.20" |
221 |
+ |
222 |
+if [[ ${CATEGORY} != cross-* ]] ; then |
223 |
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )" |
224 |
+fi |
225 |
+ |
226 |
+src_prepare() { |
227 |
+ if has_version '<sys-libs/glibc-2.12' ; then |
228 |
+ ewarn "Your host glibc is too old; disabling automatic fortify." |
229 |
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315" |
230 |
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch" |
231 |
+ fi |
232 |
|
233 |
-src_unpack() { |
234 |
- toolchain_src_unpack |
235 |
+ toolchain_src_prepare |
236 |
|
237 |
if use elibc_musl; then |
238 |
cd "${S}" |
239 |
@@ -45,9 +58,6 @@ src_unpack() { |
240 |
|
241 |
use vanilla && return 0 |
242 |
|
243 |
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch |
244 |
-} |
245 |
- |
246 |
-pkg_setup() { |
247 |
- toolchain_pkg_setup |
248 |
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs. |
249 |
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch |
250 |
} |
251 |
|
252 |
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml |
253 |
index a595b18..cc0d5da 100644 |
254 |
--- a/sys-devel/gcc/metadata.xml |
255 |
+++ b/sys-devel/gcc/metadata.xml |
256 |
@@ -3,22 +3,20 @@ |
257 |
<pkgmetadata> |
258 |
<herd>toolchain</herd> |
259 |
<use> |
260 |
+ <flag name="awt">Useful only when building GCJ, this enables Abstract Window Toolkit |
261 |
+ (AWT) peer support on top of GTK+</flag> |
262 |
<flag name="d">Enable support for the D programming language</flag> |
263 |
<flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets |
264 |
in gcc (Warning: significantly increases compile time!)</flag> |
265 |
<flag name="go">Build the GCC Go language frontend.</flag> |
266 |
<flag name="graphite">Add support for the framework for loop |
267 |
optimizations based on a polyhedral intermediate representation</flag> |
268 |
- <flag name="gtk">Useful only when building GCJ, this enables Abstract Window Toolkit |
269 |
- (AWT) peer support on top of GTK+</flag> |
270 |
<flag name="ip28">Enable building a compiler capable of building a kernel |
271 |
for SGI Indigo2 Impact R10000 (IP28)</flag> |
272 |
<flag name="ip32r10k">Enable building a compiler capable of building an |
273 |
experimental kernel for SGI O2 w/ R1x000 CPUs (IP32)</flag> |
274 |
<flag name="libssp">Build SSP support into a dedicated library rather than use the |
275 |
code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag> |
276 |
- <flag name="lto">Add support for link-time optimizations (unsupported, use |
277 |
- at your own risk).</flag> |
278 |
<flag name="mudflap">Add support for mudflap, a pointer use checking library</flag> |
279 |
<flag name="multislot">Allow for SLOTs to include minor version (3.3.4 |
280 |
instead of just 3.3)</flag> |