diff options
author | Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> | 2016-12-25 11:17:17 +0100 |
---|---|---|
committer | Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> | 2016-12-25 11:17:17 +0100 |
commit | db3607910d3b9e04499256502213e5009271a85d (patch) | |
tree | 6b24c1f09c4462eea118c16cb2234e3c6665a144 | |
parent | 6341c7d2f33e2c6824e6ca14ad09357cde91aaf2 (diff) | |
download | gcc-patches-db3607910d3b9e04499256502213e5009271a85d.tar.gz |
Copy 6.2 patches to 6.3
Change-Id: I07e7dee68d53b37295966e3b830b5e446be0dec1
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
21 files changed, 1385 insertions, 0 deletions
diff --git a/6.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch b/6.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch new file mode 100644 index 0000000..a045aa0 --- /dev/null +++ b/6.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch @@ -0,0 +1,48 @@ +From 2db6fc94fcfc95b7858e88b84c8b3d2e17f3fb3b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Sun, 5 Jan 2014 23:56:28 +0100 +Subject: [PATCH 01/17] Restore visibility of libgcc assembly code on Android +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed for the Bionic hack that re-exports libgcc symbols for +compatibility with some blobs. + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libgcc/Makefile.in | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in +index 8eebf61..e505be2 100644 +--- a/libgcc/Makefile.in ++++ b/libgcc/Makefile.in +@@ -373,7 +373,22 @@ endif + # overriding that with #pragmas. + vis_hide = @vis_hide@ + +-ifneq (,$(vis_hide)) ++# Bionic (Android's libc) has a nasty hack to grab __aeabi_uidiv and ++# friends from libgcc.a and re-export them as a workaround for incorrectly ++# built blobs. ++# This hack stops working if the symbols are marked .hidden - so don't do ++# it on Android targets. ++ ++hide_symbols=yes ++ifeq (,$(vis_hide)) ++ hide_symbols=no ++endif ++ifneq (,$(findstring android,$(target_noncanonical))) ++ hide_symbols=no ++ vis_hide= ++endif ++ ++ifneq (no,$(hide_symbols)) + + # If we have -fvisibility=hidden, then we need to generate hide + # lists for object files implemented in assembly. +-- +1.8.4.5 + diff --git a/6.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch b/6.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch new file mode 100644 index 0000000..2523425 --- /dev/null +++ b/6.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch @@ -0,0 +1,32 @@ +From ff7f1691c8393a30916eb461bf330ce8050160fa Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Sun, 5 Jan 2014 23:57:26 +0100 +Subject: [PATCH 02/17] Resotre symbol visibility on libgcc C code on Android +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed for the hacks in Bionic to re-export libgcc symbols for +compatibility with blobs. + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libgcc/config/arm/bpabi-lib.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libgcc/config/arm/bpabi-lib.h b/libgcc/config/arm/bpabi-lib.h +index 193cc56..0830cd0 100644 +--- a/libgcc/config/arm/bpabi-lib.h ++++ b/libgcc/config/arm/bpabi-lib.h +@@ -22,6 +22,7 @@ + /* Make __aeabi_AEABI_NAME an alias for __GCC_NAME. */ + #define RENAME_LIBRARY(GCC_NAME, AEABI_NAME) \ + typeof (__##GCC_NAME) __aeabi_##AEABI_NAME \ ++ __attribute__((visibility("default"))) \ + __attribute__((alias ("__" #GCC_NAME))); + + /* Give some libgcc functions an additional __aeabi name. */ +-- +1.8.4.5 + diff --git a/6.3/0003-Deal-with-setlocale-returning-NULL.patch b/6.3/0003-Deal-with-setlocale-returning-NULL.patch new file mode 100644 index 0000000..d5f2403 --- /dev/null +++ b/6.3/0003-Deal-with-setlocale-returning-NULL.patch @@ -0,0 +1,135 @@ +From 8d57a98c30d0d4baf5fb3558f30043cfb9d1dd5e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Sun, 5 Jan 2014 23:58:26 +0100 +Subject: [PATCH 03/17] Deal with setlocale returning NULL +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/config/locale/generic/c_locale.cc | 36 ++++++++++++++-------- + libstdc++-v3/config/locale/generic/c_locale.h | 2 +- + libstdc++-v3/config/locale/generic/time_members.cc | 24 ++++++++++----- + 3 files changed, 41 insertions(+), 21 deletions(-) + +diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc +index abf8727..6ce0441 100644 +--- a/libstdc++-v3/config/locale/generic/c_locale.cc ++++ b/libstdc++-v3/config/locale/generic/c_locale.cc +@@ -51,10 +51,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { + // Assumes __s formatted for "C" locale. + char* __old = setlocale(LC_ALL, 0); +- const size_t __len = strlen(__old) + 1; +- char* __sav = new char[__len]; +- memcpy(__sav, __old, __len); +- setlocale(LC_ALL, "C"); ++ char* __sav = 0; ++ if (__old) ++ { ++ const size_t __len = strlen(__old) + 1; ++ __sav = new char[__len]; ++ memcpy(__sav, __old, __len); ++ setlocale(LC_ALL, "C"); ++ } + char* __sanity; + bool __overflow = false; + +@@ -116,10 +120,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { + // Assumes __s formatted for "C" locale. + char* __old = setlocale(LC_ALL, 0); +- const size_t __len = strlen(__old) + 1; +- char* __sav = new char[__len]; +- memcpy(__sav, __old, __len); +- setlocale(LC_ALL, "C"); ++ char* __sav = 0; ++ if (__old) ++ { ++ const size_t __len = strlen(__old) + 1; ++ __sav = new char[__len]; ++ memcpy(__sav, __old, __len); ++ setlocale(LC_ALL, "C"); ++ } + char* __sanity; + + #if !__DBL_HAS_INFINITY__ +@@ -161,10 +169,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { + // Assumes __s formatted for "C" locale. + char* __old = setlocale(LC_ALL, 0); +- const size_t __len = strlen(__old) + 1; +- char* __sav = new char[__len]; +- memcpy(__sav, __old, __len); +- setlocale(LC_ALL, "C"); ++ char* __sav = 0; ++ if (__old) ++ { ++ const size_t __len = strlen(__old) + 1; ++ __sav = new char[__len]; ++ memcpy(__sav, __old, __len); ++ setlocale(LC_ALL, "C"); ++ } + + #if !__LDBL_HAS_INFINITY__ + errno = 0; +diff --git a/libstdc++-v3/config/locale/generic/c_locale.h b/libstdc++-v3/config/locale/generic/c_locale.h +index e934ffc..aedb13f 100644 +--- a/libstdc++-v3/config/locale/generic/c_locale.h ++++ b/libstdc++-v3/config/locale/generic/c_locale.h +@@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + { + char* __old = std::setlocale(LC_NUMERIC, 0); + char* __sav = 0; +- if (__builtin_strcmp(__old, "C")) ++ if (__old && __builtin_strcmp(__old, "C")) + { + const size_t __len = __builtin_strlen(__old) + 1; + __sav = new char[__len]; +diff --git a/libstdc++-v3/config/locale/generic/time_members.cc b/libstdc++-v3/config/locale/generic/time_members.cc +index f660c94..2ed10f5 100644 +--- a/libstdc++-v3/config/locale/generic/time_members.cc ++++ b/libstdc++-v3/config/locale/generic/time_members.cc +@@ -44,10 +44,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + const tm* __tm) const throw() + { + char* __old = setlocale(LC_ALL, 0); +- const size_t __llen = strlen(__old) + 1; +- char* __sav = new char[__llen]; +- memcpy(__sav, __old, __llen); +- setlocale(LC_ALL, _M_name_timepunct); ++ char* __sav = 0; ++ if (__old) ++ { ++ const size_t __llen = strlen(__old) + 1; ++ __sav = new char[__llen]; ++ memcpy(__sav, __old, __llen); ++ setlocale(LC_ALL, _M_name_timepunct); ++ } + const size_t __len = strftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __sav); + delete [] __sav; +@@ -129,10 +133,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + const tm* __tm) const throw() + { + char* __old = setlocale(LC_ALL, 0); +- const size_t __llen = strlen(__old) + 1; +- char* __sav = new char[__llen]; +- memcpy(__sav, __old, __llen); +- setlocale(LC_ALL, _M_name_timepunct); ++ char* __sav = 0; ++ if (__old) ++ { ++ const size_t __llen = strlen(__old) + 1; ++ __sav = new char[__llen]; ++ memcpy(__sav, __old, __llen); ++ setlocale(LC_ALL, _M_name_timepunct); ++ } + const size_t __len = wcsftime(__s, __maxlen, __format, __tm); + setlocale(LC_ALL, __sav); + delete [] __sav; +-- +1.8.4.5 + diff --git a/6.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch b/6.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch new file mode 100644 index 0000000..b332250 --- /dev/null +++ b/6.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch @@ -0,0 +1,61 @@ +From 2b871b2ebf696fad91dbdf5cc030320e7cbf68eb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Sun, 5 Jan 2014 23:59:30 +0100 +Subject: [PATCH 04/17] Enable armv7/thumb2 multilib for arm-eabi +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + gcc/config/arm/t-arm-elf | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf +index 8ef6b04..5e39868 100644 +--- a/gcc/config/arm/t-arm-elf ++++ b/gcc/config/arm/t-arm-elf +@@ -25,22 +25,27 @@ MULTILIB_MATCHES = + #MULTILIB_DIRNAMES += fa526 fa626 fa606te fa626te fmp626 fa726te + #MULTILIB_EXCEPTIONS += *mthumb*/*mcpu=fa526 *mthumb*/*mcpu=fa626 + +-#MULTILIB_OPTIONS += march=armv7 +-#MULTILIB_DIRNAMES += thumb2 +-#MULTILIB_EXCEPTIONS += march=armv7* marm/*march=armv7* +-#MULTILIB_MATCHES += march?armv7=march?armv7-a +-#MULTILIB_MATCHES += march?armv7=march?armv7-r +-#MULTILIB_MATCHES += march?armv7=march?armv7-m +-#MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8 +-#MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4 +-#MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3 ++# Enable these for ANDROID arm-eabi toolchain ++MULTILIB_OPTIONS += march=armv7 ++MULTILIB_DIRNAMES += thumb2 ++MULTILIB_EXCEPTIONS += march=armv7* marm/*march=armv7* ++MULTILIB_MATCHES += march?armv7=march?armv7-a ++MULTILIB_MATCHES += march?armv7=march?armv7-r ++MULTILIB_MATCHES += march?armv7=march?armv7-m ++MULTILIB_MATCHES += march?armv7=mcpu?cortex-a8 ++MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4 ++MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3 ++MULTILIB_MATCHES += march?armv7=mcpu?cortex-m4 + + # Not quite true. We can support hard-vfp calling in Thumb2, but how do we + # express that here? Also, we really need architecture v5e or later + # (mcrr etc). +-MULTILIB_OPTIONS += mfloat-abi=hard +-MULTILIB_DIRNAMES += fpu +-MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard* ++ ++# Disable these for ANDROID arm-eabi toolchain ++#MULTILIB_OPTIONS += mfloat-abi=hard ++#MULTILIB_DIRNAMES += fpu ++#MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard* ++ + #MULTILIB_EXCEPTIONS += *mcpu=fa526/*mfloat-abi=hard* + #MULTILIB_EXCEPTIONS += *mcpu=fa626/*mfloat-abi=hard* + +-- +1.8.4.5 + diff --git a/6.3/0006-Support-Clang-in-C-11.patch b/6.3/0006-Support-Clang-in-C-11.patch new file mode 100644 index 0000000..48f22f3 --- /dev/null +++ b/6.3/0006-Support-Clang-in-C-11.patch @@ -0,0 +1,30 @@ +From bc047c285952c2a9e4e1cbc19ceebfe5f54e5f4f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:01:30 +0100 +Subject: [PATCH 06/17] Support Clang in C++11 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/include/std/type_traits | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits +index 4b434a6..0261c7d 100644 +--- a/libstdc++-v3/include/std/type_traits ++++ b/libstdc++-v3/include/std/type_traits +@@ -1938,7 +1938,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + struct __common_type_impl + : private __do_common_type_impl + { +- typedef decltype(_S_test<_Tp, _Up>(0)) type; ++ typedef typename decay<decltype(_S_test<_Tp, _Up>(0))>::type type; + }; + + struct __do_member_type_wrapper +-- +1.8.4.5 + diff --git a/6.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch b/6.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch new file mode 100644 index 0000000..abb8bc2 --- /dev/null +++ b/6.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch @@ -0,0 +1,30 @@ +From fed003a30eac2178f956d5a0e3d0339baa89af8f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:01:57 +0100 +Subject: [PATCH 07/17] Enable _GLIBCXX_HAS_THREADS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 448bee3..a943808 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -72443,7 +72443,7 @@ $as_echo_n "checking for gthreads library... " >&6; } + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +-#include "gthr.h" ++#include "gthr-$target_thread_file.h" + int + main () + { +-- +1.8.4.5 + diff --git a/6.3/0008-Fix-OpenMP-support-on-Android.patch b/6.3/0008-Fix-OpenMP-support-on-Android.patch new file mode 100644 index 0000000..9c366d8 --- /dev/null +++ b/6.3/0008-Fix-OpenMP-support-on-Android.patch @@ -0,0 +1,12 @@ +--- gcc-5.0/gcc/config/linux-android.h.omv~ 2015-01-03 12:36:08.117468854 +0100 ++++ gcc-5.0/gcc/config/linux-android.h 2015-01-03 12:36:38.661015906 +0100 +@@ -49,7 +49,8 @@ + "%{!frtti:%{!fno-rtti: -fno-rtti}}" + + #define ANDROID_LIB_SPEC \ +- "%{!static: -ldl}" ++ "%{!static: -ldl} \ ++ %{pthread: -lc}" + + #define ANDROID_STARTFILE_SPEC \ + "%{shared: crtbegin_so%O%s;:" \ diff --git a/6.3/0009-Disable-libstdc-versioning.patch b/6.3/0009-Disable-libstdc-versioning.patch new file mode 100644 index 0000000..645b654 --- /dev/null +++ b/6.3/0009-Disable-libstdc-versioning.patch @@ -0,0 +1,44 @@ +From a228f073aa2880af605d7b03e29596e3d083199f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:02:54 +0100 +Subject: [PATCH 09/17] Disable libstdc++ versioning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/src/Makefile.am | 2 +- + libstdc++-v3/src/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am +index 6c2d228..3040404 100644 +--- a/libstdc++-v3/src/Makefile.am ++++ b/libstdc++-v3/src/Makefile.am +@@ -69,7 +69,7 @@ libstdc___la_DEPENDENCIES = \ + $(top_builddir)/src/c++11/libc++11convenience.la + + libstdc___la_LDFLAGS = \ +- -version-info $(libtool_VERSION) ${version_arg} -lm ++ -avoid-version ${version_arg} -lm + + libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) + +diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in +index cd3943b..1e18c5f 100644 +--- a/libstdc++-v3/src/Makefile.in ++++ b/libstdc++-v3/src/Makefile.in +@@ -375,7 +375,7 @@ libstdc___la_DEPENDENCIES = \ + $(top_builddir)/src/c++11/libc++11convenience.la + + libstdc___la_LDFLAGS = \ +- -version-info $(libtool_VERSION) ${version_arg} -lm ++ -avoid-version ${version_arg} -lm + + libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) + +-- +1.8.4.5 + diff --git a/6.3/0010-Add-mclinker-support-fuse-ld-mcld.patch b/6.3/0010-Add-mclinker-support-fuse-ld-mcld.patch new file mode 100644 index 0000000..fb5200a --- /dev/null +++ b/6.3/0010-Add-mclinker-support-fuse-ld-mcld.patch @@ -0,0 +1,71 @@ +From 9c80ba5af1b6c8b5353e06a215466c9cbe70026d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:05:50 +0100 +Subject: [PATCH 10/17] Add mclinker support: -fuse-ld=mcld +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + gcc/collect2.c | 8 ++++++-- + gcc/doc/invoke.texi | 4 ++++ + gcc/gcc.c | 2 +- + 3 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/gcc/collect2.c b/gcc/collect2.c +index 38d3421..74c6ff9 100644 +--- a/gcc/collect2.c ++++ b/gcc/collect2.c +@@ -857,6 +857,7 @@ main (int argc, char **argv) + USE_PLUGIN_LD, + USE_GOLD_LD, + USE_BFD_LD, ++ USE_MCLD_LD, + USE_LD_MAX + } selected_linker = USE_DEFAULT_LD; + static const char *const ld_suffixes[USE_LD_MAX] = +@@ -864,7 +865,8 @@ main (int argc, char **argv) + "ld", + PLUGIN_LD_SUFFIX, + "ld.gold", +- "ld.bfd" ++ "ld.bfd", ++ "ld.mcld" + }; + static const char *const real_ld_suffix = "real-ld"; + static const char *const collect_ld_suffix = "collect-ld"; +@@ -1034,6 +1036,8 @@ main (int argc, char **argv) + selected_linker = USE_BFD_LD; + else if (strcmp (argv[i], "-fuse-ld=gold") == 0) + selected_linker = USE_GOLD_LD; ++ else if (strcmp (argv[i], "-fuse-ld=mcld") == 0) ++ selected_linker = USE_MCLD_LD; + + #ifdef COLLECT_EXPORT_LIST + /* These flags are position independent, although their order +@@ -1335,7 +1339,7 @@ main (int argc, char **argv) + else if (!use_collect_ld + && strncmp (arg, "-fuse-ld=", 9) == 0) + { +- /* Do not pass -fuse-ld={bfd|gold} to the linker. */ ++ /* Do not pass -fuse-ld={bfd|gold|mcld} to the linker. */ + ld1--; + ld2--; + } +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index ae4d529..ce7cc58 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -8776,6 +8776,10 @@ Use the @command{bfd} linker instead of the default linker. + @opindex fuse-ld=gold + Use the @command{gold} linker instead of the default linker. + ++@item -fuse-ld=mcld ++@opindex fuse-ld=mcld ++Use the @command{mcld} linker instead of the default linker. ++ + @cindex Libraries + @item -l@var{library} + @itemx -l @var{library} diff --git a/6.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch b/6.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch new file mode 100644 index 0000000..996c6df --- /dev/null +++ b/6.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch @@ -0,0 +1,46 @@ +From 8154cd7d4ea2e1f0e94bae81fedf6c260ce93760 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:07:40 +0100 +Subject: [PATCH 11/17] Use default visibility for the __cxa functions in + eh_arm.cc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/libsupc++/eh_arm.cc | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc +index aa453dd..859a713 100644 +--- a/libstdc++-v3/libsupc++/eh_arm.cc ++++ b/libstdc++-v3/libsupc++/eh_arm.cc +@@ -29,6 +29,16 @@ + + using namespace __cxxabiv1; + ++// The GCC command-line option "-fvisibility=hidden" apparently fails to hide ++// the visibility of the inline assembly function "__cxa_end_cleanup". ++// We need to keep the visibility of the __cxa_* functions coherent otherwise ++// linking eh_arm.o to resolve __cxa_end_cleanup (eg needed by -frtti ++// -fexceptions) will disappoint the linker by exposing __cxa_type_match and ++// __cxa_begin_cleanup (eg needed by __aeabi_idiv from libgcc.a). ++// Therefore as a simple workaround we just force the visibility to default for ++// all these __cxa functions in this module. ++ ++#pragma GCC visibility push(default) + + // Given the thrown type THROW_TYPE, exception object UE_HEADER and a + // type CATCH_TYPE to compare against, return whether or not there is +@@ -224,4 +234,6 @@ asm (" .pushsection .text.__cxa_end_cleanup\n" + #endif + #endif + ++#pragma GCC visibility pop ++ + #endif +-- +1.8.4.5 + diff --git a/6.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch b/6.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch new file mode 100644 index 0000000..dca72d6 --- /dev/null +++ b/6.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch @@ -0,0 +1,239 @@ +From 13a89602f1d8f90038192423dab2afdc39c5f4e5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:09:00 +0100 +Subject: [PATCH 12/17] OpenMP: Better CPU count detection for Linux +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libgomp/config/linux/proc.c | 189 +++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 186 insertions(+), 3 deletions(-) + +diff --git a/libgomp/config/linux/proc.c b/libgomp/config/linux/proc.c +index fa89f1d..15b0b35 100644 +--- a/libgomp/config/linux/proc.c ++++ b/libgomp/config/linux/proc.c +@@ -31,8 +31,11 @@ + #include "libgomp.h" + #include "proc.h" + #include <errno.h> +-#include <stdlib.h> + #include <unistd.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <fcntl.h> ++#include <errno.h> + #ifdef HAVE_GETLOADAVG + # ifdef HAVE_SYS_LOADAVG_H + # include <sys/loadavg.h> +@@ -73,6 +76,186 @@ gomp_cpuset_popcount (unsigned long cpusetsize, cpu_set_t *cpusetp) + } + #endif + ++/* Read the content of a file. ++ * Return the length of the data, or -1 on error. Does *not* ++ * zero-terminate the content. Will not read more ++ * than 'buffsize' bytes. ++ */ ++static int ++read_file(const char* pathname, char* buffer, size_t buffsize) ++{ ++ int fd, len; ++ ++ fd = open(pathname, O_RDONLY); ++ if (fd < 0) ++ return -1; ++ ++ do { ++ len = read(fd, buffer, buffsize); ++ } while (len < 0 && errno == EINTR); ++ ++ close(fd); ++ ++ return len; ++} ++ ++ ++/* Parse a decimal integer starting from 'input', but not going further ++ * than 'limit'. Return the value into '*result'. ++ * ++ * NOTE: Does not skip over leading spaces, or deal with sign characters. ++ * NOTE: Ignores overflows. ++ * ++ * The function returns NULL in case of error (bad format), or the new ++ * position after the decimal number in case of success (which will always ++ * be <= 'limit'). ++ */ ++static const char* ++parse_decimal(const char* input, const char* limit, int* result) ++{ ++ const char* p = input; ++ int val = 0; ++ while (p < limit) { ++ int d = (*p - '0'); ++ if ((unsigned)d >= 10U) ++ break; ++ val = val*10 + d; ++ p++; ++ } ++ if (p == input) ++ return NULL; ++ ++ *result = val; ++ return p; ++} ++ ++ ++/* This data type is used to represent a CPU list / mask, as read ++ * from sysfs on Linux. See http://www.kernel.org/doc/Documentation/cputopology.txt ++ */ ++typedef struct { ++ int mask; ++} cpuList; ++ ++/* Returns Actual CPUs (total installed CPUs) */ ++static int ++cpuList_count (cpuList* list) { ++ return list->mask ; ++} ++ ++/* Parse a textual list of cpus and store the result inside a cpuList object. ++ * Input format is the following: ++ * - comma-separated list of items (no spaces) ++ * - each item is either a single decimal number (cpu index), or a range made ++ * of two numbers separated by a single dash (-). Ranges are inclusive. ++ * Examples: ++ * 0 ++ * 2,4-127,128-143 ++ * 0-1 ++ */ ++static void ++cpuList_parse (cpuList* list, const char* line, int line_len) ++{ ++ const char* p = line; ++ const char* end = p + line_len; ++ const char* q; ++ ++ /* NOTE: the input line coming from sysfs typically contains a ++ * trailing newline, so take care of it in the code below ++ */ ++ while (p < end && *p != '\n') ++ { ++ int val, start_value, end_value; ++ ++ /* Find the end of current item, and put it into 'q' */ ++ q = memchr(p, ',', end-p); ++ if (q == NULL) { ++ q = end; ++ } ++ ++ /* Get first value */ ++ p = parse_decimal(p, q, &start_value); ++ if (p == NULL) ++ goto BAD_FORMAT; ++ ++ end_value = start_value; ++ ++ /* If we're not at the end of the item, expect a dash and ++ * and integer; extract end value. ++ */ ++ if (p < q && *p == '-') { ++ p = parse_decimal(p+1, q, &end_value); ++ if (p == NULL) ++ goto BAD_FORMAT; ++ } ++ ++ /* Set CPU list */ ++ for (val = start_value; val <= end_value; val++) { ++ list->mask++; ++ } ++ ++ /* Jump to next item */ ++ p = q; ++ if (p < end) ++ p++; ++ } ++ ++BAD_FORMAT: ++ ; ++} ++ ++ ++/* Read a CPU list from one sysfs file ++ * The below is CPU related sys interface by CPU topologoy. ++ */ ++static void ++cpuList_read_from (cpuList* list, const char* filename) ++{ ++ char file[64]; ++ int filelen; ++ ++ list->mask = 0; ++ ++ filelen = read_file(filename, file, sizeof file); ++ if (filelen < 0) { ++ fprintf(stderr,"Could not read %s: %s\n", filename, strerror(errno)); ++ return; ++ } ++ ++ cpuList_parse(list, file, filelen); ++} ++ ++ ++/* Probe the number of actual CPUs on devices (e.g. Android devices) using ++ * CPU-Hotplug and CPU-DVFS to optimize battery life. ++ * Return the number of CPUs present on a given device. ++ * See http://www.kernel.org/doc/Documentation/cputopology.txt ++ */ ++static int ++sc_nprocessors_actu () ++{ ++ char buffer[256]; ++ int buffer_len; ++ int cpuCount = 1; ++ cpuList cpus_present[1]; ++ char file_name[64] = "/sys/devices/system/cpu/present"; ++ ++ buffer_len = read_file(file_name, buffer, sizeof buffer); ++ ++ if (buffer_len < 0) /* should not happen */ { ++ fprintf(stderr,"Could not find %s: %s\n", file_name, strerror(errno)); ++ return; ++ } ++ ++ /* Count the CPU cores, the value may be 0 for single-core CPUs */ ++ cpuList_read_from(cpus_present, file_name); ++ cpuCount = cpuList_count(cpus_present); ++ if (cpuCount == 0) { ++ cpuCount = 1; ++ } ++ return cpuCount; ++} ++ + /* At startup, determine the default number of threads. It would seem + this should be related to the number of cpus online. */ + +@@ -139,7 +322,7 @@ gomp_init_num_threads (void) + gomp_cpusetp = NULL; + #endif + #ifdef _SC_NPROCESSORS_ONLN +- gomp_global_icv.nthreads_var = sysconf (_SC_NPROCESSORS_ONLN); ++ gomp_global_icv.nthreads_var = sc_nprocessors_actu (); + #endif + } + +@@ -170,7 +353,7 @@ get_num_procs (void) + } + #endif + #ifdef _SC_NPROCESSORS_ONLN +- return sysconf (_SC_NPROCESSORS_ONLN); ++ return sc_nprocessors_actu (); + #else + return gomp_icv (false)->nthreads_var; + #endif +-- +1.8.4.5 + diff --git a/6.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch b/6.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch new file mode 100644 index 0000000..7887035 --- /dev/null +++ b/6.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch @@ -0,0 +1,76 @@ +--- gcc-5.0/libgomp/config/linux/futex.h.omv~ 2015-01-03 12:45:11.657846480 +0100 ++++ gcc-5.0/libgomp/config/linux/futex.h 2015-01-03 12:45:38.064689252 +0100 +@@ -38,6 +38,10 @@ + + #pragma GCC visibility pop + ++#if !defined(SYS_futex) ++#define SYS_futex __NR_futex ++#endif ++ + static inline void + futex_wait (int *addr, int val) + { +--- gcc-5.0/libgomp/config/linux/proc.c.omv~ 2015-01-03 12:45:56.378144531 +0100 ++++ gcc-5.0/libgomp/config/linux/proc.c 2015-01-03 12:48:26.195803418 +0100 +@@ -244,7 +244,7 @@ sc_nprocessors_actu () + + if (buffer_len < 0) /* should not happen */ { + fprintf(stderr,"Could not find %s: %s\n", file_name, strerror(errno)); +- return; ++ return 1; + } + + /* Count the CPU cores, the value may be 0 for single-core CPUs */ +@@ -321,8 +321,10 @@ gomp_init_num_threads (void) + free (gomp_cpusetp); + gomp_cpusetp = NULL; + #endif +-#ifdef _SC_NPROCESSORS_ONLN ++#if defined(__ANDROID__) + gomp_global_icv.nthreads_var = sc_nprocessors_actu (); ++#elif defined(_SC_NPROCESSORS_ONLN) ++ gomp_global_icv.nthreads_var = sysconf (_SC_NPROCESSORS_ONLN); + #endif + } + +@@ -352,8 +354,10 @@ get_num_procs (void) + return gomp_available_cpus; + } + #endif +-#ifdef _SC_NPROCESSORS_ONLN ++#if defined(__ANDROID__) + return sc_nprocessors_actu (); ++#elif defined(_SC_NPROCESSORS_ONLN) ++ return sysconf (_SC_NPROCESSORS_ONLN); + #else + return gomp_icv (false)->nthreads_var; + #endif +--- gcc-5.0/libgomp/configure.omv~ 2015-01-03 12:48:31.039168677 +0100 ++++ gcc-5.0/libgomp/configure 2015-01-03 12:49:50.139688833 +0100 +@@ -15212,6 +15212,12 @@ case "$target" in + /* end confdefs.h. */ + #include <sys/syscall.h> + int lk; ++#if !defined(SYS_gettid) ++#define SYS_gettid __NR_gettid ++#endif ++#if !defined(SYS_futex) ++#define SYS_futex __NR_futex ++#endif + int + main () + { +@@ -15264,6 +15270,12 @@ rm -f core conftest.err conftest.$ac_obj + /* end confdefs.h. */ + #include <sys/syscall.h> + int lk; ++#if !defined(SYS_gettid) ++#define SYS_gettid __NR_gettid ++#endif ++#if !defined(SYS_futex) ++#define SYS_futex __NR_futex ++#endif + int + main () + { diff --git a/6.3/0014-GNU-libstdc-enable-linux-futex.patch b/6.3/0014-GNU-libstdc-enable-linux-futex.patch new file mode 100644 index 0000000..5aa37a6 --- /dev/null +++ b/6.3/0014-GNU-libstdc-enable-linux-futex.patch @@ -0,0 +1,65 @@ +From 5de3d2a95e4aec65a063a1b3262aca1766933c95 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:10:10 +0100 +Subject: [PATCH 14/17] GNU libstdc++ --enable-linux-futex +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + libstdc++-v3/configure | 12 ++++++++++++ + libstdc++-v3/libsupc++/guard.cc | 5 +++++ + 2 files changed, 17 insertions(+) + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index a943808..6fe69df 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -70978,6 +70978,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <sys/syscall.h> + int lk; ++#if !defined(SYS_gettid) ++#define SYS_gettid __NR_gettid ++#endif ++#if !defined(SYS_futex) ++#define SYS_futex __NR_futex ++#endif + int + main () + { +@@ -71036,6 +71042,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #include <sys/syscall.h> + int lk; ++#if !defined(SYS_gettid) ++#define SYS_gettid __NR_gettid ++#endif ++#if !defined(SYS_futex) ++#define SYS_futex __NR_futex ++#endif + int + main () + { +diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc +index 54f7458..45de1bb 100644 +--- a/libstdc++-v3/libsupc++/guard.cc ++++ b/libstdc++-v3/libsupc++/guard.cc +@@ -33,7 +33,12 @@ + #if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \ + && (ATOMIC_INT_LOCK_FREE > 1) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) + # include <climits> ++#if defined(__ANDROID__) ++# include <sys/syscall.h> ++# define SYS_futex __NR_futex ++#else + # include <syscall.h> ++#endif + # include <unistd.h> + # define _GLIBCXX_USE_FUTEX + # define _GLIBCXX_FUTEX_WAIT 0 +-- +1.8.4.5 + diff --git a/6.3/0015-Add-fuse-ld-mcld.patch b/6.3/0015-Add-fuse-ld-mcld.patch new file mode 100644 index 0000000..998630c --- /dev/null +++ b/6.3/0015-Add-fuse-ld-mcld.patch @@ -0,0 +1,36 @@ +From 83fc2df102c47f18ee5fcf50e8a36427f3f0b179 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:12:14 +0100 +Subject: [PATCH 15/17] Add -fuse-ld=mcld +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + gcc/common.opt | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gcc/common.opt b/gcc/common.opt +index 03f9b9b..fa4f0fe 100644 +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -2512,9 +2512,13 @@ Common Driver Negative(fuse-ld=gold) + Use the bfd linker instead of the default linker. + + fuse-ld=gold +-Common Driver Negative(fuse-ld=bfd) ++Common Driver Negative(fuse-ld=mcld) + Use the gold linker instead of the default linker. + ++fuse-ld=mcld ++Common Driver Negative(fuse-ld=bfd) ++Use the mcld linker instead of the default linker. ++ + fuse-linker-plugin + Common Undocumented Var(flag_use_linker_plugin) + +-- +1.8.4.5 + diff --git a/6.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch b/6.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch new file mode 100644 index 0000000..0664e88 --- /dev/null +++ b/6.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch @@ -0,0 +1,37 @@ +From 4f759a186b0b4fe2f86e184a03b1e225a356c495 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + <Bernhard.Rosenkranzer@linaro.org> +Date: Mon, 6 Jan 2014 00:12:39 +0100 +Subject: [PATCH 16/17] Fix insufficient alignment for NEON vst/vld +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> +--- + gcc/config/arm/arm.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c +index 142db45..2d16094 100644 +--- a/gcc/config/arm/arm.c ++++ b/gcc/config/arm/arm.c +@@ -21541,9 +21541,13 @@ arm_print_operand (FILE *stream, rtx x, int code) + memsize = MEM_SIZE (x); + + /* Only certain alignment specifiers are supported by the hardware. */ +- if (memsize == 32 && (align % 32) == 0) ++ /* Note that ARM EABI only guarentees 8-byte stack alignment. While GCC ++ honors stricter alignment of composite type in user code, it doesn't ++ observe the alignment of memory passed as an extra argument for function ++ returning large composite type. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57271 */ ++ if (memsize == 32 && (align % 32) == 0 && !TARGET_AAPCS_BASED) + align_bits = 256; +- else if ((memsize == 16 || memsize == 32) && (align % 16) == 0) ++ else if ((memsize == 16 || memsize == 32) && (align % 16) == 0 && !TARGET_AAPCS_BASED) + align_bits = 128; + else if (memsize >= 8 && (align % 8) == 0) + align_bits = 64; +-- +1.8.4.5 + diff --git a/6.3/0017-Use-eh_frame_hdr-for-static-linking.patch b/6.3/0017-Use-eh_frame_hdr-for-static-linking.patch new file mode 100644 index 0000000..da6f734 --- /dev/null +++ b/6.3/0017-Use-eh_frame_hdr-for-static-linking.patch @@ -0,0 +1,237 @@ +--- gcc-5.0/gcc/config/alpha/elf.h.omv~ 2015-01-03 12:52:18.403762854 +0100 ++++ gcc-5.0/gcc/config/alpha/elf.h 2015-01-03 12:53:05.767258870 +0100 +@@ -168,5 +168,9 @@ extern int alpha_this_gpdisp_sequence_nu + I imagine that other systems will catch up. In the meantime, it + doesn't harm to make sure that the data exists to be used later. */ + #if defined(HAVE_LD_EH_FRAME_HDR) ++#ifdef USE_EH_FRAME_HDR_FOR_STATIC ++#define LINK_EH_SPEC "--eh-frame-hdr " ++#else + #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif ++#endif +--- gcc-5.0/gcc/config/freebsd.h.omv~ 2015-01-03 12:53:12.360615299 +0100 ++++ gcc-5.0/gcc/config/freebsd.h 2015-01-03 12:53:45.750733907 +0100 +@@ -45,8 +45,12 @@ along with GCC; see the file COPYING3. + #define LIB_SPEC FBSD_LIB_SPEC + + #if defined(HAVE_LD_EH_FRAME_HDR) ++#ifdef USE_EH_FRAME_HDR_FOR_STATIC ++#define LINK_EH_SPEC "--eh-frame-hdr " ++#else + #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif ++#endif + + #ifdef TARGET_LIBC_PROVIDES_SSP + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ +--- gcc-5.0/gcc/config/gnu-user.h.omv~ 2015-01-03 12:53:50.734085173 +0100 ++++ gcc-5.0/gcc/config/gnu-user.h 2015-01-03 12:54:13.590834847 +0100 +@@ -94,8 +94,12 @@ see the files COPYING3 and COPYING.RUNTI + #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC + + #if defined(HAVE_LD_EH_FRAME_HDR) ++#ifdef USE_EH_FRAME_HDR_FOR_STATIC ++#define LINK_EH_SPEC "--eh-frame-hdr " ++#else + #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif ++#endif + + #undef LINK_GCC_C_SEQUENCE_SPEC + #define LINK_GCC_C_SEQUENCE_SPEC \ +--- gcc-5.0/gcc/config.in.omv~ 2015-01-03 12:51:09.193535754 +0100 ++++ gcc-5.0/gcc/config.in 2015-01-03 12:52:08.790397207 +0100 +@@ -1992,6 +1992,10 @@ + #undef USE_CYGWIN_LIBSTDCXX_WRAPPERS + #endif + ++/* Define if your system supports PT_GNU_EH_FRAME for static executables. */ ++#ifndef USED_FOR_TARGET ++#undef USE_EH_FRAME_HDR_FOR_STATIC ++#endif + + /* Define to 1 if the 'long long' type is wider than 'long' but still + efficiently supported by the host hardware. */ +--- gcc-5.0/gcc/config/openbsd.h.omv~ 2015-01-03 12:54:17.810850308 +0100 ++++ gcc-5.0/gcc/config/openbsd.h 2015-01-03 12:54:47.117625474 +0100 +@@ -136,8 +136,12 @@ while (0) + #define LIB_SPEC OBSD_LIB_SPEC + + #if defined(HAVE_LD_EH_FRAME_HDR) ++#ifdef USE_EH_FRAME_HDR_FOR_STATIC ++#define LINK_EH_SPEC "--eh-frame-hdr " ++#else + #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " + #endif ++#endif + + #undef LIB_SPEC + #define LIB_SPEC OBSD_LIB_SPEC +--- gcc-5.0/gcc/config/rs6000/sysv4.h.omv~ 2015-01-03 12:54:56.594327642 +0100 ++++ gcc-5.0/gcc/config/rs6000/sysv4.h 2015-01-03 12:55:24.477766592 +0100 +@@ -779,7 +779,11 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" + + #if defined(HAVE_LD_EH_FRAME_HDR) +-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++# ifdef USE_EH_FRAME_HDR_FOR_STATIC ++# define LINK_EH_SPEC "--eh-frame-hdr " ++# else ++# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++# endif + #endif + + #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ +--- gcc-5.0/gcc/config/sol2.h.omv~ 2015-01-03 12:58:09.745092558 +0100 ++++ gcc-5.0/gcc/config/sol2.h 2015-01-03 12:58:35.988535463 +0100 +@@ -296,7 +296,11 @@ along with GCC; see the file COPYING3. + /* Solaris 11 build 135+ implements dl_iterate_phdr. GNU ld needs + --eh-frame-hdr to create the required .eh_frame_hdr sections. */ + #if defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR) ++#ifdef USE_EH_FRAME_HDR_FOR_STATIC ++#define LINK_EH_SPEC "--eh-frame-hdr " ++#else + #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " ++#endif + #endif /* HAVE_LD_EH_FRAME && TARGET_DL_ITERATE_PHDR */ + #endif + +--- gcc-5.0/gcc/configure.ac.omv~ 2015-01-03 13:00:55.745805865 +0100 ++++ gcc-5.0/gcc/configure.ac 2015-01-03 13:01:52.739394493 +0100 +@@ -4635,6 +4635,35 @@ GCC_TARGET_TEMPLATE([HAVE_LD_EH_FRAME_HD + if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then + AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1, + [Define if your linker supports .eh_frame_hdr.]) ++ AC_ARG_ENABLE(eh-frame-hdr-for-static, ++ [AS_HELP_STRING([--enable-eh-frame-hdr-for-static], ++ [enable linker PT_GNU_EH_FRAME support for static executable])], ++ [case $enable_eh_frame_hdr_for_static in ++ yes | no) ;; ++ *) AC_MSG_ERROR(['$enable_eh_frame_hdr_for_static' is an invalid ++value for --enable-eh-frame-hdr-for-static. ++Valid choices are 'yes' and 'no'.]) ;; ++ esac], ++# Only support for glibc 2.3.0 or higher with AT_PHDR/AT_PHNUM from ++# Linux kernel. ++ [[if test x$host = x$build -a x$host = x$target && ++ ldd --version 2>&1 >/dev/null && ++ glibcver=`ldd --version 2>/dev/null | sed 's/.* //;q'`; then ++ glibcmajor=`expr "$glibcver" : "\([0-9]*\)"` ++ glibcminor=`expr "$glibcver" : "[2-9]*\.\([0-9]*\)"` ++ glibcnum=`expr $glibcmajor \* 1000 + $glibcminor` ++ if test "$glibcnum" -ge 2003 ; then ++ auvx=`LD_SHOW_AUXV=1 ldd 2>/dev/null` ++ if echo "$auvx" | grep AT_PHDR > /dev/null && ++ echo "$auvx" | grep AT_PHNUM > /dev/null; then ++ enable_eh_frame_hdr_for_static=yes ++ fi ++ fi ++ fi]]) ++ if test x$enable_eh_frame_hdr_for_static = xyes; then ++ AC_DEFINE(USE_EH_FRAME_HDR_FOR_STATIC, 1, ++[Define if your system supports PT_GNU_EH_FRAME for static executable.]) ++ fi + fi + AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) + +--- gcc-5.0/gcc/configure.omv~ 2015-01-03 12:58:40.815222419 +0100 ++++ gcc-5.0/gcc/configure 2015-01-03 13:00:53.709130169 +0100 +@@ -925,6 +925,7 @@ enable_comdat + enable_fix_cortex_a53_843419 + with_glibc_version + enable_gnu_unique_object ++enable_eh_frame_hdr_for_static + enable_linker_build_id + enable_default_ssp + with_long_double_128 +@@ -1651,6 +1652,9 @@ Optional Features: + --enable-gnu-unique-object + enable the use of the @gnu_unique_object ELF + extension on glibc systems ++ --enable-eh-frame-hdr-for-static ++ enable linker PT_GNU_EH_FRAME support for static ++ executable + --enable-linker-build-id + compiler will always pass --build-id to linker + --enable-default-ssp enable Stack Smashing Protection as default +@@ -26959,6 +26963,38 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xye + + $as_echo "#define HAVE_LD_EH_FRAME_HDR 1" >>confdefs.h + ++ # Check whether --enable-eh-frame-hdr-for-static was given. ++if test "${enable_eh_frame_hdr_for_static+set}" = set; then : ++ enableval=$enable_eh_frame_hdr_for_static; case $enable_eh_frame_hdr_for_static in ++ yes | no) ;; ++ *) as_fn_error "'$enable_eh_frame_hdr_for_static' is an invalid ++value for --enable-eh-frame-hdr-for-static. ++Valid choices are 'yes' and 'no'." "$LINENO" 5 ;; ++ esac ++else ++ # Only support for glibc 2.3.0 or higher with AT_PHDR/AT_PHNUM from ++# Linux kernel. ++ if test x$host = x$build -a x$host = x$target && ++ ldd --version 2>&1 >/dev/null && ++ glibcver=`ldd --version 2>/dev/null | sed 's/.* //;q'`; then ++ glibcmajor=`expr "$glibcver" : "\([0-9]*\)"` ++ glibcminor=`expr "$glibcver" : "[2-9]*\.\([0-9]*\)"` ++ glibcnum=`expr $glibcmajor \* 1000 + $glibcminor` ++ if test "$glibcnum" -ge 2003 ; then ++ auvx=`LD_SHOW_AUXV=1 ldd 2>/dev/null` ++ if echo "$auvx" | grep AT_PHDR > /dev/null && ++ echo "$auvx" | grep AT_PHNUM > /dev/null; then ++ enable_eh_frame_hdr_for_static=yes ++ fi ++ fi ++ fi ++fi ++ ++ if test x$enable_eh_frame_hdr_for_static = xyes; then ++ ++$as_echo "#define USE_EH_FRAME_HDR_FOR_STATIC 1" >>confdefs.h ++ ++ fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_eh_frame_hdr" >&5 + $as_echo "$gcc_cv_ld_eh_frame_hdr" >&6; } +--- gcc-5.0/libgcc/crtstuff.c.omv~ 2015-01-03 13:02:06.309456002 +0100 ++++ gcc-5.0/libgcc/crtstuff.c 2015-01-03 13:05:35.547103310 +0100 +@@ -88,7 +88,8 @@ call_ ## FUNC (void) \ + #if defined(OBJECT_FORMAT_ELF) \ + && !defined(OBJECT_FORMAT_FLAT) \ + && defined(HAVE_LD_EH_FRAME_HDR) \ +- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ ++ && !defined(inhibit_libc) \ ++ && (defined(USE_EH_FRAME_HDR_FOR_STATIC) || !defined(CRTSTUFFT_O)) \ + && defined(BSD_DL_ITERATE_PHDR_AVAILABLE) + #include <link.h> + # define USE_PT_GNU_EH_FRAME +@@ -97,7 +98,8 @@ call_ ## FUNC (void) \ + #if defined(OBJECT_FORMAT_ELF) \ + && !defined(OBJECT_FORMAT_FLAT) \ + && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR) \ +- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ ++ && !defined(inhibit_libc) \ ++ && (defined(USE_EH_FRAME_HDR_FOR_STATIC) || !defined(CRTSTUFFT_O)) \ + && defined(__sun__) && defined(__svr4__) + #include <link.h> + # define USE_PT_GNU_EH_FRAME +@@ -106,7 +108,8 @@ call_ ## FUNC (void) \ + #if defined(OBJECT_FORMAT_ELF) \ + && !defined(OBJECT_FORMAT_FLAT) \ + && defined(HAVE_LD_EH_FRAME_HDR) \ +- && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ ++ && !defined(inhibit_libc) \ ++ && (defined(USE_EH_FRAME_HDR_FOR_STATIC) || !defined(CRTSTUFFT_O)) \ + && defined(__GLIBC__) && __GLIBC__ >= 2 + #include <link.h> + /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h. +@@ -121,7 +124,7 @@ call_ ## FUNC (void) \ + #if defined(OBJECT_FORMAT_ELF) \ + && !defined(OBJECT_FORMAT_FLAT) \ + && defined(HAVE_LD_EH_FRAME_HDR) \ +- && !defined(CRTSTUFFT_O) \ ++ && (defined(USE_EH_FRAME_HDR_FOR_STATIC) || !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 diff --git a/6.3/0018-use-android-specs-on-aarch64.patch b/6.3/0018-use-android-specs-on-aarch64.patch new file mode 100644 index 0000000..a09fbc1 --- /dev/null +++ b/6.3/0018-use-android-specs-on-aarch64.patch @@ -0,0 +1,68 @@ +--- gcc-5.0/gcc/config/aarch64/aarch64-linux.h.omv~ 2015-01-03 13:09:08.974824478 +0100 ++++ gcc-5.0/gcc/config/aarch64/aarch64-linux.h 2015-01-03 13:14:47.643252366 +0100 +@@ -22,15 +22,29 @@ + #define GCC_AARCH64_LINUX_H + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#define BIONIC_DYNAMIC_LINKER "/system/bin/linker64" + + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + + #undef CC1_SPEC +-#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC ++#define CC1_SPEC LINUX_OR_ANDROID_CC(GNU_USER_TARGET_CC1_SPEC, \ ++ GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC("-fPIC")) ASAN_CC1_SPEC ++ ++#define CC1PLUS_SPEC \ ++ LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) ++ ++#undef LIB_SPEC ++#define LIB_SPEC \ ++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ ++ GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC) ++ ++#undef STARTFILE_SPEC ++#define STARTFILE_SPEC \ ++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) + + #define CPP_SPEC "%{pthread:-D_REENTRANT}" + +@@ -49,7 +63,8 @@ + " %{mfix-cortex-a53-843419:--fix-cortex-a53-843419}" + #endif + +-#define LINK_SPEC LINUX_TARGET_LINK_SPEC \ ++#define LINK_SPEC LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ ++ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) \ + CA53_ERR_835769_SPEC \ + CA53_ERR_843419_SPEC + +@@ -64,6 +79,11 @@ + do \ + { \ + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ ++ ANDROID_TARGET_OS_CPP_BUILTINS(); \ + } \ + while (0) ++ ++#undef ENDFILE_SPEC ++#define ENDFILE_SPEC \ ++ LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + +--- gcc-5.0/gcc/config.gcc.omv~ 2015-01-03 13:07:48.517754552 +0100 ++++ gcc-5.0/gcc/config.gcc 2015-01-03 13:09:02.768126472 +0100 +@@ -906,8 +906,9 @@ aarch64*-*-elf) + TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` + ;; + aarch64*-*-linux*) +- tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h" ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h" + tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-linux.h" ++ extra_options="${extra_options} linux-android.opt" + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux" + case $target in + aarch64_be-*) diff --git a/6.3/0019-aarch64-bionic-linker-path.patch b/6.3/0019-aarch64-bionic-linker-path.patch new file mode 100644 index 0000000..c4fb252 --- /dev/null +++ b/6.3/0019-aarch64-bionic-linker-path.patch @@ -0,0 +1,10 @@ +--- gcc-5.0/gcc/config/aarch64/aarch64-linux.h.omv~ 2015-01-03 13:17:54.257592402 +0100 ++++ gcc-5.0/gcc/config/aarch64/aarch64-linux.h 2015-01-03 13:18:04.830983417 +0100 +@@ -22,6 +22,7 @@ + #define GCC_AARCH64_LINUX_H + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++#undef BIONIC_DYNAMIC_LINKER + #define BIONIC_DYNAMIC_LINKER "/system/bin/linker64" + + #undef MUSL_DYNAMIC_LINKER diff --git a/6.3/0020-config-defaults.patch b/6.3/0020-config-defaults.patch new file mode 100644 index 0000000..0989df9 --- /dev/null +++ b/6.3/0020-config-defaults.patch @@ -0,0 +1,54 @@ +--- gcc-4.9/gcc/config/arm/linux-eabi.h.p20~ 2014-03-05 01:17:10.000000000 +0100 ++++ gcc-4.9/gcc/config/arm/linux-eabi.h 2014-03-06 04:37:39.786126091 +0100 +@@ -91,7 +91,7 @@ + #define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \ + GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \ +- ANDROID_CC1_SPEC) ++ ANDROID_CC1_SPEC("-fpic")) + + #define CC1PLUS_SPEC \ + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) +--- gcc-4.9/gcc/config/i386/linux-common.h.p20~ 2014-03-05 01:17:10.000000000 +0100 ++++ gcc-4.9/gcc/config/i386/linux-common.h 2014-03-06 04:37:39.786126091 +0100 +@@ -30,7 +30,14 @@ along with GCC; see the file COPYING3. + #undef CC1_SPEC + #define CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ +- GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) ++ GNU_USER_TARGET_CC1_SPEC \ ++ " -mstackrealign -msse3" \ ++ " -m32 -fno-short-enums" \ ++ " " \ ++ ANDROID_CC1_SPEC("-fPIC")) ++ ++#define CC1PLUS_SPEC \ ++ LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + + #undef LINK_SPEC + #define LINK_SPEC \ +--- gcc-4.9/gcc/config/linux-android.h.p20~ 2014-03-06 04:37:01.368833542 +0100 ++++ gcc-4.9/gcc/config/linux-android.h 2014-03-06 04:37:39.786126091 +0100 +@@ -40,9 +40,9 @@ + #define ANDROID_LINK_SPEC \ + "%{shared: -Bsymbolic}" + +-#define ANDROID_CC1_SPEC \ ++#define ANDROID_CC1_SPEC(ANDROID_PIC_DEFAULT) \ + "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ +- "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" ++ "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: " ANDROID_PIC_DEFAULT "}}}}" + + #define ANDROID_CC1PLUS_SPEC \ + "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ +--- gcc-4.9/gcc/config/mips/linux-common.h.omv~ 2014-03-25 08:25:44.256658710 +0100 ++++ gcc-4.9/gcc/config/mips/linux-common.h 2014-03-25 08:25:58.871705222 +0100 +@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. + #undef SUBTARGET_CC1_SPEC + #define SUBTARGET_CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ +- GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) ++ GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC("-fpic")) + + #undef CC1PLUS_SPEC + #define CC1PLUS_SPEC \ diff --git a/6.3/0021-disable-__cxa_throw_bad_array_new_length.patch b/6.3/0021-disable-__cxa_throw_bad_array_new_length.patch new file mode 100644 index 0000000..520596e --- /dev/null +++ b/6.3/0021-disable-__cxa_throw_bad_array_new_length.patch @@ -0,0 +1,39 @@ +commit 0e9bdbff3ee62cb299d50584bca725b1d22b80cf +Author: Ben Cheng <bccheng@google.com> +Date: Thu Apr 10 22:09:50 2014 -0700 + + [4.9] Temporarily disable __cxa_throw_bad_array_new_length + + Hack can be removed when it is supported by NDK. + + Change-Id: I043bb12580442fae48298a51d045b73f9cb568d3 + +diff --git a/gcc/cp/call.c b/gcc/cp/call.c +index 877f6d9..9a0e3b5 100644 +--- a/gcc/cp/call.c ++++ b/gcc/cp/call.c +@@ -4008,7 +4008,8 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args, + if (size_check != NULL_TREE) + { + tree errval = TYPE_MAX_VALUE (sizetype); +- if (cxx_dialect >= cxx11 && flag_exceptions) ++ /* ANDROID - temporarily disable __cxa_throw_bad_array_new_length call. */ ++ if (cxx_dialect >= cxx11 && flag_exceptions && 0) + errval = throw_bad_array_new_length (); + *size = fold_build3 (COND_EXPR, sizetype, size_check, + original_size, errval); +diff --git a/gcc/cp/init.c b/gcc/cp/init.c +index 2e1cdde..a254957 100644 +--- a/gcc/cp/init.c ++++ b/gcc/cp/init.c +@@ -2552,7 +2552,9 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, + } + /* Perform the overflow check. */ + tree errval = TYPE_MAX_VALUE (sizetype); +- if (cxx_dialect >= cxx11 && flag_exceptions) ++ /* ANDROID - temporarily disable __cxa_throw_bad_array_new_length ++ call. */ ++ if (cxx_dialect >= cxx11 && flag_exceptions && 0) + errval = throw_bad_array_new_length (); + if (outer_nelts_check != NULL_TREE) + size = fold_build3 (COND_EXPR, sizetype, outer_nelts_check, diff --git a/6.3/0022-libgomp-compile-on-android.patch b/6.3/0022-libgomp-compile-on-android.patch new file mode 100644 index 0000000..997e86d --- /dev/null +++ b/6.3/0022-libgomp-compile-on-android.patch @@ -0,0 +1,15 @@ +--- gcc-5.0/libgomp/env.c.omv~ 2015-01-04 13:11:58.289476031 +0100 ++++ gcc-5.0/libgomp/env.c 2015-01-04 19:19:17.272992338 +0100 +@@ -47,6 +47,12 @@ + #endif + #include <limits.h> + #include <errno.h> ++#ifdef __ANDROID__ ++#include <sys/sysconf.h> ++#ifndef PAGE_SIZE ++#define PAGE_SIZE sysconf(_SC_PAGE_SIZE) ++#endif ++#endif + + #ifndef HAVE_STRTOULL + # define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base) |