From 8044e4b5d3905d1a1ef890b297f8b168470d4956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= Date: Fri, 4 Dec 2015 19:29:34 +0100 Subject: Copy 5.2 patches to 5.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6fab516a7c5488c15288fa083feacb11a42e573e Signed-off-by: Bernhard Rosenkränzer --- ...ibility-of-libgcc-assembly-code-on-Androi.patch | 48 +++++ ...bol-visibility-on-libgcc-C-code-on-Androi.patch | 32 +++ 5.3/0003-Deal-with-setlocale-returning-NULL.patch | 135 ++++++++++++ ...Enable-armv7-thumb2-multilib-for-arm-eabi.patch | 61 ++++++ ...-linker-failure-when-using-64-bit-atomic-.patch | 34 +++ 5.3/0006-Support-Clang-in-C-11.patch | 30 +++ 5.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch | 30 +++ 5.3/0008-Fix-OpenMP-support-on-Android.patch | 12 ++ 5.3/0009-Disable-libstdc-versioning.patch | 44 ++++ 5.3/0010-Add-mclinker-support-fuse-ld-mcld.patch | 87 ++++++++ ...-visibility-for-the-__cxa-functions-in-eh.patch | 46 ++++ ...enMP-Better-CPU-count-detection-for-Linux.patch | 239 +++++++++++++++++++++ ...penmp-support-to-use-libgomp-config-linux.patch | 76 +++++++ 5.3/0014-GNU-libstdc-enable-linux-futex.patch | 65 ++++++ 5.3/0015-Add-fuse-ld-mcld.patch | 36 ++++ ...x-insufficient-alignment-for-NEON-vst-vld.patch | 37 ++++ 5.3/0017-Use-eh_frame_hdr-for-static-linking.patch | 237 ++++++++++++++++++++ 5.3/0018-use-android-specs-on-aarch64.patch | 69 ++++++ 5.3/0020-config-defaults.patch | 54 +++++ ...-disable-__cxa_throw_bad_array_new_length.patch | 39 ++++ 5.3/0022-isl-0.14.patch | 75 +++++++ 5.3/0023-libgomp-compile-on-android.patch | 13 ++ 5.3/0024-libgfortran-android.patch | 147 +++++++++++++ 23 files changed, 1646 insertions(+) create mode 100644 5.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch create mode 100644 5.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch create mode 100644 5.3/0003-Deal-with-setlocale-returning-NULL.patch create mode 100644 5.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch create mode 100644 5.3/0005-Fix-ARM-GCC-linker-failure-when-using-64-bit-atomic-.patch create mode 100644 5.3/0006-Support-Clang-in-C-11.patch create mode 100644 5.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch create mode 100644 5.3/0008-Fix-OpenMP-support-on-Android.patch create mode 100644 5.3/0009-Disable-libstdc-versioning.patch create mode 100644 5.3/0010-Add-mclinker-support-fuse-ld-mcld.patch create mode 100644 5.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch create mode 100644 5.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch create mode 100644 5.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch create mode 100644 5.3/0014-GNU-libstdc-enable-linux-futex.patch create mode 100644 5.3/0015-Add-fuse-ld-mcld.patch create mode 100644 5.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch create mode 100644 5.3/0017-Use-eh_frame_hdr-for-static-linking.patch create mode 100644 5.3/0018-use-android-specs-on-aarch64.patch create mode 100644 5.3/0020-config-defaults.patch create mode 100644 5.3/0021-disable-__cxa_throw_bad_array_new_length.patch create mode 100644 5.3/0022-isl-0.14.patch create mode 100644 5.3/0023-libgomp-compile-on-android.patch create mode 100644 5.3/0024-libgfortran-android.patch diff --git a/5.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch b/5.3/0001-Restore-visibility-of-libgcc-assembly-code-on-Androi.patch new file mode 100644 index 0000000..a045aa0 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch b/5.3/0002-Resotre-symbol-visibility-on-libgcc-C-code-on-Androi.patch new file mode 100644 index 0000000..2523425 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0003-Deal-with-setlocale-returning-NULL.patch b/5.3/0003-Deal-with-setlocale-returning-NULL.patch new file mode 100644 index 0000000..d5f2403 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch b/5.3/0004-Enable-armv7-thumb2-multilib-for-arm-eabi.patch new file mode 100644 index 0000000..b332250 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0005-Fix-ARM-GCC-linker-failure-when-using-64-bit-atomic-.patch b/5.3/0005-Fix-ARM-GCC-linker-failure-when-using-64-bit-atomic-.patch new file mode 100644 index 0000000..1f9f281 --- /dev/null +++ b/5.3/0005-Fix-ARM-GCC-linker-failure-when-using-64-bit-atomic-.patch @@ -0,0 +1,34 @@ +From 95eedd2f3e1ca0efb50e3a072528262f2c09c344 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + +Date: Mon, 6 Jan 2014 00:00:54 +0100 +Subject: [PATCH 05/17] Fix ARM GCC linker failure when using 64-bit atomic + built-ins +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Bernhard Rosenkränzer +--- + libgcc/config/arm/linux-atomic-64bit.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libgcc/config/arm/linux-atomic-64bit.c b/libgcc/config/arm/linux-atomic-64bit.c +index 5b8c6e2..5c1f970 100644 +--- a/libgcc/config/arm/linux-atomic-64bit.c ++++ b/libgcc/config/arm/linux-atomic-64bit.c +@@ -56,7 +56,11 @@ static void __check_for_sync8_kernelhelper (void) + for the user - I'm not sure I can rely on much else being + available at this point, so do the same as generic-morestack.c + write () and abort (). */ ++#if !defined(__ANDROID__) + __write (2 /* stderr. */, err, sizeof (err)); ++#else ++ write (2 /* stderr. */, err, sizeof (err)); ++#endif + abort (); + } + }; +-- +1.8.4.5 + diff --git a/5.3/0006-Support-Clang-in-C-11.patch b/5.3/0006-Support-Clang-in-C-11.patch new file mode 100644 index 0000000..48f22f3 --- /dev/null +++ b/5.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?= + +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 +--- + 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(0))>::type type; + }; + + struct __do_member_type_wrapper +-- +1.8.4.5 + diff --git a/5.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch b/5.3/0007-Enable-_GLIBCXX_HAS_THREADS.patch new file mode 100644 index 0000000..abb8bc2 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0008-Fix-OpenMP-support-on-Android.patch b/5.3/0008-Fix-OpenMP-support-on-Android.patch new file mode 100644 index 0000000..9c366d8 --- /dev/null +++ b/5.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/5.3/0009-Disable-libstdc-versioning.patch b/5.3/0009-Disable-libstdc-versioning.patch new file mode 100644 index 0000000..645b654 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0010-Add-mclinker-support-fuse-ld-mcld.patch b/5.3/0010-Add-mclinker-support-fuse-ld-mcld.patch new file mode 100644 index 0000000..fec0664 --- /dev/null +++ b/5.3/0010-Add-mclinker-support-fuse-ld-mcld.patch @@ -0,0 +1,87 @@ +From 9c80ba5af1b6c8b5353e06a215466c9cbe70026d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= + +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 +--- + 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/gcc/gcc.c b/gcc/gcc.c +index 35d1fe6..d379549 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -534,7 +534,7 @@ proper position among the other output files. */ + shared library ordering, and we keep the wrapper function in + libgcc. This is not yet a real spec, though it could become one; + it is currently just stuffed into LINK_SPEC. FIXME: This wrapping +- only works with GNU ld and gold. */ ++ only works with GNU ld, gold and mcld. */ + #define STACK_SPLIT_SPEC " %{fsplit-stack: --wrap=pthread_create}" + + #ifndef LIBASAN_SPEC +-- +1.8.4.5 + diff --git a/5.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch b/5.3/0011-Use-default-visibility-for-the-__cxa-functions-in-eh.patch new file mode 100644 index 0000000..996c6df --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch b/5.3/0012-OpenMP-Better-CPU-count-detection-for-Linux.patch new file mode 100644 index 0000000..dca72d6 --- /dev/null +++ b/5.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?= + +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 +--- + 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 +-#include + #include ++#include ++#include ++#include ++#include + #ifdef HAVE_GETLOADAVG + # ifdef HAVE_SYS_LOADAVG_H + # include +@@ -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/5.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch b/5.3/0013-Fix-openmp-support-to-use-libgomp-config-linux.patch new file mode 100644 index 0000000..7887035 --- /dev/null +++ b/5.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 + 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 + 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/5.3/0014-GNU-libstdc-enable-linux-futex.patch b/5.3/0014-GNU-libstdc-enable-linux-futex.patch new file mode 100644 index 0000000..5aa37a6 --- /dev/null +++ b/5.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?= + +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 +--- + 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 + 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 + 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 ++#if defined(__ANDROID__) ++# include ++# define SYS_futex __NR_futex ++#else + # include ++#endif + # include + # define _GLIBCXX_USE_FUTEX + # define _GLIBCXX_FUTEX_WAIT 0 +-- +1.8.4.5 + diff --git a/5.3/0015-Add-fuse-ld-mcld.patch b/5.3/0015-Add-fuse-ld-mcld.patch new file mode 100644 index 0000000..729b4b6 --- /dev/null +++ b/5.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?= + +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 +--- + 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 +@@ -2254,9 +2254,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/5.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch b/5.3/0016-Fix-insufficient-alignment-for-NEON-vst-vld.patch new file mode 100644 index 0000000..0664e88 --- /dev/null +++ b/5.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?= + +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 +--- + 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/5.3/0017-Use-eh_frame_hdr-for-static-linking.patch b/5.3/0017-Use-eh_frame_hdr-for-static-linking.patch new file mode 100644 index 0000000..1720e59 --- /dev/null +++ b/5.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 + with_long_double_128 + with_gc +@@ -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-maintainer-mode +@@ -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 + # 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 + # 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 + /* 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/5.3/0018-use-android-specs-on-aarch64.patch b/5.3/0018-use-android-specs-on-aarch64.patch new file mode 100644 index 0000000..96ba84a --- /dev/null +++ b/5.3/0018-use-android-specs-on-aarch64.patch @@ -0,0 +1,69 @@ +--- 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,30 @@ + #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 + #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 +64,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 +80,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/5.3/0020-config-defaults.patch b/5.3/0020-config-defaults.patch new file mode 100644 index 0000000..0989df9 --- /dev/null +++ b/5.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/5.3/0021-disable-__cxa_throw_bad_array_new_length.patch b/5.3/0021-disable-__cxa_throw_bad_array_new_length.patch new file mode 100644 index 0000000..520596e --- /dev/null +++ b/5.3/0021-disable-__cxa_throw_bad_array_new_length.patch @@ -0,0 +1,39 @@ +commit 0e9bdbff3ee62cb299d50584bca725b1d22b80cf +Author: Ben Cheng +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 **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 **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/5.3/0022-isl-0.14.patch b/5.3/0022-isl-0.14.patch new file mode 100644 index 0000000..685d6a6 --- /dev/null +++ b/5.3/0022-isl-0.14.patch @@ -0,0 +1,75 @@ +--- gcc-5.0/gcc/graphite-interchange.c.omv~ 2015-01-04 01:27:45.630147199 +0100 ++++ gcc-5.0/gcc/graphite-interchange.c 2015-01-04 01:28:08.640319385 +0100 +@@ -32,11 +32,11 @@ along with GCC; see the file COPYING3. + #include + + /* Since ISL-0.13, the extern is in val_gmp.h. */ +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + extern "C" { + #endif + #include +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + } + #endif + #endif +--- gcc-5.0/gcc/graphite-isl-ast-to-gimple.c.omv~ 2015-01-04 01:27:09.036539971 +0100 ++++ gcc-5.0/gcc/graphite-isl-ast-to-gimple.c 2015-01-04 01:27:24.336654498 +0100 +@@ -27,11 +27,11 @@ along with GCC; see the file COPYING3. + #include + + /* Since ISL-0.13, the extern is in val_gmp.h. */ +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + extern "C" { + #endif + #include +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + } + #endif + #endif +--- gcc-5.0/gcc/graphite-optimize-isl.c.omv~ 2015-01-04 01:28:37.220533213 +0100 ++++ gcc-5.0/gcc/graphite-optimize-isl.c 2015-01-04 01:29:08.980770781 +0100 +@@ -460,7 +460,7 @@ getScheduleForBandList (isl_band_list *B + if (flag_loop_unroll_jam && (i != (ScheduleDimensions - depth))) + continue; + +-#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE ++#if 1 || defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) + if (isl_band_member_is_coincident (Band, i)) + #else + if (isl_band_member_is_zero_distance (Band, i)) +--- gcc-5.0/gcc/graphite-poly.c.omv~ 2015-01-04 01:29:27.760911230 +0100 ++++ gcc-5.0/gcc/graphite-poly.c 2015-01-04 01:29:38.414324228 +0100 +@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. + #include + + /* Since ISL-0.13, the extern is in val_gmp.h. */ +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + extern "C" { + #endif + #include +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + } + #endif + #endif +--- gcc-5.0/gcc/graphite-sese-to-poly.c.omv~ 2015-01-04 01:29:55.821121042 +0100 ++++ gcc-5.0/gcc/graphite-sese-to-poly.c 2015-01-04 01:30:06.581194740 +0100 +@@ -29,11 +29,11 @@ along with GCC; see the file COPYING3. + #include + + /* Since ISL-0.13, the extern is in val_gmp.h. */ +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + extern "C" { + #endif + #include +-#if !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) ++#if 0 && !defined(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE) && defined(__cplusplus) + } + #endif + #endif diff --git a/5.3/0023-libgomp-compile-on-android.patch b/5.3/0023-libgomp-compile-on-android.patch new file mode 100644 index 0000000..7acf26b --- /dev/null +++ b/5.3/0023-libgomp-compile-on-android.patch @@ -0,0 +1,13 @@ +--- 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,10 @@ + #endif + #include + #include ++#if defined(__ANDROID__) && !defined(PAGE_SIZE) ++#include ++#define PAGE_SIZE sysconf(_SC_PAGE_SIZE) ++#endif + + #ifndef HAVE_STRTOULL + # define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base) diff --git a/5.3/0024-libgfortran-android.patch b/5.3/0024-libgfortran-android.patch new file mode 100644 index 0000000..77af71c --- /dev/null +++ b/5.3/0024-libgfortran-android.patch @@ -0,0 +1,147 @@ +--- gcc-4.9/libgfortran/intrinsics/cshift0.c.bero~ 2015-10-23 20:53:23.380584912 +0100 ++++ gcc-4.9/libgfortran/intrinsics/cshift0.c 2015-10-23 20:55:14.731568711 +0100 +@@ -146,7 +146,7 @@ cshift0 (gfc_array_char * ret, const gfc + return; + # endif + +-# ifdef HAVE_GFC_REAL_16 ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + cshift0_r16 ((gfc_array_r16 *)ret, (gfc_array_r16 *) array, shift, + which); +@@ -176,7 +176,7 @@ cshift0 (gfc_array_char * ret, const gfc + return; + # endif + +-# ifdef HAVE_GFC_COMPLEX_16 ++# if 0 // defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + cshift0_c16 ((gfc_array_c16 *)ret, (gfc_array_c16 *) array, shift, + which); +--- gcc-4.9/libgfortran/intrinsics/pack_generic.c.bero~ 2015-10-23 20:55:35.680130206 +0100 ++++ gcc-4.9/libgfortran/intrinsics/pack_generic.c 2015-10-23 20:56:08.821018386 +0100 +@@ -158,7 +158,7 @@ pack_internal (gfc_array_char *ret, cons + if (total == 0) + return; /* In this case, nothing remains to be done. */ + } +- else ++ else + { + /* We come here because of range checking. */ + index_type ret_extent; +@@ -312,7 +312,7 @@ pack (gfc_array_char *ret, const gfc_arr + return; + # endif + +-# ifdef HAVE_GFC_REAL_16 ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array, + (gfc_array_l1 *) mask, (gfc_array_r16 *) vector); +@@ -344,7 +344,7 @@ pack (gfc_array_char *ret, const gfc_arr + return; + # endif + +-# ifdef HAVE_GFC_COMPLEX_16 ++# if 0 && defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array, + (gfc_array_l1 *) mask, (gfc_array_c16 *) vector); +--- gcc-4.9/libgfortran/intrinsics/spread_generic.c.bero~ 2015-10-23 20:56:24.381435581 +0100 ++++ gcc-4.9/libgfortran/intrinsics/spread_generic.c 2015-10-23 20:56:56.470295900 +0100 +@@ -529,7 +529,7 @@ spread_scalar (gfc_array_char *ret, cons + return; + # endif + +-# ifdef HAVE_GFC_REAL_16 ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + spread_scalar_r16 ((gfc_array_r16 *) ret, (GFC_REAL_16 *) source, + *along, *pncopies); +@@ -561,7 +561,7 @@ spread_scalar (gfc_array_char *ret, cons + return; + # endif + +-# ifdef HAVE_GFC_COMPLEX_16 ++# if 0 && defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + spread_scalar_c16 ((gfc_array_c16 *) ret, (GFC_COMPLEX_16 *) source, + *along, *pncopies); +--- gcc-4.9/libgfortran/intrinsics/unpack_generic.c.bero~ 2015-10-23 20:57:17.998873106 +0100 ++++ gcc-4.9/libgfortran/intrinsics/unpack_generic.c 2015-10-23 20:58:23.392626657 +0100 +@@ -278,7 +278,7 @@ unpack1 (gfc_array_char *ret, const gfc_ + return; + # endif + +-# ifdef HAVE_GFC_REAL_16 ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + unpack1_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (gfc_array_r16 *) field); +@@ -310,7 +310,7 @@ unpack1 (gfc_array_char *ret, const gfc_ + return; + # endif + +-# ifdef HAVE_GFC_COMPLEX_16 ++# if 0 && defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (gfc_array_c16 *) field); +@@ -489,7 +489,7 @@ unpack0 (gfc_array_char *ret, const gfc_ + return; + # endif + +-# ifdef HAVE_GFC_REAL_16 ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + unpack0_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (GFC_REAL_16 *) field); +@@ -521,7 +521,7 @@ unpack0 (gfc_array_char *ret, const gfc_ + return; + # endif + +-# ifdef HAVE_GFC_COMPLEX_16 ++# if 0 && defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (GFC_COMPLEX_16 *) field); +--- gcc-4.9/libgfortran/runtime/in_pack_generic.c.bero~ 2015-10-23 20:58:40.465084837 +0100 ++++ gcc-4.9/libgfortran/runtime/in_pack_generic.c 2015-10-23 20:59:02.641679335 +0100 +@@ -95,7 +95,7 @@ internal_pack (gfc_array_char * source) + return internal_pack_r10 ((gfc_array_r10 *) source); + # endif + +-# if defined (HAVE_GFC_REAL_16) ++# if 0 && defined (HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + return internal_pack_r16 ((gfc_array_r16 *) source); + # endif +@@ -119,7 +119,7 @@ internal_pack (gfc_array_char * source) + return internal_pack_c10 ((gfc_array_c10 *) source); + # endif + +-# if defined (HAVE_GFC_COMPLEX_16) ++# if 0 && defined (HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + return internal_pack_c16 ((gfc_array_c16 *) source); + # endif +--- gcc-4.9/libgfortran/runtime/in_unpack_generic.c.bero~ 2015-10-23 20:59:19.338127111 +0100 ++++ gcc-4.9/libgfortran/runtime/in_unpack_generic.c 2015-10-23 20:59:35.802568787 +0100 +@@ -103,7 +103,7 @@ internal_unpack (gfc_array_char * d, con + return; + # endif + +-# if defined(HAVE_GFC_REAL_16) ++# if 0 && defined(HAVE_GFC_REAL_16) + case GFC_DTYPE_REAL_16: + internal_unpack_r16 ((gfc_array_r16 *) d, (const GFC_REAL_16 *) s); + return; +@@ -131,7 +131,7 @@ internal_unpack (gfc_array_char * d, con + return; + # endif + +-# if defined(HAVE_GFC_COMPLEX_16) ++# if 0 && defined(HAVE_GFC_COMPLEX_16) + case GFC_DTYPE_COMPLEX_16: + internal_unpack_c16 ((gfc_array_c16 *) d, (const GFC_COMPLEX_16 *) s); + return; -- cgit v1.2.3