aboutsummaryrefslogtreecommitdiffstats
path: root/main/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'main/gcc')
-rw-r--r--main/gcc/APKBUILD71
-rw-r--r--main/gcc/gcc-4.7.3-musl.patch439
-rw-r--r--main/gcc/libgcc-always-build-gcceh.a.patch39
-rw-r--r--main/gcc/libgcc-backports.patch124
-rw-r--r--main/gcc/pr45078.patch36
5 files changed, 694 insertions, 15 deletions
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index 7d480f752a9..db0f88de0fd 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -7,7 +7,7 @@ _specs_gcc_ver=4.4.3
_uclibc_abiver=0.9.32
-pkgrel=7
+pkgrel=8
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
arch="all"
@@ -19,9 +19,20 @@ makedepends="bison flex gmp-dev mpfr-dev texinfo mpc1-dev gawk zlib-dev zip
subpackages="$pkgname-doc libgcc libgomp libstdc++:libcxx g++:gpp"
replaces="libstdc++"
-if [ -n "$BOOTSTRAP" ]; then
+if [ "$CBUILD" != "$CHOST" ]; then
+ export CFLAGS_FOR_HOST="$CFLAGS"
+ export CXXFLAGS_FOR_HOST="$CXXFLAGS"
+ export CPPFLAGS_FOR_HOST="$CPPFLAGS"
+ export LDFLAGS_FOR_HOST="$LDFLAGS"
+ unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+
+ export CFLAGS="--sysroot=${CBUILDROOT}"
+ export CXXFLAGS="--sysroot=${CBUILDROOT}"
+ export LDFLAGS="--sysroot=${CBUILDROOT}"
+
LANG_OBJC=off
LANG_JAVA=off
+ LANG_GO=off
LANG_FORTRAN=off
fi
@@ -60,6 +71,9 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
74_all_gcc47_cloog-dl.patch
gcc-spec-env.patch
+ gcc-4.7.3-musl.patch
+ libgcc-backports.patch
+ libgcc-always-build-gcceh.a.patch
pt_gnu_eh_frame.patch
uclibc-getipinfo.patch
gcc-4.7-dynamic-linker.patch
@@ -67,6 +81,7 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
boehem-gc-uclibc.patch
gcc-pure64.patch
gcc-go.patch
+ pr45078.patch
"
@@ -97,7 +112,7 @@ prepare() {
case "$i" in
*.patch)
msg "Applying $i"
- patch -p1 -i "$srcdir"/$i || _err="$_err $i"
+ patch -p1 -F3 -i "$srcdir"/$i || _err="$_err $i"
;;
esac
done
@@ -128,8 +143,10 @@ prepare() {
build() {
local _dynamic_linker=
+ local _arch_configure=
+ local _symvers="--disable-symvers"
cd "$_gccdir"
- export CFLAGS="-fno-stack-protector"
+ export CFLAGS="-fno-stack-protector $CFLAGS"
[ -z "$CBUILD" ] && CBUILD="$CHOST"
[ -z "$CTARGET" ] && CTARGET="$CHOST"
@@ -142,9 +159,11 @@ build() {
;;
x86_64-*-gnu)
_dynamic_linker="--with-dynamic-linker=ld-linux-x86-64.so.2"
+ _symvers=
;;
*-gnu)
_dynamic_linker="--with-dynamic-linker=ld-linux.so.2"
+ _symvers=
;;
*) _dynamic_linker=
;;
@@ -152,7 +171,18 @@ build() {
# --enable-target-optspace is broken on powerpc
if [ "$CARCH" != "powerpc" ]; then
- _target_optspace="--enable-target-optspace"
+ _arch_configure="$_arch_configure --enable-target-optspace"
+ fi
+
+ case "$CARCH" in
+ arm*) _arch_configure="$_arch_configure --with-float=hard";;
+ esac
+
+ if [ "${CHOST#*musl}" != "$CHOST" ]; then
+ # musl does not support mudflap
+ _arch_configure="$_arch_configure --disable-mudflap --disable-libmudflap"
+ else
+ _arch_configure="$_arch_configure --without-system-libunwind"
fi
msg "Building the following:"
@@ -162,7 +192,7 @@ build() {
echo " CTARGET=$CTARGET"
echo " languages=$_languages"
echo " dynamic_linker=$_dynamic_linker"
- echo " target_optspace=$_target_optspace"
+ echo " arch_configure=$_arch_configure"
echo ""
mkdir -p "$_builddir"
@@ -183,19 +213,19 @@ build() {
--disable-multilib \
--disable-nls \
--disable-werror \
+ $_symvers \
--enable-__cxa_atexit \
--enable-cld \
--enable-esp \
--enable-cloog-backend \
--enable-languages=$_languages \
--enable-shared \
- $_target_optspace \
+ $_arch_configure \
--enable-tls \
--enable-threads \
$_dynamic_linker \
--with-dynamic-linker-prefix=/lib \
--with-system-zlib \
- --without-system-libunwind \
|| return 1
make || return 1
@@ -228,7 +258,7 @@ package() {
|| return 1
# strip debug info from some statib libs
- strip -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
+ ${CROSS_COMPILE}strip -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
@@ -240,8 +270,7 @@ package() {
"$pkdir"/usr/lib/libgcj.spec
# remove ffi
- rm "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi* \
- || return 1
+ rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' | xargs rm -f
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/lib
@@ -299,7 +328,7 @@ libgcc() {
pkgdesc="GNU C compiler runtime libraries"
depends=
mkdir -p "$subpkgdir"/usr/lib
- mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/
+ mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || return 1
}
libgomp() {
@@ -436,13 +465,17 @@ d8692c56f04b92667096f59d843e95c5 51_all_libiberty-pic.patch
406fc6f29ab3d746eaef0202c50fd7e9 67_all_gcc-poison-system-directories.patch
f24f07ed008324eaecb0f75417c99116 74_all_gcc47_cloog-dl.patch
a695d7648509b4f8e18b389a19e6037c gcc-spec-env.patch
+789c5ace577a7c4aea769af614cffa86 gcc-4.7.3-musl.patch
+15c03ac46867377f347412b05796ae72 libgcc-backports.patch
+504c7dd8651c5d98229892c4cd9ea591 libgcc-always-build-gcceh.a.patch
ab83248e10b2bf4b3d9240de0fefb52b pt_gnu_eh_frame.patch
6cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch
ac11128f201ee00287f8852697cb86a6 gcc-4.7-dynamic-linker.patch
32e8e4c0e23ed8f5de95a591cb30f1da gcc-4.6-pr32219.patch
2c6cb49bb9bfd8b6e690222e66ccc901 boehem-gc-uclibc.patch
2e2b787bb988d9007c9f7ce42178dfe6 gcc-pure64.patch
-c94014ece84407a36d239417a2bad25d gcc-go.patch"
+c94014ece84407a36d239417a2bad25d gcc-go.patch
+aa98f3b0db9e5d342792cad4e197ccd9 pr45078.patch"
sha256sums="2f7c37eb4fc14422ff2358a9ef59c974a75ab41204ef0e49fc34ab1d8981a9c3 gcc-4.7.3.tar.bz2
26aee7449cd3cd642065a0860d723dbb8062066ad87a398241f61210c68513d9 gcc-4.7.1-piepatches-v0.5.3.tar.bz2
f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -457,13 +490,17 @@ da6bbb5dc654d5e1df8ecae5c9ebb56265426c405931f14f5878248b8c79f78d 51_all_libiber
830028c0d08f43a0f5ae1f60c20256f1cad6bdae95c05ac901a10bf5a7406899 67_all_gcc-poison-system-directories.patch
ce041ae09033d8d170a942b30f26d85ef720bf846c90963b39083c2963334c82 74_all_gcc47_cloog-dl.patch
64b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a gcc-spec-env.patch
+7ef3c4804ea16c2da10860931349251a6ad2cabc57d77029a8d55cd6de89a10e gcc-4.7.3-musl.patch
+163ae7e199ba9751744794c82cbb927bd87d87c89c6a2b6f39fb4a322a1b90cf libgcc-backports.patch
+1975189156d70f5428cb7f1516533965d1c8734f3009fc89a9b8e289b72326f1 libgcc-always-build-gcceh.a.patch
78e75cb378bdfe870c98ab3cffef37f54be729d3912979191f27ca00651ad6c4 pt_gnu_eh_frame.patch
53184f842477569973c232dac7c85e71b0018cbe5c4962f95dd9e0273f42083e uclibc-getipinfo.patch
633b46b3b433550a1ad8f3150904eec0a5fee5f3a284d38dc0b7013f45505b96 gcc-4.7-dynamic-linker.patch
89207a8b62137a857ee2c43499d6b5247d37b530d1338844dbb330a6846b2ad2 gcc-4.6-pr32219.patch
02751ccf223dcfc898c0ce2214cd0859d275e90b742f1a66e38db5c50f94b38c boehem-gc-uclibc.patch
f5473c6aea96d5137defd68898ba31042944a3f3ed26c05b964a40bd876c6f47 gcc-pure64.patch
-e6b57e7c7d860550a4f7befa3e622024ba077a5906e6f2fd104b33fd47921be0 gcc-go.patch"
+e6b57e7c7d860550a4f7befa3e622024ba077a5906e6f2fd104b33fd47921be0 gcc-go.patch
+af214cc21f5c4de5f222b049d8e27238a951f7b6262d2767c03b10087c362788 pr45078.patch"
sha512sums="5671a2dd3b6ac0d23f305cb11a796aebd823c1462b873136b412e660966143f4e07439bd8926c1443b78442beb6ae370ef91d819ec615920294875b722b7b0bd gcc-4.7.3.tar.bz2
47e16c41ec6678f9960bd39b8f7f01a0a956ae112584c3aa8b7fa5107eef1b598eba191d5199280131399ff096a1b0d14c9b5799cdfee837451e48a3405b2374 gcc-4.7.1-piepatches-v0.5.3.tar.bz2
779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -478,10 +515,14 @@ f8dfe0b6907fab10009ab009f7b23df80a2b900c02da672f2d795e7609ec344d6ae66e521518d5d7
77d9383361bbc6701b34ba35356a09b97ebd45d8595c79bac9e3b8277def83caef47418ed813c2d138f2016779dce511c6e68155787c2462ab8ca1479c46c967 67_all_gcc-poison-system-directories.patch
739fd5e05dbab5090802eb447c24d5f03ed0b581f76acd8d69729c1bbfab9f92a41491eb313415f0f0e80cd80961eb8ea420170efbd705136d682ba71cff87da 74_all_gcc47_cloog-dl.patch
ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48 gcc-spec-env.patch
+f8988835c996c6cc4bb60096aaa9f712e835957ff745db66d78adf65ad09afa3a828ff7767ad11410d51b4b52d1c03bfdc96e3607a789f01faec11ec504f89dd gcc-4.7.3-musl.patch
+719642ba2bc501e270bf09ae1a1b4151510b68006fcd8e8655a7c30d1e678fe134e7de0fb2a2366a9c6a13835a499a82b36b544c203853e556f16b0a2ea2ab59 libgcc-backports.patch
+d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
8464197f01d107872dfa6b47e86e95ae8d75c053527bafbdb7a86bcc7aff4bc5b20a8ec40d6e48d1ad455b0187a3cba9db337cff6c0a6245507c4533e4832d99 pt_gnu_eh_frame.patch
e3edf75df1f27af8771bd263e1bd607f6207c4eb5b2a5e11032577deba43ea201825e3b5008a720105f24e49d2821dd77a61c7ceba7ed91b3621c0dbd9292fc6 uclibc-getipinfo.patch
91332bea084d13d165bac8abe826c3656f77c8872898a4d86b7e258dbf5af85d1b25b7e51f262f4b19b11ca89bf5d77ab0ac5554068419f15bf017a37a9d1822 gcc-4.7-dynamic-linker.patch
9fc5e32f2573ae67b6cf22119d636d10a47c42718635bceff7d457a93a3f664ae1ed10e154f70964ba2d26b0de04f879a8c05de6411112760d40433373dd0a80 gcc-4.6-pr32219.patch
e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehem-gc-uclibc.patch
4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch
-1a09175bbb9c457893d4e921aa1bfe81fa7d657255d76ddb45f2f6db9232fb74bbc5fbac74d29d972ef74ab01df6a1a70e9ce83092e434a2d7c6b4155ea177b8 gcc-go.patch"
+1a09175bbb9c457893d4e921aa1bfe81fa7d657255d76ddb45f2f6db9232fb74bbc5fbac74d29d972ef74ab01df6a1a70e9ce83092e434a2d7c6b4155ea177b8 gcc-go.patch
+8822d2d7e32b1158169f58e34372c06fa122e2dfbd33ad5b7bd6fc13d57eedc592ba290381134bb078a6cca7a52109289389d0a52b72399903bcfc9584704e45 pr45078.patch"
diff --git a/main/gcc/gcc-4.7.3-musl.patch b/main/gcc/gcc-4.7.3-musl.patch
new file mode 100644
index 00000000000..75fb4efabd1
--- /dev/null
+++ b/main/gcc/gcc-4.7.3-musl.patch
@@ -0,0 +1,439 @@
+# HG changeset patch
+# Parent 53f3e21a7d14d0514ec7cb9ffb67b24dcf1f9fc9
+Support for arm-linux-musl.
+
+
+diff -r 53f3e21a7d14 -r 0a4e297edad6 gcc/config/arm/linux-eabi.h
+--- a/gcc/config/arm/linux-eabi.h Wed Nov 21 21:21:21 2012 -0500
++++ b/gcc/config/arm/linux-eabi.h Wed Nov 21 21:21:54 2012 -0500
+@@ -64,6 +64,10 @@
+ #undef GLIBC_DYNAMIC_LINKER
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+
++/* musl has no "classic" (i.e. broken) mode */
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
+ use the GNU/Linux version, not the generic BPABI version. */
+ #undef LINK_SPEC
+diff -r 53f3e21a7d14 -r 0a4e297edad6 libitm/config/arm/hwcap.cc
+--- a/libitm/config/arm/hwcap.cc Wed Nov 21 21:21:21 2012 -0500
++++ b/libitm/config/arm/hwcap.cc Wed Nov 21 21:21:54 2012 -0500
+@@ -40,7 +40,11 @@
+
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+
+ static void __attribute__((constructor))
+# HG changeset patch
+# Parent 193f80e01b026d8de7f53d467f2c59cd0b7927dc
+Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
+
+
+diff -r 193f80e01b02 -r 45cd88d4fb7b gcc/config.gcc
+--- a/gcc/config.gcc Wed Nov 21 21:17:38 2012 -0500
++++ b/gcc/config.gcc Wed Nov 21 21:19:19 2012 -0500
+@@ -522,7 +522,7 @@
+ esac
+
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+
+ # Common parts for widely ported systems.
+ case ${target} in
+@@ -625,6 +625,9 @@
+ *-*-*uclibc*)
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+ ;;
++ *-*-*musl*)
++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++ ;;
+ *)
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+ ;;
+diff -r 193f80e01b02 -r 45cd88d4fb7b gcc/config/linux.h
+--- a/gcc/config/linux.h Wed Nov 21 21:17:38 2012 -0500
++++ b/gcc/config/linux.h Wed Nov 21 21:19:19 2012 -0500
+@@ -33,10 +33,12 @@
+ #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
+ #endif
+
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
+@@ -54,18 +56,21 @@
+ uClibc or Bionic is the default C library and whether
+ -muclibc or -mglibc or -mbionic has been passed to change the default. */
+
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
+- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -85,16 +90,16 @@
+
+ #define GNU_USER_DYNAMIC_LINKER \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
+- BIONIC_DYNAMIC_LINKER)
++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+- BIONIC_DYNAMIC_LINKER32)
++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+- BIONIC_DYNAMIC_LINKER64)
++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32 \
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+- BIONIC_DYNAMIC_LINKERX32)
++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+
+ /* Determine whether the entire c99 runtime
+ is present in the runtime library. */
+diff -r 193f80e01b02 -r 45cd88d4fb7b gcc/config/linux.opt
+--- a/gcc/config/linux.opt Wed Nov 21 21:17:38 2012 -0500
++++ b/gcc/config/linux.opt Wed Nov 21 21:19:19 2012 -0500
+@@ -30,3 +30,7 @@
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+diff -r 193f80e01b02 -r 45cd88d4fb7b gcc/ginclude/stddef.h
+--- a/gcc/ginclude/stddef.h Wed Nov 21 21:17:38 2012 -0500
++++ b/gcc/ginclude/stddef.h Wed Nov 21 21:19:19 2012 -0500
+@@ -184,6 +184,7 @@
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__ /* BeOS */
+ #define __SIZE_T__ /* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -200,6 +201,7 @@
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+ || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+@@ -215,6 +217,7 @@
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
+# HG changeset patch
+# Parent 45cd88d4fb7b0e813578c296004eaab2c2d0bfb9
+A fix for libgomp to correctly request a POSIX version for time support.
+
+
+diff -r 45cd88d4fb7b -r 0afd9d82498d libgomp/config/posix/time.c
+--- a/libgomp/config/posix/time.c Wed Nov 21 21:19:19 2012 -0500
++++ b/libgomp/config/posix/time.c Wed Nov 21 21:20:22 2012 -0500
+@@ -28,6 +28,8 @@
+ The following implementation uses the most simple POSIX routines.
+ If present, POSIX 4 clocks should be used instead. */
+
++#define _POSIX_C_SOURCE 199309L /* for clocks */
++
+ #include "libgomp.h"
+ #include <unistd.h>
+ #if TIME_WITH_SYS_TIME
+# HG changeset patch
+# Parent 04a6a82b8e06669a42181c96381b4fbc3ffa008c
+Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
+
+
+diff -r 04a6a82b8e06 -r 193f80e01b02 libstdc++-v3/configure.host
+--- a/libstdc++-v3/configure.host Wed Nov 21 21:16:58 2012 -0500
++++ b/libstdc++-v3/configure.host Wed Nov 21 21:17:38 2012 -0500
+@@ -243,6 +243,13 @@
+ os_include_dir="os/bsd/freebsd"
+ ;;
+ gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++ # check for musl by target
++ case "${host_os}" in
++ *-musl*)
++ os_include_dir="os/generic"
++ ;;
++ *)
++
+ if [ "$uclibc" = "yes" ]; then
+ os_include_dir="os/uclibc"
+ elif [ "$bionic" = "yes" ]; then
+@@ -251,6 +258,9 @@
+ os_include_dir="os/gnu-linux"
+ fi
+ ;;
++
++ esac
++ ;;
+ hpux*)
+ os_include_dir="os/hpux"
+ ;;
+# HG changeset patch
+# Parent 800ec1c37f610df2bfe75333ed6ec6caa905d630
+Support (partial) for microblaze-linux-musl.
+
+diff -r 800ec1c37f61 gcc/config.gcc
+--- a/gcc/config.gcc Thu Apr 11 13:23:51 2013 -0400
++++ b/gcc/config.gcc Thu Apr 11 13:24:17 2013 -0400
+@@ -1733,6 +1733,7 @@
+ tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
+ c_target_objs="${c_target_objs} microblaze-c.o"
+ cxx_target_objs="${cxx_target_objs} microblaze-c.o"
++ tmake_file="${tmake_file} microblaze/t-microblaze"
+ ;;
+ microblaze*-*-rtems*)
+ tm_file="${tm_file} dbxelf.h"
+# HG changeset patch
+# Parent 0a4e297edad6e46f4b66401b93b217aa3194af4e
+Support for mips-linux-musl.
+
+
+diff -r 0a4e297edad6 -r 78025c74c5c1 gcc/config/mips/linux.h
+--- a/gcc/config/mips/linux.h Wed Nov 21 21:21:54 2012 -0500
++++ b/gcc/config/mips/linux.h Wed Nov 21 21:23:49 2012 -0500
+@@ -19,3 +19,5 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
+# HG changeset patch
+# Parent 78025c74c5c1705f16ce13f3645ecb86c10cc1c2
+Support for powerpc-linux-musl.
+
+diff -r 78025c74c5c1 gcc/config.gcc
+--- a/gcc/config.gcc Wed Nov 21 21:23:49 2012 -0500
++++ b/gcc/config.gcc Wed Nov 21 21:45:58 2012 -0500
+@@ -2078,6 +2078,10 @@
+ powerpc*-*-linux*paired*)
+ tm_file="${tm_file} rs6000/750cl.h" ;;
+ esac
++ case ${target} in
++ *-linux*-musl*)
++ enable_secureplt=yes ;;
++ esac
+ if test x${enable_secureplt} = xyes; then
+ tm_file="rs6000/secureplt.h ${tm_file}"
+ fi
+diff -r 78025c74c5c1 gcc/config/rs6000/linux64.h
+--- a/gcc/config/rs6000/linux64.h Wed Nov 21 21:23:49 2012 -0500
++++ b/gcc/config/rs6000/linux64.h Wed Nov 21 21:45:58 2012 -0500
+@@ -362,17 +362,21 @@
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+
+
+ #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+diff -r 78025c74c5c1 gcc/config/rs6000/secureplt.h
+--- a/gcc/config/rs6000/secureplt.h Wed Nov 21 21:23:49 2012 -0500
++++ b/gcc/config/rs6000/secureplt.h Wed Nov 21 21:45:58 2012 -0500
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>. */
+
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+diff -r 78025c74c5c1 gcc/config/rs6000/sysv4.h
+--- a/gcc/config/rs6000/sysv4.h Wed Nov 21 21:23:49 2012 -0500
++++ b/gcc/config/rs6000/sysv4.h Wed Nov 21 21:45:58 2012 -0500
+@@ -566,6 +566,9 @@
+ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
+
+ /* Pass -G xxx to the compiler and set correct endian mode. */
+ #define CC1_SPEC "%{G*} %(cc1_cpu) \
+@@ -626,7 +629,8 @@
+ %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+ %{mcall-i960-old: --oformat elf32-powerpcle} \
+- }}}}"
++ }}}} \
++%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+
+ /* Any specific OS flags. */
+ #define LINK_OS_SPEC "\
+@@ -804,15 +808,18 @@
+
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+@@ -938,6 +945,7 @@
+ { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
+ { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
+ { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
+ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
+ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
+ { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
+diff -r 78025c74c5c1 libgcc/config/rs6000/linux-unwind.h
+--- a/libgcc/config/rs6000/linux-unwind.h Wed Nov 21 21:23:49 2012 -0500
++++ b/libgcc/config/rs6000/linux-unwind.h Wed Nov 21 21:45:58 2012 -0500
+@@ -176,6 +176,7 @@
+ }
+ #endif
+
++#ifdef __GLIBC__
+ /* Find an entry in the process auxiliary vector. The canonical way to
+ test for VMX is to look at AT_HWCAP. */
+
+@@ -207,6 +208,7 @@
+ return auxp->a_val;
+ return 0;
+ }
++#endif
+
+ /* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+@@ -253,7 +255,11 @@
+
+ if (hwcap == 0)
+ {
++#ifdef __GLIBC__
+ hwcap = ppc_linux_aux_vector (16);
++#else
++ hwcap = -1;
++#endif
+ /* These will already be set if we found AT_HWCAP. A nonzero
+ value stops us looking again if for some reason we couldn't
+ find AT_HWCAP. */
+# HG changeset patch
+# Parent 0afd9d82498d2cd30aa78529ff25f211bdc0c3b9
+Support for i386-linux-musl and x86_64-linux-musl.
+
+
+diff -r 0afd9d82498d -r 53f3e21a7d14 gcc/config/i386/linux.h
+--- a/gcc/config/i386/linux.h Wed Nov 21 21:20:22 2012 -0500
++++ b/gcc/config/i386/linux.h Wed Nov 21 21:21:21 2012 -0500
+@@ -22,3 +22,4 @@
+
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+diff -r 0afd9d82498d -r 53f3e21a7d14 gcc/config/i386/linux64.h
+--- a/gcc/config/i386/linux64.h Wed Nov 21 21:20:22 2012 -0500
++++ b/gcc/config/i386/linux64.h Wed Nov 21 21:21:21 2012 -0500
+@@ -31,3 +31,7 @@
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+diff -r 0afd9d82498d -r 53f3e21a7d14 libitm/config/linux/x86/tls.h
+--- a/libitm/config/linux/x86/tls.h Wed Nov 21 21:20:22 2012 -0500
++++ b/libitm/config/linux/x86/tls.h Wed Nov 21 21:21:21 2012 -0500
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+ GLIBC has reserved words 10 through 13 for TM. */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+
+ #include "config/generic/tls.h"
+
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@
+
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+
+ #endif // LIBITM_X86_TLS_H
diff --git a/main/gcc/libgcc-always-build-gcceh.a.patch b/main/gcc/libgcc-always-build-gcceh.a.patch
new file mode 100644
index 00000000000..74ae8973048
--- /dev/null
+++ b/main/gcc/libgcc-always-build-gcceh.a.patch
@@ -0,0 +1,39 @@
+Highly inspired by:
+ http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
+
+diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
+--- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100
++++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200
+@@ -772,8 +772,9 @@
+ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
+ endif
+
++all: libgcc_eh.a
+ ifeq ($(enable_shared),yes)
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
++all: libgcc_s$(SHLIB_EXT)
+ ifneq ($(LIBUNWIND),)
+ all: libunwind$(SHLIB_EXT)
+ endif
+@@ -950,10 +951,6 @@
+ install-shared:
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+
+- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
+- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+-
+ $(subst @multilib_dir@,$(MULTIDIR),$(subst \
+ @shlib_base_name@,libgcc_s,$(subst \
+ @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+@@ -968,6 +965,10 @@
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
+
++ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++
+ parts="$(INSTALL_PARTS)"; \
+ for file in $$parts; do \
+ rm -f $(DESTDIR)$(inst_libdir)/$$file; \
diff --git a/main/gcc/libgcc-backports.patch b/main/gcc/libgcc-backports.patch
new file mode 100644
index 00000000000..af556ed991e
--- /dev/null
+++ b/main/gcc/libgcc-backports.patch
@@ -0,0 +1,124 @@
+# DP: libgcc backports from the trunk:
+# DP: - Always define USE_PT_GNU_EH_FRAME in crtstuff.c for glibc.
+# DP: - Build static libgcc with hidden visibility even with --disable-shared.
+
+libgcc/
+2012-08-19 Joseph Myers <joseph@codesourcery.com>
+
+ * crtstuff.c (USE_PT_GNU_EH_FRAME): Define for systems using glibc
+ even if inhibit_libc.
+
+2012-08-22 Joseph Myers <joseph@codesourcery.com>
+
+ * Makefile.in (vis_hide, gen-hide-list): Do not make definitions
+ depend on --enable-shared.
+ ($(lib1asmfuncs-o)): Use %.vis files independent of
+ --enable-shared.
+ * static-object.mk ($(base)$(objext), $(base).vis)
+ ($(base)_s$(objext)): Use same rules for visibility handling as in
+ shared-object.mk.
+
+Index: b/libgcc/crtstuff.c
+===================================================================
+--- a/libgcc/crtstuff.c
++++ b/libgcc/crtstuff.c
+@@ -1,7 +1,7 @@
+ /* Specialized bits of code needed to support construction and
+ destruction of file-scope objects in C++ code.
+ Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+- 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
++ 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012
+ Free Software Foundation, Inc.
+ Contributed by Ron Guilmette (rfg@monkeys.com).
+
+@@ -113,6 +113,20 @@
+ # define USE_PT_GNU_EH_FRAME
+ # endif
+ #endif
++
++#if defined(OBJECT_FORMAT_ELF) \
++ && !defined(OBJECT_FORMAT_FLAT) \
++ && defined(HAVE_LD_EH_FRAME_HDR) \
++ && !defined(CRTSTUFFT_O) \
++ && defined(inhibit_libc) \
++ && (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__))
++/* On systems using glibc, an inhibit_libc build of libgcc is only
++ part of a bootstrap process. Build the same crt*.o as would be
++ built with headers present, so that it is not necessary to build
++ glibc more than once for the bootstrap to converge. */
++# define USE_PT_GNU_EH_FRAME
++#endif
++
+ #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
+ # define USE_EH_FRAME_REGISTRY
+ #endif
+Index: b/libgcc/Makefile.in
+===================================================================
+--- a/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -362,6 +362,7 @@
+ ifneq ($(LIBUNWIND),)
+ install-libunwind = install-libunwind
+ endif
++endif
+
+ # For -fvisibility=hidden. We need both a -fvisibility=hidden on
+ # the command line, and a #define to prevent libgcc2.h etc from
+@@ -385,11 +386,8 @@
+ gen-hide-list = echo > $@
+ endif
+
+-else
+-# Not enable_shared.
++ifneq ($(enable_shared),yes)
+ iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
+-vis_hide =
+-gen-hide-list = echo > \$@
+ endif
+
+ LIB2ADD += enable-execute-stack.c
+@@ -438,7 +436,6 @@
+ $(LIB2_DIVMOD_FUNCS))
+
+ # Build "libgcc1" (assembly) components.
+-ifeq ($(enable_shared),yes)
+
+ lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
+ $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
+@@ -450,14 +447,9 @@
+ lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
+ $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
+ $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
+-libgcc-s-objects += $(lib1asmfuncs-s-o)
+-
+-else
++ifeq ($(enable_shared),yes)
+
+-lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
+-$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC)
+- $(gcc_compile) -DL$* -xassembler-with-cpp -c $<
+-libgcc-objects += $(lib1asmfuncs-o)
++libgcc-s-objects += $(lib1asmfuncs-s-o)
+
+ endif
+
+Index: b/libgcc/static-object.mk
+===================================================================
+--- a/libgcc/static-object.mk
++++ b/libgcc/static-object.mk
+@@ -24,7 +24,13 @@
+ endif
+ endif
+
+-$(base)$(objext): $o
+- $(gcc_compile) -c -xassembler-with-cpp $<
++$(base)$(objext): $o $(base).vis
++ $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $<
++
++$(base).vis: $(base)_s$(objext)
++ $(gen-hide-list)
++
++$(base)_s$(objext): $o
++ $(gcc_s_compile) -c -xassembler-with-cpp $<
+
+ endif
diff --git a/main/gcc/pr45078.patch b/main/gcc/pr45078.patch
new file mode 100644
index 00000000000..759a2cf7670
--- /dev/null
+++ b/main/gcc/pr45078.patch
@@ -0,0 +1,36 @@
+# DP: Proposed patch for PR plugin/45078
+
+2011-06-24 Matthias Klose <doko@ubuntu.com>
+
+ PR plugin/45078
+ * Makefile.in (PLUGIN_HEADERS): Add config/arm/arm-cores.def.
+ (install-plugin): Install c-family headers into a c-family subdir.
+ * config.gcc: Add vxworks-dummy.h to tm_file for arm, mips, sh and
+ sparc targets.
+
+Index: b/gcc/Makefile.in
+===================================================================
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4547,6 +4547,7 @@
+ $(C_PRAGMA_H) $(CPPLIB_H) $(FUNCTION_H) \
+ cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h \
+ gimple-pretty-print.h tree-pretty-print.h realmpfr.h \
++ config/arm/arm-cores.def \
+ $(IPA_PROP_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) version.h
+
+ # generate the 'build fragment' b-header-vars
+Index: b/gcc/config.gcc
+===================================================================
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -486,6 +486,9 @@
+ fi
+ tm_file="vxworks-dummy.h ${tm_file}"
+ ;;
++arm*-*-*|mips*-*-*|sh*-*-*|sparc*-*-*)
++ tm_file="vxworks-dummy.h ${tm_file}"
++ ;;
+ esac
+
+ # On a.out targets, we need to use collect2.