aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-09-06 11:24:41 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-09-10 09:12:29 +0000
commitea0af854b52e5d2b44e6af094572e6ae38d1ba5a (patch)
tree9980f07181336553da3ae7452b7a69a41750f5fe
parent6a32c55e54342aadd5b4d4319ab084d34913e16b (diff)
downloadalpine_aports-ea0af854b52e5d2b44e6af094572e6ae38d1ba5a.tar.bz2
alpine_aports-ea0af854b52e5d2b44e6af094572e6ae38d1ba5a.tar.xz
alpine_aports-ea0af854b52e5d2b44e6af094572e6ae38d1ba5a.zip
main/gcc: fixes, support crosscompiler creation
- implement cross compiler creation - fix musl build - fix cross-building - fix ada to default to shared linking - fix gcc-gnat dependencies
-rw-r--r--main/gcc/APKBUILD279
-rw-r--r--main/gcc/ada-crossbuild.patch49
-rw-r--r--main/gcc/ada-fixes.patch47
-rw-r--r--main/gcc/ada-musl.patch118
-rw-r--r--main/gcc/ada-no-pie.patch22
-rw-r--r--main/gcc/ada-shared.patch30
-rw-r--r--main/gcc/fix-cxxflags-for-target.patch5
-rw-r--r--main/gcc/gcc-4.8-musl-fix-arm-interp.patch14
-rw-r--r--main/gcc/gcc-4.8-musl.patch297
9 files changed, 785 insertions, 76 deletions
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index 03d48edaed..c70f651e69 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -4,28 +4,68 @@ pkgver=4.8.1
4_piepatchver=0.5.6 4_piepatchver=0.5.6
5_specs_ver=0.2.0 5_specs_ver=0.2.0
6_specs_gcc_ver=4.4.3 6_specs_gcc_ver=4.4.3
7
8_uclibc_abiver=0.9.32 7_uclibc_abiver=0.9.32
9 8_cross=""
10pkgrel=2 9[ "$BOOTSTRAP" = "noheaders" ] && pkgname="gcc-pass1"
10[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
11[ "$CHOST" != "$CTARGET" ] && [ -n "$CHOST" -a -n "$CTARGET" ] \
12 && _cross="-$CTARGET"
13
14pkgname="$pkgname$_cross"
15pkgrel=3
11pkgdesc="The GNU Compiler Collection" 16pkgdesc="The GNU Compiler Collection"
12url="http://gcc.gnu.org" 17url="http://gcc.gnu.org"
13arch="all" 18arch="all"
14license="GPL LGPL" 19license="GPL LGPL"
15_gccrel=$pkgver-r$pkgrel 20_gccrel=$pkgver-r$pkgrel
16depends="binutils libgomp=$_gccrel" 21depends="binutils$_cross"
17makedepends="bison flex gmp-dev mpfr-dev texinfo mpc1-dev gawk zlib-dev zip 22makedepends_build="bison flex texinfo gawk zip"
18 cloog-dev !libiconv-dev !gettext-dev" 23makedepends_host="gmp-dev mpfr-dev mpc1-dev zlib-dev cloog-dev !libiconv-dev !gettext-dev"
19subpackages="$pkgname-doc libgcc libgomp libstdc++:libcxx g++:gpp" 24makedepends="$makedepends_build $makedepends_host"
25subpackages=" "
26[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_cross"
20replaces="libstdc++" 27replaces="libstdc++"
21 28
29: ${LANG_CXX:=true}
22: ${LANG_OBJC:=true} 30: ${LANG_OBJC:=true}
23: ${LANG_JAVA:=true} 31: ${LANG_JAVA:=true}
24: ${LANG_GO:=true} 32: ${LANG_GO:=true}
25: ${LANG_FORTRAN:=true} 33: ${LANG_FORTRAN:=true}
26: ${LANG_ADA:=true} 34: ${LANG_ADA:=true}
27 35
28if [ "$CBUILD" != "$CHOST" ]; then 36LIBGOMP=true
37LIBGCC=true
38LIBATOMIC=true
39LIBITM=true
40if [ "$CHOST" != "$CTARGET" ] && [ -n "$CHOST" -a -n "$CTARGET" ]; then
41 if [ "$BOOTSTRAP" ]; then
42 LANG_CXX=false
43 LANG_ADA=false
44 LIBGCC=false
45 _builddir="$srcdir/build-cross-pass2"
46 else
47 _builddir="$srcdir/build-cross-final"
48 fi
49 LANG_OBJC=false
50 LANG_JAVA=false
51 LANG_GO=false
52 LANG_FORTRAN=false
53 LIBGOMP=false
54 LIBATOMIC=false
55 LIBITM=false
56
57 # reset target flags (should be set in crosscreate abuild)
58 # fixup flags. seems gcc treats CPPFLAGS as global without
59 # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
60 export CFLAGS="$CPPFLAGS $CFLAGS"
61 export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
62 unset CPPFLAGS
63 [ -z "$CFLAGS_FOR_TARGET" ] && export CFLAGS_FOR_TARGET=" "
64 [ -z "$CXXFLAGS_FOR_TARGET" ] && export CXXFLAGS_FOR_TARGET=" "
65 [ -z "$LDFLAGS_FOR_TARGET" ] && export LDFLAGS_FOR_TARGET=" "
66
67 STRIP_FOR_TARGET="$CTARGET-strip"
68elif [ "$CBUILD" != "$CHOST" ] && [ -n "$CBUILD" -a -n "$CHOST" ]; then
29 # fixup flags. seems gcc treats CPPFLAGS as global without 69 # fixup flags. seems gcc treats CPPFLAGS as global without
30 # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. 70 # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
31 export CFLAGS="$CPPFLAGS $CFLAGS" 71 export CFLAGS="$CPPFLAGS $CFLAGS"
@@ -39,34 +79,51 @@ if [ "$CBUILD" != "$CHOST" ]; then
39 export CXXFLAGS_FOR_BUILD=" " 79 export CXXFLAGS_FOR_BUILD=" "
40 export LDFLAGS_FOR_BUILD=" " 80 export LDFLAGS_FOR_BUILD=" "
41 81
82 # Languages that do not need bootstrapping
42 LANG_OBJC=false 83 LANG_OBJC=false
43 LANG_JAVA=false 84 LANG_JAVA=false
44 LANG_GO=false 85 LANG_GO=false
45 LANG_FORTRAN=false 86 LANG_FORTRAN=false
46 # ada needs bootstrapping 87
47 LANG_ADA=true 88 STRIP_FOR_TARGET=${CROSS_COMPILE}strip
89 _builddir="$srcdir/build-cross-native"
90else
91 STRIP_FOR_TARGET=${CROSS_COMPILE}strip
92 _builddir="$srcdir/build"
48fi 93fi
49 94
50_languages=c,c++ 95if $LIBGCC; then
96 subpackages="$subpackages libgcc"
97fi
98if $LIBGOMP; then
99 depends="$depends libgomp=$_gccrel"
100 subpackages="$subpackages libgomp"
101fi
102
103_languages=c
104if $LANG_CXX; then
105 subpackages="$subpackages libstdc++:libcxx g++$_cross:gpp"
106 _languages="$_languages,c++"
107fi
51if $LANG_OBJC; then 108if $LANG_OBJC; then
52 subpackages="$subpackages libobjc $pkgname-objc" 109 subpackages="$subpackages libobjc gcc-objc$_cross:objc"
53 _languages="$_languages,objc" 110 _languages="$_languages,objc"
54fi 111fi
55if $LANG_JAVA; then 112if $LANG_JAVA; then
56 subpackages="$subpackages libgcj $pkgname-java" 113 subpackages="$subpackages libgcj gcc-java$_cross:java"
57 makedepends="$makedepends paxctl" 114 makedepends="$makedepends paxctl"
58 _languages="$_languages,java" 115 _languages="$_languages,java"
59fi 116fi
60if $LANG_GO; then 117if $LANG_GO; then
61 subpackages="$subpackages libgo $pkgname-go" 118 subpackages="$subpackages libgo gcc-go$_cross:go"
62 _languages="$_languages,go" 119 _languages="$_languages,go"
63fi 120fi
64if $LANG_FORTRAN; then 121if $LANG_FORTRAN; then
65 subpackages="$subpackages libgfortran libquadmath gfortran" 122 subpackages="$subpackages libgfortran libquadmath gfortran$_cross:gfortran"
66 _languages="$_languages,fortran" 123 _languages="$_languages,fortran"
67fi 124fi
68if $LANG_ADA; then 125if $LANG_ADA; then
69 subpackages="$subpackages libgnat $pkgname-gnat" 126 subpackages="$subpackages libgnat gcc-gnat$_cross:gnat"
70 _languages="$_languages,ada" 127 _languages="$_languages,ada"
71 makedepends="$makedepends gcc-gnat" 128 makedepends="$makedepends gcc-gnat"
72fi 129fi
@@ -87,6 +144,7 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
87 144
88 gcc-spec-env.patch 145 gcc-spec-env.patch
89 gcc-4.8-musl.patch 146 gcc-4.8-musl.patch
147 gcc-4.8-musl-fix-arm-interp.patch
90 libgcc-always-build-gcceh.a.patch 148 libgcc-always-build-gcceh.a.patch
91 pt_gnu_eh_frame.patch 149 pt_gnu_eh_frame.patch
92 uclibc-getipinfo.patch 150 uclibc-getipinfo.patch
@@ -97,16 +155,20 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
97 155
98 gcc-4.8-build-args.patch 156 gcc-4.8-build-args.patch
99 fix-cxxflags-passing.patch 157 fix-cxxflags-passing.patch
158 fix-cxxflags-for-target.patch
100 ada-no-pie.patch 159 ada-no-pie.patch
160 ada-fixes.patch
161 ada-crossbuild.patch
162 ada-shared.patch
163 ada-musl.patch
101 " 164 "
102 165
103# gcc-go.patch 166# gcc-go.patch
104 167
105# we build out-of-tree 168# we build out-of-tree
106_gccdir="$srcdir"/gcc-$pkgver 169_gccdir="$srcdir"/gcc-$pkgver
107_builddir="$srcdir/build" 170_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
108_gcclibdir=/usr/lib/gcc/${CHOST:-$_chost}/$pkgver 171_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
109_gcclibexec=/usr/libexec/gcc/${CHOST:-$_chost}/$pkgver
110 172
111prepare() { 173prepare() {
112 cd "$_gccdir" 174 cd "$_gccdir"
@@ -161,55 +223,71 @@ prepare() {
161build() { 223build() {
162 local _dynamic_linker= 224 local _dynamic_linker=
163 local _arch_configure= 225 local _arch_configure=
226 local _libc_configure=
227 local _cross_configure=
228 local _bootstrap_configure=
164 local _symvers= 229 local _symvers=
230
165 cd "$_gccdir" 231 cd "$_gccdir"
166 export CFLAGS="-fno-stack-protector $CFLAGS" 232 if [ -z "$CFLAGS_FOR_TARGET" ]; then
167 [ -z "$CBUILD" ] && CBUILD="$CHOST" 233 export CFLAGS="-fno-stack-protector $CFLAGS"
168 [ -z "$CTARGET" ] && CTARGET="$CHOST" 234 export CXXFLAGS="-fno-stack-protector $CXXFLAGS"
235 else
236 export CFLAGS_FOR_TARGET="-fno-stack-protector $CFLAGS_FOR_TARGET"
237 export CXXFLAGS_FOR_TARGET="-fno-stack-protector $CXXFLAGS_FOR_TARGET"
238 fi
169 239
170 case "$CHOST" in 240 case "$CTARGET" in
171 x86_64-*-uclibc) 241 x86_64-*-uclibc) _dynamic_linker="--with-dynamic-linker=ld64-uClibc.so.$_uclibc_abiver" ;;
172 _dynamic_linker="--with-dynamic-linker=ld64-uClibc.so.$_uclibc_abiver" 242 *-uclibc) _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver" ;;
173 ;; 243 x86_64-*-gnu) _dynamic_linker="--with-dynamic-linker=ld-linux-x86-64.so.2" ;;
174 *-uclibc) 244 *-gnu) _dynamic_linker="--with-dynamic-linker=ld-linux.so.2" ;;
175 _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver"
176 ;;
177 x86_64-*-gnu)
178 _dynamic_linker="--with-dynamic-linker=ld-linux-x86-64.so.2"
179 ;;
180 *-gnu)
181 _dynamic_linker="--with-dynamic-linker=ld-linux.so.2"
182 ;;
183 *) _dynamic_linker=
184 _symvers="--disable-symvers"
185 ;;
186 esac 245 esac
187 246
188 # disable symvers for non-glibc (uclibc/musl) 247 case "$CTARGET_ARCH" in
189 # ifunc attributes detection is broke in configure script so force 248 armhf) _arch_configure="--with-float=hard";;
190 # disable it for non-glibc. It is used heavily by Go lang.
191 case "$CHOST" in
192 *-gnu) ;;
193 *) export libat_cv_have_ifunc=no
194 ;;
195 esac 249 esac
196 250
197 # --enable-target-optspace is broken on powerpc 251 case "$CTARGET_LIBC" in
198 if [ "$CARCH" != "powerpc" ]; then 252 musl)
199 _arch_configure="$_arch_configure --enable-target-optspace" 253 # musl does not support mudflap
254 _libc_configure="--disable-libssp --disable-libmudflap"
255 _symvers="--disable-symvers"
256 export gcc_cv_libc_provides_ssp=yes
257 export libat_cv_have_ifunc=no
258 ;;
259 uclibc)
260 _libc_configure="--disable-libssp --without-system-libunwind"
261 export gcc_cv_libc_provides_ssp=yes
262 export libat_cv_have_ifunc=no
263 ;;
264 esac
265
266 if [ "$CHOST" != "$CTARGET" ]; then
267 _cross_configure="--disable-bootstrap --enable-clocale=gnu"
268 _cross_configure="$_cross_configure --with-sysroot=$CBUILDROOT"
200 fi 269 fi
201 270
202 case "$CARCH" in 271 case "$BOOTSTRAP" in
203 arm*) _arch_configure="$_arch_configure --with-float=hard";; 272 noheaders)
273 _bootstrap_configure="--with-newlib --without-headers --disable-shared --enable-threads=no"
274 ;;
275 nolibc)
276 _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no --disable-libquadmath"
277 ;;
278 *)
279 _bootstrap_configure="--enable-shared --enable-threads --enable-tls"
280 ;;
204 esac 281 esac
205 282
206 if [ "${CHOST#*musl}" != "$CHOST" ]; then 283 if ! $LIBGOMP; then
207 # musl does not support mudflap 284 _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
208 _arch_configure="$_arch_configure --disable-mudflap --disable-libmudflap" 285 fi
209 # gcc does not detect musl's ssp support, force it 286 if ! $LIBATOMIC; then
210 export gcc_cv_libc_provides_ssp=yes 287 _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
211 else 288 fi
212 _arch_configure="$_arch_configure --without-system-libunwind" 289 if ! $LIBITM; then
290 _bootstrap_configure="$_bootstrap_configure --disable-libitm"
213 fi 291 fi
214 292
215 msg "Building the following:" 293 msg "Building the following:"
@@ -217,9 +295,14 @@ build() {
217 echo " CBUILD=$CBUILD" 295 echo " CBUILD=$CBUILD"
218 echo " CHOST=$CHOST" 296 echo " CHOST=$CHOST"
219 echo " CTARGET=$CTARGET" 297 echo " CTARGET=$CTARGET"
298 echo " CTARGET_ARCH=$CTARGET_ARCH"
299 echo " CTARGET_LIBC=$CTARGET_LIBC"
220 echo " languages=$_languages" 300 echo " languages=$_languages"
221 echo " dynamic_linker=$_dynamic_linker" 301 echo " dynamic_linker=$_dynamic_linker"
222 echo " arch_configure=$_arch_configure" 302 echo " arch_configure=$_arch_configure"
303 echo " libc_configure=$_libc_configure"
304 echo " cross_configure=$_cross_configure"
305 echo " bootstrap_configure=$_bootstrap_configure"
223 echo "" 306 echo ""
224 307
225 mkdir -p "$_builddir" 308 mkdir -p "$_builddir"
@@ -235,7 +318,6 @@ build() {
235 --disable-build-with-cxx \ 318 --disable-build-with-cxx \
236 --disable-checking \ 319 --disable-checking \
237 --disable-fixed-point \ 320 --disable-fixed-point \
238 --disable-libssp \
239 --disable-libstdcxx-pch \ 321 --disable-libstdcxx-pch \
240 --disable-multilib \ 322 --disable-multilib \
241 --disable-nls \ 323 --disable-nls \
@@ -246,10 +328,10 @@ build() {
246 --enable-esp \ 328 --enable-esp \
247 --enable-cloog-backend \ 329 --enable-cloog-backend \
248 --enable-languages=$_languages \ 330 --enable-languages=$_languages \
249 --enable-shared \
250 $_arch_configure \ 331 $_arch_configure \
251 --enable-tls \ 332 $_libc_configure \
252 --enable-threads \ 333 $_cross_configure \
334 $_bootstrap_configure \
253 $_dynamic_linker \ 335 $_dynamic_linker \
254 --with-dynamic-linker-prefix=/lib \ 336 --with-dynamic-linker-prefix=/lib \
255 --with-system-zlib \ 337 --with-system-zlib \
@@ -285,7 +367,7 @@ package() {
285 || return 1 367 || return 1
286 368
287 # strip debug info from some statib libs 369 # strip debug info from some statib libs
288 ${CROSS_COMPILE}strip -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \ 370 ${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
289 -o -name libmudflap.a -o -name libmudflapth.a \ 371 -o -name libmudflap.a -o -name libmudflapth.a \
290 -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \ 372 -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
291 -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \ 373 -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
@@ -314,13 +396,23 @@ package() {
314 ln -s ../../../../${i##*/} $i || return 1 396 ln -s ../../../../${i##*/} $i || return 1
315 done 397 done
316 fi 398 fi
399
400 if [ "$CHOST" != "$CTARGET" ]; then
401 # cross-gcc: remove any files that would conflict with the
402 # native gcc package
403 rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
404 fi
317} 405}
318 406
319libcxx() { 407libcxx() {
320 pkgdesc="GNU C++ standard runtime library" 408 pkgdesc="GNU C++ standard runtime library"
321 depends= 409 depends=
410 CARCH="$CTARGET_ARCH"
411
322 mkdir -p "$subpkgdir"/usr/lib 412 mkdir -p "$subpkgdir"/usr/lib
323 mv "$pkgdir"/usr/lib/libstdc++.so.* "$subpkgdir"/usr/lib/ 413 mv "$pkgdir"/usr/lib/libstdc++.so.* "$subpkgdir"/usr/lib/ || \
414 cp "$pkgdir"/usr/$CTARGET/lib/libstdc++.so.* "$subpkgdir"/usr/lib/ || \
415 return 1
324} 416}
325 417
326gpp() { 418gpp() {
@@ -351,6 +443,7 @@ objc() {
351 pkgdesc="GNU Objective-C" 443 pkgdesc="GNU Objective-C"
352 replaces="gcc" 444 replaces="gcc"
353 depends="libc-dev gcc=$_gccrel libobjc=$_gccrel" 445 depends="libc-dev gcc=$_gccrel libobjc=$_gccrel"
446
354 mkdir -p "$subpkgdir"/$_gcclibdir/include \ 447 mkdir -p "$subpkgdir"/$_gcclibdir/include \
355 "$subpkgdir"/usr/lib \ 448 "$subpkgdir"/usr/lib \
356 || return 1 449 || return 1
@@ -363,14 +456,20 @@ objc() {
363libgcc() { 456libgcc() {
364 pkgdesc="GNU C compiler runtime libraries" 457 pkgdesc="GNU C compiler runtime libraries"
365 depends= 458 depends=
459 CARCH="$CTARGET_ARCH"
460
366 mkdir -p "$subpkgdir"/usr/lib 461 mkdir -p "$subpkgdir"/usr/lib
367 mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || return 1 462 mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || \
463 cp "$pkgdir"/usr/$CTARGET/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || \
464 return 1
368} 465}
369 466
370libgomp() { 467libgomp() {
371 pkgdesc="GCC shared-memory parallel programming API library" 468 pkgdesc="GCC shared-memory parallel programming API library"
372 depends= 469 depends=
373 replaces="gcc" 470 replaces="gcc"
471 CARCH="$CTARGET_ARCH"
472
374 mkdir -p "$subpkgdir"/usr/lib 473 mkdir -p "$subpkgdir"/usr/lib
375 mv "$pkgdir"/usr/lib/libgomp.so.* "$subpkgdir"/usr/lib/ 474 mv "$pkgdir"/usr/lib/libgomp.so.* "$subpkgdir"/usr/lib/
376} 475}
@@ -378,6 +477,7 @@ libgomp() {
378java() { 477java() {
379 pkgdesc="Java support for GCC" 478 pkgdesc="Java support for GCC"
380 depends="zlib-dev gcc=$_gccrel libgcj=$_gccrel" 479 depends="zlib-dev gcc=$_gccrel libgcj=$_gccrel"
480
381 paxctl -c -pm "$pkgdir"/$_gcclibexec/ecj1 || return 1 481 paxctl -c -pm "$pkgdir"/$_gcclibexec/ecj1 || return 1
382 mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib 482 mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib
383 cd "$pkgdir"/usr/bin 483 cd "$pkgdir"/usr/bin
@@ -403,6 +503,8 @@ libgcj() {
403 # libgcj_bc.so moved from gcc-java to libgcj 503 # libgcj_bc.so moved from gcc-java to libgcj
404 replaces="gcc-java" 504 replaces="gcc-java"
405 depends= 505 depends=
506 CARCH="$CTARGET_ARCH"
507
406 mkdir -p "$subpkgdir"/usr/bin 508 mkdir -p "$subpkgdir"/usr/bin
407 cd "$pkgdir"/usr/bin 509 cd "$pkgdir"/usr/bin
408 paxctl -c -pmse "$pkgdir"/usr/bin/gij || return 1 510 paxctl -c -pmse "$pkgdir"/usr/bin/gij || return 1
@@ -433,6 +535,8 @@ libgcj() {
433libgo() { 535libgo() {
434 pkgdesc="Go runtime library for GCC" 536 pkgdesc="Go runtime library for GCC"
435 depends= 537 depends=
538 CARCH="$CTARGET_ARCH"
539
436 mkdir -p "$subpkgdir"/usr/lib 540 mkdir -p "$subpkgdir"/usr/lib
437 mv "$pkgdir"/usr/lib/libgo.so.* "$subpkgdir"/usr/lib/ 541 mv "$pkgdir"/usr/lib/libgo.so.* "$subpkgdir"/usr/lib/
438} 542}
@@ -440,6 +544,7 @@ libgo() {
440go() { 544go() {
441 pkgdesc="Go support for GCC" 545 pkgdesc="Go support for GCC"
442 depends="gcc=$_gccrel libgo=$_gccrel" 546 depends="gcc=$_gccrel libgo=$_gccrel"
547
443 mkdir -p "$subpkgdir"/$_gcclibexec \ 548 mkdir -p "$subpkgdir"/$_gcclibexec \
444 "$subpkgdir"/usr/lib \ 549 "$subpkgdir"/usr/lib \
445 "$subpkgdir"/usr/bin || return 1 550 "$subpkgdir"/usr/bin || return 1
@@ -455,6 +560,8 @@ go() {
455libgfortran() { 560libgfortran() {
456 pkgdesc="Fortran runtime library for GCC" 561 pkgdesc="Fortran runtime library for GCC"
457 depends= 562 depends=
563 CARCH="$CTARGET_ARCH"
564
458 mkdir -p "$subpkgdir"/usr/lib 565 mkdir -p "$subpkgdir"/usr/lib
459 mv "$pkgdir"/usr/lib/libgfortran.so.* "$subpkgdir"/usr/lib/ 566 mv "$pkgdir"/usr/lib/libgfortran.so.* "$subpkgdir"/usr/lib/
460} 567}
@@ -463,6 +570,8 @@ libquadmath() {
463 replaces="gcc" 570 replaces="gcc"
464 pkgdesc="128-bit math library for GCC" 571 pkgdesc="128-bit math library for GCC"
465 depends= 572 depends=
573 CARCH="$CTARGET_ARCH"
574
466 mkdir -p "$subpkgdir"/usr/lib 575 mkdir -p "$subpkgdir"/usr/lib
467 mv "$pkgdir"/usr/lib/libquadmath.so.* "$subpkgdir"/usr/lib/ 576 mv "$pkgdir"/usr/lib/libquadmath.so.* "$subpkgdir"/usr/lib/
468} 577}
@@ -489,20 +598,26 @@ gfortran() {
489 598
490libgnat() { 599libgnat() {
491 pkgdesc="GNU Ada 95 runtime shared libraries" 600 pkgdesc="GNU Ada 95 runtime shared libraries"
601 depends=
602 CARCH="$CTARGET_ARCH"
603
492 mkdir -p "$subpkgdir"/usr/lib 604 mkdir -p "$subpkgdir"/usr/lib
493 mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/ 605 mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/
494} 606}
495 607
496gnat() { 608gnat() {
497 pkgdesc="Ada 95 support for GCC" 609 pkgdesc="Ada 95 support for GCC"
610 depends="gcc=$_gccrel"
611 [ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
612
498 mkdir -p "$subpkgdir"/$_gcclibexec \ 613 mkdir -p "$subpkgdir"/$_gcclibexec \
499 "$subpkgdir"/$_gcclibdir \ 614 "$subpkgdir"/$_gcclibdir \
500 "$subpkgdir"/usr/bin \ 615 "$subpkgdir"/usr/bin \
501 || return 1 616 || return 1
502 mv "$pkgdir"/$_gcclibexec/gnat* "$subpkgdir"/$_gcclibexec/ \ 617 mv "$pkgdir"/$_gcclibexec/*gnat* "$subpkgdir"/$_gcclibexec/ \
503 || return 1 618 || return 1
504 mv "$pkgdir"/$_gcclibdir/ada* "$subpkgdir"/$_gcclibdir/ || return 1 619 mv "$pkgdir"/$_gcclibdir/*ada* "$subpkgdir"/$_gcclibdir/ || return 1
505 mv "$pkgdir"/usr/bin/gnat* "$subpkgdir"/usr/bin/ || return 1 620 mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/ || return 1
506} 621}
507 622
508md5sums="3b2386c114cd74185aa3754b58a79304 gcc-4.8.1.tar.bz2 623md5sums="3b2386c114cd74185aa3754b58a79304 gcc-4.8.1.tar.bz2
@@ -518,7 +633,8 @@ d8692c56f04b92667096f59d843e95c5 51_all_libiberty-pic.patch
518ca4f395856bbb80d23398246572c30fa 67_all_gcc-poison-system-directories.patch 633ca4f395856bbb80d23398246572c30fa 67_all_gcc-poison-system-directories.patch
5199c443d9d0fba2ce97b12f674b7d14c7e 74_all_gcc48_cloog-dl.patch 6349c443d9d0fba2ce97b12f674b7d14c7e 74_all_gcc48_cloog-dl.patch
520a695d7648509b4f8e18b389a19e6037c gcc-spec-env.patch 635a695d7648509b4f8e18b389a19e6037c gcc-spec-env.patch
521cd8ef37289815c939adc954ba95e9294 gcc-4.8-musl.patch 636eb425b34df5a1646f27a7285e1a78916 gcc-4.8-musl.patch
637f925101cc9d21435c97a0bbd3542bd81 gcc-4.8-musl-fix-arm-interp.patch
522504c7dd8651c5d98229892c4cd9ea591 libgcc-always-build-gcceh.a.patch 638504c7dd8651c5d98229892c4cd9ea591 libgcc-always-build-gcceh.a.patch
523ab83248e10b2bf4b3d9240de0fefb52b pt_gnu_eh_frame.patch 639ab83248e10b2bf4b3d9240de0fefb52b pt_gnu_eh_frame.patch
5246cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch 6406cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch
@@ -528,7 +644,12 @@ ab83248e10b2bf4b3d9240de0fefb52b pt_gnu_eh_frame.patch
5282e2b787bb988d9007c9f7ce42178dfe6 gcc-pure64.patch 6442e2b787bb988d9007c9f7ce42178dfe6 gcc-pure64.patch
5290a2041bbf83648e6c4f6d3484f7249ca gcc-4.8-build-args.patch 6450a2041bbf83648e6c4f6d3484f7249ca gcc-4.8-build-args.patch
5304aea37d334ab00bb6bba37cd8c481367 fix-cxxflags-passing.patch 6464aea37d334ab00bb6bba37cd8c481367 fix-cxxflags-passing.patch
531ac802687c02ca78687c8e612277e566a ada-no-pie.patch" 64787684048ecaaf0e046983bc2782292dd fix-cxxflags-for-target.patch
648750e903d5a53ba32618c2142cdd914e1 ada-no-pie.patch
6492e946abc09924d91988a9b7fd5824ef3 ada-fixes.patch
650d77c99bf7c03d082a540aaba1193be40 ada-crossbuild.patch
65120e2731c02ce50739ebdead2795f9c41 ada-shared.patch
6524e47bdae120129462244da0d89a573b3 ada-musl.patch"
532sha256sums="545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 gcc-4.8.1.tar.bz2 653sha256sums="545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 gcc-4.8.1.tar.bz2
5334aa0ab0f114b0ff8af5d0c19c18930e3fcd5e5b0956f56ca24e58e5a243964b1 gcc-4.8.1-piepatches-v0.5.6.tar.bz2 6544aa0ab0f114b0ff8af5d0c19c18930e3fcd5e5b0956f56ca24e58e5a243964b1 gcc-4.8.1-piepatches-v0.5.6.tar.bz2
534f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 gcc-4.4.3-specs-0.2.0.tar.bz2 655f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -542,7 +663,8 @@ da6bbb5dc654d5e1df8ecae5c9ebb56265426c405931f14f5878248b8c79f78d 51_all_libiber
5428ba9dec0ecc2620c8ab1dfbeb0708dd4c29021e57d2e0ea23720108b1db3462e 67_all_gcc-poison-system-directories.patch 6638ba9dec0ecc2620c8ab1dfbeb0708dd4c29021e57d2e0ea23720108b1db3462e 67_all_gcc-poison-system-directories.patch
5437d129093a6682418da9313611a90e3052855d8af4505d401f7b8b6a64e8f7b17 74_all_gcc48_cloog-dl.patch 6647d129093a6682418da9313611a90e3052855d8af4505d401f7b8b6a64e8f7b17 74_all_gcc48_cloog-dl.patch
54464b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a gcc-spec-env.patch 66564b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a gcc-spec-env.patch
5458b85ebc6603a1b3488e1eb800fdb00168515ae154006398a1a08af57c1d3b5b5 gcc-4.8-musl.patch 666855ba44a4060a70213c39c6739751e8bfa8a8069f6a9712130df9a9b0f1070bc gcc-4.8-musl.patch
6676693a67eeff123e0261720463c51e8083bba6e93fed1e65f245731d23e8ff166 gcc-4.8-musl-fix-arm-interp.patch
5461975189156d70f5428cb7f1516533965d1c8734f3009fc89a9b8e289b72326f1 libgcc-always-build-gcceh.a.patch 6681975189156d70f5428cb7f1516533965d1c8734f3009fc89a9b8e289b72326f1 libgcc-always-build-gcceh.a.patch
54778e75cb378bdfe870c98ab3cffef37f54be729d3912979191f27ca00651ad6c4 pt_gnu_eh_frame.patch 66978e75cb378bdfe870c98ab3cffef37f54be729d3912979191f27ca00651ad6c4 pt_gnu_eh_frame.patch
54853184f842477569973c232dac7c85e71b0018cbe5c4962f95dd9e0273f42083e uclibc-getipinfo.patch 67053184f842477569973c232dac7c85e71b0018cbe5c4962f95dd9e0273f42083e uclibc-getipinfo.patch
@@ -552,7 +674,12 @@ f3863b997acf8fdf5ad1d3626b41a8a0670b896505e9b7afb517916c7599fb1c gcc-4.8-dynami
552f5473c6aea96d5137defd68898ba31042944a3f3ed26c05b964a40bd876c6f47 gcc-pure64.patch 674f5473c6aea96d5137defd68898ba31042944a3f3ed26c05b964a40bd876c6f47 gcc-pure64.patch
553bd7a6f514fcc457f29e5fda157203f3bcd013aeba5d53b3459196eef3ce752ab gcc-4.8-build-args.patch 675bd7a6f514fcc457f29e5fda157203f3bcd013aeba5d53b3459196eef3ce752ab gcc-4.8-build-args.patch
554a395ba4cf047c48cac56985726fddf0948f4425c9f1a0c9ddba1812b2b3d8300 fix-cxxflags-passing.patch 676a395ba4cf047c48cac56985726fddf0948f4425c9f1a0c9ddba1812b2b3d8300 fix-cxxflags-passing.patch
555a20f8ba10f6ee94c6af44752d9c43faf1c1ff3c631f18e3d85e2a7f2ca7f1e0d ada-no-pie.patch" 677a5678380e887dbf600c59273d382e81c10f89d28e422238a617d0a43ad5c5a69 fix-cxxflags-for-target.patch
678de3c8606015ebda0dc574f904aa4d23c44c5e261b34dce2ef4d08eed21cb99b9 ada-no-pie.patch
679556fcc3937d067e177acee7bbeeff80b0c5d445280c82e5af590db0f68143ebb ada-fixes.patch
680324524490c60d84ef040f79589e0f93fbaeb253dbe031484afaf963b881047e9 ada-crossbuild.patch
681d6c7fc1820a4fa285297c299c255fe2f19ce1695486f20edd098252a97545e6a ada-shared.patch
682f20c34f3e0a1bf717f5e22fd66b57c8b69f0411d063203c017ed8209f349e1d4 ada-musl.patch"
556sha512sums="1becc874aad77a469069b6d9da4158aae9e013e24afa9364fe4feff9a5094d0673ee7694b3840e892c860f73a56b3ece6174338a8214438c42b9f86dd6c35ea7 gcc-4.8.1.tar.bz2 683sha512sums="1becc874aad77a469069b6d9da4158aae9e013e24afa9364fe4feff9a5094d0673ee7694b3840e892c860f73a56b3ece6174338a8214438c42b9f86dd6c35ea7 gcc-4.8.1.tar.bz2
557274e16ef5136348415898d4e5a3bc71763078de8ae7c18645e8b07f54d705609b08c0efadbdb55117fdfb5f6490529b446d09def448174c2747372829d029a9d gcc-4.8.1-piepatches-v0.5.6.tar.bz2 684274e16ef5136348415898d4e5a3bc71763078de8ae7c18645e8b07f54d705609b08c0efadbdb55117fdfb5f6490529b446d09def448174c2747372829d029a9d gcc-4.8.1-piepatches-v0.5.6.tar.bz2
558779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 gcc-4.4.3-specs-0.2.0.tar.bz2 685779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -566,7 +693,8 @@ c6c314a2d24531b4286436dec7189f83e443c4cfa9b88339a4c324c2d40812d766ed44dcfd4a0c3b
56647331f034e44aea16f1cbb67d9176f8ce8832d6cb7c13a8d3b438efaa3269cee177bd1dd8a9f353ac19cc6b3db436a995de9ae66d493d2772188630b09fbff51 67_all_gcc-poison-system-directories.patch 69347331f034e44aea16f1cbb67d9176f8ce8832d6cb7c13a8d3b438efaa3269cee177bd1dd8a9f353ac19cc6b3db436a995de9ae66d493d2772188630b09fbff51 67_all_gcc-poison-system-directories.patch
5676e19b2dc43cff03a6b3ca4e18f76dcfd5b0682c15aac493e94f5c679f5b0a585fbaa09345d200182c0f47541ced2d714b78d65da130bc7d2e9f810362e07037d 74_all_gcc48_cloog-dl.patch 6946e19b2dc43cff03a6b3ca4e18f76dcfd5b0682c15aac493e94f5c679f5b0a585fbaa09345d200182c0f47541ced2d714b78d65da130bc7d2e9f810362e07037d 74_all_gcc48_cloog-dl.patch
568ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48 gcc-spec-env.patch 695ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48 gcc-spec-env.patch
56986ffdd09993004bc093233fcb1ea77d3a17965ccc0e09c59276b8f9e8ad79ae90eb6c6a3942472c638e9de31d2c83a25a46eee0903877033b46447e9f90258f8 gcc-4.8-musl.patch 6967ef97a8c79e3236ecd275e94ab87e65286744e8779d48f65c96fd456970abae483f414fbf1e201df12ae2e400fbab5376163dc090e6d9c2740873ed49f6ace40 gcc-4.8-musl.patch
6978c24d976b89b64f6c57a82b6c32f120f8bb4b8afef06ef86772df14309e04f5b3a62dbc7a953813666031efbedaae862bb3aa4d5242c7511231ecf61f87a7d77 gcc-4.8-musl-fix-arm-interp.patch
570d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch 698d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
5718464197f01d107872dfa6b47e86e95ae8d75c053527bafbdb7a86bcc7aff4bc5b20a8ec40d6e48d1ad455b0187a3cba9db337cff6c0a6245507c4533e4832d99 pt_gnu_eh_frame.patch 6998464197f01d107872dfa6b47e86e95ae8d75c053527bafbdb7a86bcc7aff4bc5b20a8ec40d6e48d1ad455b0187a3cba9db337cff6c0a6245507c4533e4832d99 pt_gnu_eh_frame.patch
572e3edf75df1f27af8771bd263e1bd607f6207c4eb5b2a5e11032577deba43ea201825e3b5008a720105f24e49d2821dd77a61c7ceba7ed91b3621c0dbd9292fc6 uclibc-getipinfo.patch 700e3edf75df1f27af8771bd263e1bd607f6207c4eb5b2a5e11032577deba43ea201825e3b5008a720105f24e49d2821dd77a61c7ceba7ed91b3621c0dbd9292fc6 uclibc-getipinfo.patch
@@ -576,4 +704,9 @@ e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0c
5764a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch 7044a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch
577abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch 705abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch
57835d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch 70635d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
579f00e0d57154fd7c0e121fa862b85b86943874edab8bc10e27a8b2bf363e55ea8690c091d8a07695493721a0185d52723e9f02279f7e618ece655e29b4e52b930 ada-no-pie.patch" 707c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch
7084938a38d6ffebebcd8b07a60e7d300935ef57056e5820145c6668dd5141e272d73a67a1bfe84dafda77212058eee768a03aba4356e52867b40a9ba9216a96714 ada-no-pie.patch
7090541b4e31164d3fed653e811c1ededcf0dc578220f11f4ca3d8a293b2cf1ebc62b4259afd103a5d24092cc738a5760efdd5310a6383d0d8152309562d04b0525 ada-fixes.patch
7104d411563f6a3ea06bc3a1f4fa77d10250cc275e2496df6039d93f9b2229bc1f5334e484494dbd08881cf046f98aaca8bdddaa6b4a8f947b936d0bdc9e91f2f2b ada-crossbuild.patch
7113f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
7127f6dc922a2c80b1c8c5ed0b6d6e4c1e672984f54bb217f28517929af129892e42c45f7aea4b9c50d8bbc008384b7ae19e1475c79f08b78775709720fe317c8f3 ada-musl.patch"
diff --git a/main/gcc/ada-crossbuild.patch b/main/gcc/ada-crossbuild.patch
new file mode 100644
index 0000000000..d3d2280cb6
--- /dev/null
+++ b/main/gcc/ada-crossbuild.patch
@@ -0,0 +1,49 @@
1Based on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55946
2
3--- gcc-4.8.1/libada/configure.orig
4+++ gcc-4.8.1/libada/configure
5@@ -2951,9 +2951,7 @@
6
7
8 # Determine what to build for 'gnatlib'
9-if test $build = $target \
10- && test ${enable_shared} = yes ; then
11- # Note that build=target is almost certainly the wrong test; FIXME
12+if test ${enable_shared} = yes ; then
13 default_gnatlib_target="gnatlib-shared"
14 else
15 default_gnatlib_target="gnatlib-plain"
16--- gcc-4.8.1/gcc/ada/gcc-interface/Make-lang.in.orig
17+++ gcc-4.8.1/gcc/ada/gcc-interface/Make-lang.in
18@@ -625,7 +625,7 @@
19 ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
20 -$(MKDIR) ada/doctools
21 $(CP) $^ ada/doctools
22- cd ada/doctools && $(GNATMAKE) -q xgnatugn
23+ cd ada/doctools && gnatmake -q xgnatugn
24
25 # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
26 # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
27--- gcc-4.8.1/gnattools/Makefile.in.orig
28+++ gcc-4.8.1/gnattools/Makefile.in
29@@ -32,6 +32,8 @@
30 # Nonstandard autoconf-set variables.
31 LN_S=@LN_S@
32 target_noncanonical=@target_noncanonical@
33+build=@build@
34+host=@host@
35
36 # Variables for the user (or the top level) to override.
37 exeext = @EXEEXT@
38@@ -183,7 +185,11 @@
39 # put the host RTS dir first in the PATH to hide the default runtime
40 # files that are among the sources
41 # FIXME: This should be done in configure.
42+ifeq ($(host), $(build))
43 RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
44+else
45+RTS_DIR:=$(strip $(subst \,/,$(shell $(host)-gnatls -v | grep adalib )))
46+endif
47 gnattools-cross: $(GCC_DIR)/stamp-tools
48 # gnattools1-re
49 $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
diff --git a/main/gcc/ada-fixes.patch b/main/gcc/ada-fixes.patch
new file mode 100644
index 0000000000..db9a3e3ebe
--- /dev/null
+++ b/main/gcc/ada-fixes.patch
@@ -0,0 +1,47 @@
1--- gcc-4.8.1/gcc/ada/terminals.c.orig
2+++ gcc-4.8.1/gcc/ada/terminals.c
3@@ -984,13 +984,6 @@
4 #include <stdio.h>
5 #include <stdlib.h>
6
7-/* On some system termio is either absent or including it will disable termios
8- (HP-UX) */
9-#if ! defined (__hpux__) && ! defined (FREEBSD) && \
10- ! defined (__APPLE__) && ! defined(__rtems__)
11-# include <termio.h>
12-#endif
13-
14 #include <sys/ioctl.h>
15 #include <termios.h>
16 #include <fcntl.h>
17@@ -1032,10 +1025,8 @@
18 */
19
20 /* Configurable part */
21-#if defined (__APPLE__) || defined (FREEBSD)
22+#if defined (__APPLE__) || defined (FREEBSD) || defined(linux)
23 #define USE_OPENPTY
24-#elif defined (linux)
25-#define USE_GETPT
26 #elif defined (sun)
27 #define USE_CLONE_DEVICE "/dev/ptmx"
28 #elif defined (_AIX)
29@@ -1179,7 +1170,7 @@
30 int status;
31
32 /* ensure that s is filled with 0 */
33- bzero (&s, sizeof (&s));
34+ bzero (&s, sizeof (s));
35
36 /* Get the current terminal settings */
37 status = tcgetattr (fd, &s);
38--- gcc-4.8.1/gcc/ada/cal.c.orig
39+++ gcc-4.8.1/gcc/ada/cal.c
40@@ -65,6 +65,7 @@
41 #include <time.h>
42 #else
43 #include <sys/time.h>
44+#include <time.h>
45 #endif
46
47 #ifdef __MINGW32__
diff --git a/main/gcc/ada-musl.patch b/main/gcc/ada-musl.patch
new file mode 100644
index 0000000000..8255e3b36e
--- /dev/null
+++ b/main/gcc/ada-musl.patch
@@ -0,0 +1,118 @@
1--- gcc-4.8.1/gcc/ada/adaint.c.orig
2+++ gcc-4.8.1/gcc/ada/adaint.c
3@@ -67,6 +67,11 @@
4 #include <sys/pstat.h>
5 #endif
6
7+#if defined (linux)
8+#define _GNU_SOURCE 1
9+#include <sched.h>
10+#endif
11+
12 #ifdef VMS
13 #define _POSIX_EXIT 1
14 #define HOST_EXECUTABLE_SUFFIX ".exe"
15@@ -3782,8 +3787,6 @@
16 return (void *) syscall (__NR_gettid);
17 }
18
19-#include <sched.h>
20-
21 /* glibc versions earlier than 2.7 do not define the routines to handle
22 dynamically allocated CPU sets. For these targets, we use the static
23 versions. */
24@@ -3792,7 +3795,7 @@
25
26 /* Dynamic cpu sets */
27
28-cpu_set_t *__gnat_cpu_alloc (size_t count)
29+void *__gnat_cpu_alloc (size_t count)
30 {
31 return CPU_ALLOC (count);
32 }
33@@ -3802,30 +3805,30 @@
34 return CPU_ALLOC_SIZE (count);
35 }
36
37-void __gnat_cpu_free (cpu_set_t *set)
38+void __gnat_cpu_free (void *set)
39 {
40- CPU_FREE (set);
41+ CPU_FREE ((cpu_set_t *) set);
42 }
43
44-void __gnat_cpu_zero (size_t count, cpu_set_t *set)
45+void __gnat_cpu_zero (size_t count, void *set)
46 {
47- CPU_ZERO_S (count, set);
48+ CPU_ZERO_S (count, (cpu_set_t *) set);
49 }
50
51-void __gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
52+void __gnat_cpu_set (int cpu, size_t count, void *set)
53 {
54 /* Ada handles CPU numbers starting from 1, while C identifies the first
55 CPU by a 0, so we need to adjust. */
56- CPU_SET_S (cpu - 1, count, set);
57+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
58 }
59
60 #else
61
62 /* Static cpu sets */
63
64-cpu_set_t *__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
65+void *__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
66 {
67- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
68+ return xmalloc (sizeof (cpu_set_t));
69 }
70
71 size_t __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
72@@ -3833,21 +3836,21 @@
73 return sizeof (cpu_set_t);
74 }
75
76-void __gnat_cpu_free (cpu_set_t *set)
77+void __gnat_cpu_free (void *set)
78 {
79 free (set);
80 }
81
82-void __gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
83+void __gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
84 {
85- CPU_ZERO (set);
86+ CPU_ZERO ((cpu_set_t *) set);
87 }
88
89-void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
90+void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
91 {
92 /* Ada handles CPU numbers starting from 1, while C identifies the first
93 CPU by a 0, so we need to adjust. */
94- CPU_SET (cpu - 1, set);
95+ CPU_SET (cpu - 1, (cpu_set_t *) set);
96 }
97 #endif
98 #endif
99--- gcc-4.8.1/gcc/ada/adaint.h.orig
100+++ gcc-4.8.1/gcc/ada/adaint.h
101@@ -259,13 +259,11 @@
102
103 /* Routines for interface to required CPU set primitives */
104
105-#include <sched.h>
106-
107-extern cpu_set_t *__gnat_cpu_alloc (size_t);
108+extern void * __gnat_cpu_alloc (size_t);
109 extern size_t __gnat_cpu_alloc_size (size_t);
110-extern void __gnat_cpu_free (cpu_set_t *);
111-extern void __gnat_cpu_zero (size_t, cpu_set_t *);
112-extern void __gnat_cpu_set (int, size_t, cpu_set_t *);
113+extern void __gnat_cpu_free (void *);
114+extern void __gnat_cpu_zero (size_t, void *);
115+extern void __gnat_cpu_set (int, size_t, void *);
116 #endif
117
118 #if defined (_WIN32)
diff --git a/main/gcc/ada-no-pie.patch b/main/gcc/ada-no-pie.patch
index e5bdfdea1e..a38db87196 100644
--- a/main/gcc/ada-no-pie.patch
+++ b/main/gcc/ada-no-pie.patch
@@ -1,5 +1,5 @@
1--- ./gcc/ada/gcc-interface/Makefile.in.orig 2013-02-06 11:19:08.000000000 +0000 1--- gcc-4.8.1/gcc/ada/gcc-interface/Makefile.in.orig
2+++ ./gcc/ada/gcc-interface/Makefile.in 2013-08-30 07:52:29.016804483 +0000 2+++ gcc-4.8.1/gcc/ada/gcc-interface/Makefile.in
3@@ -2462,23 +2462,23 @@ 3@@ -2462,23 +2462,23 @@
4 gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \ 4 gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
5 gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) 5 gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
@@ -33,6 +33,24 @@
33 33
34 ../../gnatsym$(exeext): ../stamp-tools 34 ../../gnatsym$(exeext): ../stamp-tools
35 $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)" 35 $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
36@@ -2500,7 +2500,7 @@
37 $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
38 $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
39 $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
40- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
41+ --GCC="$(GCC_LINK)" -fno-PIE $(TOOLS_LIBS)
42
43 # Note the use of the "mv" command in order to allow gnatlink to be linked with
44 # with the former version of gnatlink itself which cannot override itself.
45@@ -2510,7 +2510,7 @@
46 $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
47 $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
48 $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
49- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
50+ --GCC="$(GCC_LINK)" -fno-PIE $(TOOLS_LIBS)
51 $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext)
52
53 # Needs to be built with CC=gcc
36@@ -2519,11 +2519,11 @@ 54@@ -2519,11 +2519,11 @@
37 55
38 # Likewise for the tools 56 # Likewise for the tools
diff --git a/main/gcc/ada-shared.patch b/main/gcc/ada-shared.patch
new file mode 100644
index 0000000000..6f1c16aff9
--- /dev/null
+++ b/main/gcc/ada-shared.patch
@@ -0,0 +1,30 @@
1Index: b/gcc/ada/link.c
2===================================================================
3--- a/gcc/ada/link.c
4+++ b/gcc/ada/link.c
5@@ -105,9 +105,9 @@
6
7 #elif defined (__FreeBSD__)
8 const char *__gnat_object_file_option = "-Wl,@";
9-const char *__gnat_run_path_option = "-Wl,-rpath,";
10-char __gnat_shared_libgnat_default = STATIC;
11-char __gnat_shared_libgcc_default = STATIC;
12+const char *__gnat_run_path_option = "";
13+char __gnat_shared_libgnat_default = SHARED;
14+char __gnat_shared_libgcc_default = SHARED;
15 int __gnat_link_max = 8192;
16 unsigned char __gnat_objlist_file_supported = 1;
17 const char *__gnat_object_library_extension = ".a";
18@@ -127,9 +127,9 @@
19
20 #elif defined (linux) || defined(__GLIBC__)
21 const char *__gnat_object_file_option = "-Wl,@";
22-const char *__gnat_run_path_option = "-Wl,-rpath,";
23-char __gnat_shared_libgnat_default = STATIC;
24-char __gnat_shared_libgcc_default = STATIC;
25+const char *__gnat_run_path_option = "";
26+char __gnat_shared_libgnat_default = SHARED;
27+char __gnat_shared_libgcc_default = SHARED;
28 int __gnat_link_max = 8192;
29 unsigned char __gnat_objlist_file_supported = 1;
30 const char *__gnat_object_library_extension = ".a";
diff --git a/main/gcc/fix-cxxflags-for-target.patch b/main/gcc/fix-cxxflags-for-target.patch
new file mode 100644
index 0000000000..24dafe74be
--- /dev/null
+++ b/main/gcc/fix-cxxflags-for-target.patch
@@ -0,0 +1,5 @@
1--- gcc-4.8.1/config/mt-gnu.orig
2+++ gcc-4.8.1/config/mt-gnu
3@@ -1 +1 @@
4-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
5+CXXFLAGS_FOR_TARGET := $(CXXFLAGS_FOR_TARGET) -D_GNU_SOURCE
diff --git a/main/gcc/gcc-4.8-musl-fix-arm-interp.patch b/main/gcc/gcc-4.8-musl-fix-arm-interp.patch
new file mode 100644
index 0000000000..6629d74318
--- /dev/null
+++ b/main/gcc/gcc-4.8-musl-fix-arm-interp.patch
@@ -0,0 +1,14 @@
1--- a/gcc/config/arm/linux-eabi.h
2+++ b/gcc/config/arm/linux-eabi.h
3@@ -64,7 +64,10 @@
4
5 /* musl has no "classic" (i.e. broken) mode */
6 #undef MUSL_DYNAMIC_LINKER
7-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
8+#define MUSL_DYNAMIC_LINKER \
9+ "%{mfloat-abi=hard:/lib/ld-musl-armhf.so.1}" \
10+ "%{mfloat-abi=soft*:/lib/ld-musl-arm.so.1}" \
11+ "%{!mfloat-abi=*:/lib/ld-musl-armhf.so.1}"
12
13 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
14 use the GNU/Linux version, not the generic BPABI version. */
diff --git a/main/gcc/gcc-4.8-musl.patch b/main/gcc/gcc-4.8-musl.patch
index 4c32a3e589..dcc9ad71ad 100644
--- a/main/gcc/gcc-4.8-musl.patch
+++ b/main/gcc/gcc-4.8-musl.patch
@@ -1,4 +1,3 @@
111b7c7e47a01 tip
2# HG changeset patch 1# HG changeset patch
3# Parent 6b1b8174ce29396d7dbd482296f43eba38948222 2# Parent 6b1b8174ce29396d7dbd482296f43eba38948222
4Support for arm-linux-musl. 3Support for arm-linux-musl.
@@ -32,6 +31,19 @@ diff -r 6b1b8174ce29 libitm/config/arm/hwcap.cc
32 #include <elf.h> 31 #include <elf.h>
33 32
34 static void __attribute__((constructor)) 33 static void __attribute__((constructor))
34--- a/gcc/configure
35+++ b/gcc/configure
36@@ -26970,6 +26970,9 @@
37 gcc_cv_target_dl_iterate_phdr=no
38 fi
39 ;;
40+ *-linux-musl*)
41+ gcc_cv_target_dl_iterate_phdr=yes
42+ ;;
43 esac
44
45 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
46
35# HG changeset patch 47# HG changeset patch
36# Parent 2b29df135cf04fe23c38301f6d0fc5796366aecf 48# Parent 2b29df135cf04fe23c38301f6d0fc5796366aecf
37Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker. 49Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
@@ -180,6 +192,246 @@ diff -r 2b94537ce249 libgomp/config/posix/time.c
180 #include <unistd.h> 192 #include <unistd.h>
181 #if TIME_WITH_SYS_TIME 193 #if TIME_WITH_SYS_TIME
182# HG changeset patch 194# HG changeset patch
195# Parent 94e435662aff38e86c9ca0dff4bbf451e0190b34
196Get rid of ever-broken fixincludes on musl.
197
198
199diff -r 94e435662aff -r e27957848dc8 fixincludes/mkfixinc.sh
200--- a/fixincludes/mkfixinc.sh Sat Jul 27 23:37:20 2013 -0400
201+++ b/fixincludes/mkfixinc.sh Sat Jul 27 23:43:03 2013 -0400
202@@ -19,7 +19,8 @@
203 powerpc-*-eabi* | \
204 powerpc-*-rtems* | \
205 powerpcle-*-eabisim* | \
206- powerpcle-*-eabi* )
207+ powerpcle-*-eabi* | \
208+ *-musl* )
209 # IF there is no include fixing,
210 # THEN create a no-op fixer and exit
211 (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
212# HG changeset patch
213# Parent 8eb8b35e72f3987450f5050db45d6e4425084fb5
214libssp is provided in musl libc.
215
216diff -r 8eb8b35e72f3 gcc/configure
217--- a/gcc/configure Mon Aug 26 15:14:02 2013 -0400
218+++ b/gcc/configure Mon Aug 26 15:46:55 2013 -0400
219@@ -26764,7 +26764,8 @@
220 gcc_cv_libc_provides_ssp=yes
221 fi
222 ;;
223- *-*-gnu*)
224+ *-*-gnu* | \
225+ *-linux-musl*)
226 # Avoid complicated tests (see
227 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
228 # simply assert that glibc does provide this, which is true for all
229diff -r 8eb8b35e72f3 gcc/configure.ac
230--- a/gcc/configure.ac Mon Aug 26 15:14:02 2013 -0400
231+++ b/gcc/configure.ac Mon Aug 26 15:46:55 2013 -0400
232@@ -4747,7 +4747,8 @@
233 gcc_cv_libc_provides_ssp=yes
234 fi]
235 ;;
236- *-*-gnu*)
237+ *-*-gnu* | \
238+ *-linux-musl*)
239 # Avoid complicated tests (see
240 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
241 # simply assert that glibc does provide this, which is true for all
242@@ -4817,6 +4818,9 @@
243 gcc_cv_target_dl_iterate_phdr=no
244 fi
245 ;;
246+ *-linux-musl*)
247+ gcc_cv_target_dl_iterate_phdr=yes
248+ ;;
249 esac
250 GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
251 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
252diff -r 8eb8b35e72f3 libssp/Makefile.am
253--- a/libssp/Makefile.am Mon Aug 26 15:14:02 2013 -0400
254+++ b/libssp/Makefile.am Mon Aug 26 15:46:55 2013 -0400
255@@ -36,7 +36,11 @@
256
257 AM_CFLAGS = -Wall
258
259+if LIBSSP_IN_LIBC
260+toolexeclib_LTLIBRARIES = libssp_nonshared.la
261+else
262 toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
263+endif
264
265 target_noncanonical = @target_noncanonical@
266 libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
267diff -r 8eb8b35e72f3 libssp/Makefile.in
268--- a/libssp/Makefile.in Mon Aug 26 15:14:02 2013 -0400
269+++ b/libssp/Makefile.in Mon Aug 26 15:46:55 2013 -0400
270@@ -93,12 +93,17 @@
271 libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
272 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
273 $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@
274+@LIBSSP_IN_LIBC_FALSE@am_libssp_la_rpath = -rpath $(toolexeclibdir)
275 am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
276 libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
277 libssp_nonshared_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
278 $(LIBTOOLFLAGS) --mode=link $(CCLD) \
279 $(libssp_nonshared_la_CFLAGS) $(CFLAGS) \
280 $(libssp_nonshared_la_LDFLAGS) $(LDFLAGS) -o $@
281+@LIBSSP_IN_LIBC_FALSE@am_libssp_nonshared_la_rpath = -rpath \
282+@LIBSSP_IN_LIBC_FALSE@ $(toolexeclibdir)
283+@LIBSSP_IN_LIBC_TRUE@am_libssp_nonshared_la_rpath = -rpath \
284+@LIBSSP_IN_LIBC_TRUE@ $(toolexeclibdir)
285 DEFAULT_INCLUDES = -I.@am__isrc@
286 depcomp = $(SHELL) $(top_srcdir)/../depcomp
287 am__depfiles_maybe = depfiles
288@@ -258,7 +263,8 @@
289 @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
290 @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
291 AM_CFLAGS = -Wall
292-toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
293+@LIBSSP_IN_LIBC_FALSE@toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
294+@LIBSSP_IN_LIBC_TRUE@toolexeclib_LTLIBRARIES = libssp_nonshared.la
295 libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
296 nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
297 libssp_la_SOURCES = \
298@@ -414,9 +420,9 @@
299 rm -f "$${dir}/so_locations"; \
300 done
301 libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES)
302- $(libssp_la_LINK) -rpath $(toolexeclibdir) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
303+ $(libssp_la_LINK) $(am_libssp_la_rpath) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
304 libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_DEPENDENCIES)
305- $(libssp_nonshared_la_LINK) -rpath $(toolexeclibdir) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
306+ $(libssp_nonshared_la_LINK) $(am_libssp_nonshared_la_rpath) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
307
308 mostlyclean-compile:
309 -rm -f *.$(OBJEXT)
310diff -r 8eb8b35e72f3 libssp/configure
311--- a/libssp/configure Mon Aug 26 15:14:02 2013 -0400
312+++ b/libssp/configure Mon Aug 26 15:46:55 2013 -0400
313@@ -626,6 +626,8 @@
314 ssp_have_usable_vsnprintf
315 EGREP
316 GREP
317+LIBSSP_IN_LIBC_FALSE
318+LIBSSP_IN_LIBC_TRUE
319 LIBSSP_USE_SYMVER_SUN_FALSE
320 LIBSSP_USE_SYMVER_SUN_TRUE
321 LIBSSP_USE_SYMVER_GNU_FALSE
322@@ -735,6 +737,7 @@
323 enable_multilib
324 enable_dependency_tracking
325 enable_symvers
326+enable_ssp_in_libc
327 enable_shared
328 enable_static
329 with_pic
330@@ -1374,6 +1377,7 @@
331 --disable-dependency-tracking speeds up one-time build
332 --enable-dependency-tracking do not reject slow dependency extractors
333 --disable-symvers disable symbol versioning for libssp
334+ --enable-ssp-in-libc do not build SSP, as it is in libc
335 --enable-shared[=PKGS] build shared libraries [default=yes]
336 --enable-static[=PKGS] build static libraries [default=yes]
337 --enable-fast-install[=PKGS]
338@@ -4206,6 +4210,36 @@
339 fi
340
341
342+# musl provides libssp in libc
343+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libssp is provided in libc" >&5
344+$as_echo_n "checking whether libssp is provided in libc... " >&6; }
345+# Check whether --enable-ssp_in_libc was given.
346+if test "${enable_ssp_in_libc+set}" = set; then :
347+ enableval=$enable_ssp_in_libc; ssp_in_libc=$enableval
348+else
349+ ssp_in_libc=check
350+fi
351+
352+if test "x$ssp_in_libc" = "xcheck"; then
353+ case "$host" in
354+ *-musl*)
355+ ssp_in_libc=yes
356+ ;;
357+
358+ *)
359+ ssp_in_libc=no
360+ ;;
361+ esac
362+fi
363+ if test "x$ssp_in_libc" = xyes; then
364+ LIBSSP_IN_LIBC_TRUE=
365+ LIBSSP_IN_LIBC_FALSE='#'
366+else
367+ LIBSSP_IN_LIBC_TRUE='#'
368+ LIBSSP_IN_LIBC_FALSE=
369+fi
370+
371+
372
373 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
374 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
375@@ -10658,7 +10692,7 @@
376 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
377 lt_status=$lt_dlunknown
378 cat > conftest.$ac_ext <<_LT_EOF
379-#line 10661 "configure"
380+#line 10695 "configure"
381 #include "confdefs.h"
382
383 #if HAVE_DLFCN_H
384@@ -10764,7 +10798,7 @@
385 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
386 lt_status=$lt_dlunknown
387 cat > conftest.$ac_ext <<_LT_EOF
388-#line 10767 "configure"
389+#line 10801 "configure"
390 #include "confdefs.h"
391
392 #if HAVE_DLFCN_H
393@@ -11193,6 +11227,10 @@
394 as_fn_error "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
395 Usually this means the macro was only invoked conditionally." "$LINENO" 5
396 fi
397+if test -z "${LIBSSP_IN_LIBC_TRUE}" && test -z "${LIBSSP_IN_LIBC_FALSE}"; then
398+ as_fn_error "conditional \"LIBSSP_IN_LIBC\" was never defined.
399+Usually this means the macro was only invoked conditionally." "$LINENO" 5
400+fi
401
402 : ${CONFIG_STATUS=./config.status}
403 ac_write_fail=0
404diff -r 8eb8b35e72f3 libssp/configure.ac
405--- a/libssp/configure.ac Mon Aug 26 15:14:02 2013 -0400
406+++ b/libssp/configure.ac Mon Aug 26 15:46:55 2013 -0400
407@@ -114,6 +114,26 @@
408 AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu])
409 AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun])
410
411+# musl provides libssp in libc
412+AC_MSG_CHECKING([whether libssp is provided in libc])
413+AC_ARG_ENABLE(ssp_in_libc,
414+AC_HELP_STRING([--enable-ssp-in-libc],
415+ [do not build SSP, as it is in libc]),
416+ssp_in_libc=$enableval,
417+ssp_in_libc=check)
418+if test "x$ssp_in_libc" = "xcheck"; then
419+ case "$host" in
420+ *-musl*)
421+ ssp_in_libc=yes
422+ ;;
423+
424+ *)
425+ ssp_in_libc=no
426+ ;;
427+ esac
428+fi
429+AM_CONDITIONAL(LIBSSP_IN_LIBC, [test "x$ssp_in_libc" = xyes])
430+
431 AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
432
433 if test x$gcc_no_link = xyes; then
434# HG changeset patch
183# Parent f50bb54f331f73405131a30b4f353cfda1c70304 435# Parent f50bb54f331f73405131a30b4f353cfda1c70304
184Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one. 436Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
185 437
@@ -342,6 +594,49 @@ diff -r 2ffe76b215fd libgcc/config/rs6000/linux-unwind.h
342 594
343 #define MD_FROB_UPDATE_CONTEXT frob_update_context 595 #define MD_FROB_UPDATE_CONTEXT frob_update_context
344 596
597diff -r 7cba4201a2ae libgcc/unwind-dw2-fde-dip.c
598--- a/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:53:05 2013 -0400
599+++ b/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:57:08 2013 -0400
600@@ -46,33 +46,13 @@
601 #include "unwind-compat.h"
602 #include "gthr.h"
603
604-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
605- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
606- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
607+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
608 # define USE_PT_GNU_EH_FRAME
609-#endif
610-
611-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
612- && defined(__BIONIC__)
613-# define USE_PT_GNU_EH_FRAME
614-#endif
615-
616-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
617- && defined(__FreeBSD__) && __FreeBSD__ >= 7
618-# define ElfW __ElfN
619-# define USE_PT_GNU_EH_FRAME
620-#endif
621-
622-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
623- && defined(__OpenBSD__)
624-# define ElfW(type) Elf_##type
625-# define USE_PT_GNU_EH_FRAME
626-#endif
627-
628-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
629- && defined(TARGET_DL_ITERATE_PHDR) \
630- && defined(__sun__) && defined(__svr4__)
631-# define USE_PT_GNU_EH_FRAME
632+# ifdef __OpenBSD__
633+# define ElfW(type) Elf_##typ
634+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
635+# define ElfW __ElfN
636+# endif
637 #endif
638
639 #if defined(USE_PT_GNU_EH_FRAME)
345# HG changeset patch 640# HG changeset patch
346# Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b 641# Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b
347Support for i386-linux-musl and x86_64-linux-musl. 642Support for i386-linux-musl and x86_64-linux-musl.