toolchain: gcc: add gcc 5.2.0
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 16 Aug 2015 20:20:36 +0000 (20:20 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 16 Aug 2015 20:20:36 +0000 (20:20 +0000)
This was boot tested on mipsel32, arm32 and x86 only.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
SVN-Revision: 46611

33 files changed:
toolchain/gcc/Config.in
toolchain/gcc/Config.version
toolchain/gcc/common.mk
toolchain/gcc/patches/5.2.0/002-case_insensitive.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/010-documentation.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/020-no-plt-backport.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/100-uclibc-conf.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/200-musl_config.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/201-musl_arm.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/202-musl_mips.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/203-musl_powerpc.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/204-musl_sh.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/205-musl_x86.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/206-musl_aarch64.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/207-musl_fixincludes.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/208-musl_gomp.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/209-musl_libstdc++.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/230-musl_libssp.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/800-arm_v5te_no_ldrd_strd.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/810-arm-softfloat-libgcc.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/820-libgcc_pic.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/830-arm_unbreak_armv4t.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/840-armv4_pass_fix-v4bx_to_ld.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/850-use_shared_libgcc.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/851-libgcc_no_compat.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/860-use_eh_frame.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/870-ppc_no_crtsavres.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/880-no_java_section.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/900-bad-mips16-crt.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/910-mbsd_multi.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/920-specs_nonfatal_getenv.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/930-fix-mips-noexecstack.patch [new file with mode: 0644]
toolchain/gcc/patches/5.2.0/940-no-clobber-stamp-bits.patch [new file with mode: 0644]

index 025ea2453d741e3eab4bc75d07d868b00b4bb5dc..f5de52db6f10891ed1dcf85c6a36156e51ee0417 100644 (file)
@@ -20,6 +20,11 @@ choice
                bool "gcc 4.9.x with Linaro enhancements"
                depends on BROKEN
 
+       config GCC_USE_VERSION_5
+               select GCC_VERSION_5
+               bool "gcc 5.x"
+               depends on BROKEN
+
 endchoice
 
 config GCC_USE_GRAPHITE
index 56de0d7bd46e2aa1e4ae7f0b74e59d6f3b3d28cf..c5cf232b929674db5681173280297c92c537c968 100644 (file)
@@ -12,6 +12,7 @@ config GCC_VERSION_4_9_LINARO
 config GCC_VERSION
        string
        default "4.6.3"     if GCC_VERSION_4_6_3
+       default "5.2.0"     if GCC_VERSION_5
        default "4.6-linaro"    if GCC_VERSION_4_6_LINARO
        default "4.8-linaro"    if GCC_VERSION_4_8_LINARO
        default "4.9-linaro"    if GCC_VERSION_4_9_LINARO
@@ -28,3 +29,6 @@ config GCC_VERSION_4_8
 config GCC_VERSION_4_9
        bool
        default y       if GCC_VERSION_4_9_LINARO
+
+config GCC_VERSION_5
+       bool
index d07f607c47ee28515cbfc4d8ee4208749df30bf0..bc5a732c3a2409c7ceb9c0f8dac9905e6d2ecd6f 100644 (file)
@@ -67,6 +67,9 @@ else
   ifeq ($(PKG_VERSION),4.8.0)
     PKG_MD5SUM:=e6040024eb9e761c3bea348d1fa5abb0
   endif
+  ifeq ($(PKG_VERSION),5.2.0)
+    PKG_MD5SUM:=a51bcfeb3da7dd4c623e27207ed43467
+  endif
 endif
 
 PATCH_DIR=../patches/$(GCC_VERSION)
diff --git a/toolchain/gcc/patches/5.2.0/002-case_insensitive.patch b/toolchain/gcc/patches/5.2.0/002-case_insensitive.patch
new file mode 100644 (file)
index 0000000..b3d2dbe
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/include/filenames.h
++++ b/include/filenames.h
+@@ -43,11 +43,6 @@ extern "C" {
+ #  define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
+ #  define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
+ #else /* not DOSish */
+-#  if defined(__APPLE__)
+-#    ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
+-#      define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
+-#    endif
+-#  endif /* __APPLE__ */
+ #  define HAS_DRIVE_SPEC(f) (0)
+ #  define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
+ #  define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
diff --git a/toolchain/gcc/patches/5.2.0/010-documentation.patch b/toolchain/gcc/patches/5.2.0/010-documentation.patch
new file mode 100644 (file)
index 0000000..07064a9
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -2941,18 +2941,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
+ doc/gccint.info: $(TEXI_GCCINT_FILES)
+ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
+-doc/%.info: %.texi
+-      if [ x$(BUILD_INFO) = xinfo ]; then \
+-              $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
+-                      -I $(gcc_docdir)/include -o $@ $<; \
+-      fi
++doc/%.info:
+ # Duplicate entry to handle renaming of gccinstall.info
+-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
+-      if [ x$(BUILD_INFO) = xinfo ]; then \
+-              $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
+-                      -I $(gcc_docdir)/include -o $@ $<; \
+-      fi
++doc/gccinstall.info:
+ doc/cpp.dvi: $(TEXI_CPP_FILES)
+ doc/gcc.dvi: $(TEXI_GCC_FILES)
diff --git a/toolchain/gcc/patches/5.2.0/020-no-plt-backport.patch b/toolchain/gcc/patches/5.2.0/020-no-plt-backport.patch
new file mode 100644 (file)
index 0000000..b9702c9
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/gcc/calls.c
++++ b/gcc/calls.c
+@@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ
+              && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
+             ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
+             : memory_address (FUNCTION_MODE, funexp));
++  else if (flag_pic && !flag_plt && fndecl_or_type
++         && TREE_CODE (fndecl_or_type) == FUNCTION_DECL
++         && !targetm.binds_local_p (fndecl_or_type))
++    {
++      funexp = force_reg (Pmode, funexp);
++    }
+   else if (! sibcallp)
+     {
+ #ifndef NO_FUNCTION_CSE
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -1779,6 +1779,10 @@ fpie
+ Common Report Var(flag_pie,1) Negative(fPIC)
+ Generate position-independent code for executables if possible (small mode)
++fplt
++Common Report Var(flag_plt) Init(1)
++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
++
+ fplugin=
+ Common Joined RejectNegative Var(common_deferred_options) Defer
+ Specify a plugin to load
diff --git a/toolchain/gcc/patches/5.2.0/100-uclibc-conf.patch b/toolchain/gcc/patches/5.2.0/100-uclibc-conf.patch
new file mode 100644 (file)
index 0000000..ff9ad94
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/contrib/regression/objs-gcc.sh
++++ b/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
+  then
+   make all-gdb all-dejagnu all-ld || exit 1
+   make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++  make all-gdb all-dejagnu all-ld || exit 1
++  make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+   make bootstrap || exit 1
+   make install || exit 1
+--- a/libjava/classpath/ltconfig
++++ b/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
+   ;;
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
diff --git a/toolchain/gcc/patches/5.2.0/200-musl_config.patch b/toolchain/gcc/patches/5.2.0/200-musl_config.patch
new file mode 100644 (file)
index 0000000..c6887a1
--- /dev/null
@@ -0,0 +1,199 @@
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -575,7 +575,7 @@ case ${target} in
+ esac
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ # 32-bit x86 processors supported by --with-arch=.  Each processor
+ # MUST be separated by exactly one space.
+@@ -720,6 +720,9 @@ case ${target} in
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
+@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()                     \
+@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)    \
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)        \
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -84,21 +89,92 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GNU_USER_DYNAMIC_LINKER                                               \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
+-                       BIONIC_DYNAMIC_LINKER)
++                       BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-                       BIONIC_DYNAMIC_LINKER32)
++                       BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-                       BIONIC_DYNAMIC_LINKER64)
++                       BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32                                    \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-                       BIONIC_DYNAMIC_LINKERX32)
++                       BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+ #define TARGET_HAS_BIONIC (OPTION_BIONIC)
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP                     \
++    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,             \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },         \
++    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,                \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },         \
++    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,    \
++      GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL                   \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },             \
++    { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX                  \
++    { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS                   \
++    { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL                    \
++    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE                  \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },      \
++    { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS                              \
++  {                                                   \
++    INCLUDE_DEFAULTS_MUSL_GPP                         \
++    INCLUDE_DEFAULTS_MUSL_PREFIX                      \
++    INCLUDE_DEFAULTS_MUSL_CROSS                               \
++    INCLUDE_DEFAULTS_MUSL_TOOL                                \
++    INCLUDE_DEFAULTS_MUSL_NATIVE                      \
++    { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },           \
++    { 0, 0, 0, 0, 0, 0 }                              \
++  }
++#endif
++
+ #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
+ /* This is a *uclinux* target.  We don't define below macros to normal linux
+    versions, because doing so would require *uclinux* targets to include
+--- a/gcc/config/linux.opt
++++ b/gcc/config/linux.opt
+@@ -30,3 +30,7 @@ Use GNU C library
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+--- a/gcc/ginclude/stddef.h
++++ b/gcc/ginclude/stddef.h
+@@ -184,6 +184,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__    /* BeOS */
+ #define __SIZE_T__    /* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -200,6 +201,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+   || defined(__DragonFly__) \
+   || defined(__FreeBSD_kernel__)
+@@ -218,6 +220,7 @@ typedef __SIZE_TYPE__ size_t;
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
diff --git a/toolchain/gcc/patches/5.2.0/201-musl_arm.patch b/toolchain/gcc/patches/5.2.0/201-musl_arm.patch
new file mode 100644 (file)
index 0000000..a0f7577
--- /dev/null
@@ -0,0 +1,56 @@
+From ec39b7c91facdd74fddea95128502c25ec3948a3 Mon Sep 17 00:00:00 2001
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 27 May 2015 13:17:11 +0000
+Subject: [PATCH 11/12] [PATCH 4/13] arm musl support
+
+On behalf of szabolcs.nagy@arm.com
+
+2015-05-27  Gregor Richards  <gregor.richards@uwaterloo.ca>
+
+       * config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/config/arm/linux-eabi.h | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -77,6 +77,23 @@
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
++/* For ARM musl currently supports four dynamic linkers:
++   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
++   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
++   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
++   musl does not support the legacy OABI mode.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, EL. */
++#undef  MUSL_DYNAMIC_LINKER
++#if TARGET_BIG_ENDIAN_DEFAULT
++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
++#else
++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
++#endif
++#define MUSL_DYNAMIC_LINKER \
++  "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+--- a/libitm/config/arm/hwcap.cc
++++ b/libitm/config/arm/hwcap.cc
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+ static void __attribute__((constructor))
diff --git a/toolchain/gcc/patches/5.2.0/202-musl_mips.patch b/toolchain/gcc/patches/5.2.0/202-musl_mips.patch
new file mode 100644 (file)
index 0000000..07d9c96
--- /dev/null
@@ -0,0 +1,34 @@
+From 8de85695e46ed2bc57c3482b4f995be3a82c405e Mon Sep 17 00:00:00 2001
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 8 May 2015 15:16:50 +0000
+Subject: [PATCH 09/12] [PATCH 6/13] mips musl support
+
+2015-05-08  Gregor Richards  <gregor.richards@uwaterloo.ca>
+           Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define.
+       (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define.
+       (GNU_USER_DYNAMIC_LINKERN32): Update.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/config/mips/linux.h | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/gcc/config/mips/linux.h
++++ b/gcc/config/mips/linux.h
+@@ -37,7 +37,13 @@ along with GCC; see the file COPYING3.
+ #define UCLIBC_DYNAMIC_LINKERN32 \
+   "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
++#undef MUSL_DYNAMIC_LINKER32
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
++#undef MUSL_DYNAMIC_LINKER64
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
++
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-                         BIONIC_DYNAMIC_LINKERN32)
++                         BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
diff --git a/toolchain/gcc/patches/5.2.0/203-musl_powerpc.patch b/toolchain/gcc/patches/5.2.0/203-musl_powerpc.patch
new file mode 100644 (file)
index 0000000..925acb3
--- /dev/null
@@ -0,0 +1,100 @@
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2410,6 +2410,10 @@ powerpc*-*-linux*)
+           powerpc*-*-linux*paired*)
+               tm_file="${tm_file} rs6000/750cl.h" ;;
+       esac
++        case ${target} in
++            *-linux*-musl*)
++                enable_secureplt=yes ;;
++        esac
+       if test x${enable_secureplt} = xyes; then
+               tm_file="rs6000/secureplt.h ${tm_file}"
+       fi
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -365,17 +365,21 @@ extern int dot_symbols;
+ #endif
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc%{msoft-float:-sf}.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #undef  DEFAULT_ASM_ENDIAN
+ #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+--- a/gcc/config/rs6000/secureplt.h
++++ b/gcc/config/rs6000/secureplt.h
+@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
+ <http://www.gnu.org/licenses/>.  */
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+--- a/gcc/config/rs6000/sysv4.h
++++ b/gcc/config/rs6000/sysv4.h
+@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
+ #define CC1_SECURE_PLT_DEFAULT_SPEC ""
+ #endif
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
+ /* Pass -G xxx to the compiler.  */
+ #undef CC1_SPEC
+@@ -586,7 +589,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ /* Override the default target of the linker.  */
+ #define       LINK_TARGET_SPEC \
+-  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
++  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
++  "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+ /* Any specific OS flags.  */
+ #define LINK_OS_SPEC "\
+@@ -764,15 +768,18 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc%{msoft-float:-sf}.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+@@ -895,6 +902,7 @@ ncrtn.o%s"
+   { "link_os_openbsd",                LINK_OS_OPENBSD_SPEC },                 \
+   { "link_os_default",                LINK_OS_DEFAULT_SPEC },                 \
+   { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC },          \
++  { "link_secure_plt_default",        LINK_SECURE_PLT_DEFAULT_SPEC },         \
+   { "cpp_os_ads",             CPP_OS_ADS_SPEC },                      \
+   { "cpp_os_yellowknife",     CPP_OS_YELLOWKNIFE_SPEC },              \
+   { "cpp_os_mvme",            CPP_OS_MVME_SPEC },                     \
diff --git a/toolchain/gcc/patches/5.2.0/204-musl_sh.patch b/toolchain/gcc/patches/5.2.0/204-musl_sh.patch
new file mode 100644 (file)
index 0000000..dfb5b51
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/gcc/config/sh/linux.h
++++ b/gcc/config/sh/linux.h
+@@ -43,7 +43,14 @@ along with GCC; see the file COPYING3.
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
++#define MUSL_DYNAMIC_LINKER_E "eb"
++#else
++#define MUSL_DYNAMIC_LINKER_E
++#endif
++
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
+ #undef SUBTARGET_LINK_EMUL_SUFFIX
+ #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
diff --git a/toolchain/gcc/patches/5.2.0/205-musl_x86.patch b/toolchain/gcc/patches/5.2.0/205-musl_x86.patch
new file mode 100644 (file)
index 0000000..a18bdcc
--- /dev/null
@@ -0,0 +1,72 @@
+From 606b5b76926d42d26c08c7400c38afe07e18e3cd Mon Sep 17 00:00:00 2001
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 15 May 2015 13:20:01 +0000
+Subject: [PATCH 10/12] [PATCH 9/13] x86 musl support
+
+On behalf of Szabolcs Nagy.
+
+2015-05-15  Gregor Richards  <gregor.richards@uwaterloo.ca>
+
+       * config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define.
+       * config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
+       (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/config/i386/linux.h   | 3 +++
+ gcc/config/i386/linux64.h | 7 +++++++
+ 2 files changed, 10 insertions(+)
+
+--- a/gcc/config/i386/linux.h
++++ b/gcc/config/i386/linux.h
+@@ -21,3 +21,6 @@ along with GCC; see the file COPYING3.
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+--- a/gcc/config/i386/linux64.h
++++ b/gcc/config/i386/linux64.h
+@@ -30,3 +30,10 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++
++#undef MUSL_DYNAMIC_LINKER32
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#undef MUSL_DYNAMIC_LINKER64
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
++#undef MUSL_DYNAMIC_LINKERX32
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+--- a/libitm/config/linux/x86/tls.h
++++ b/libitm/config/linux/x86/tls.h
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ #include "config/generic/tls.h"
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ #endif // LIBITM_X86_TLS_H
diff --git a/toolchain/gcc/patches/5.2.0/206-musl_aarch64.patch b/toolchain/gcc/patches/5.2.0/206-musl_aarch64.patch
new file mode 100644 (file)
index 0000000..c62ff51
--- /dev/null
@@ -0,0 +1,29 @@
+From 3640f7722df1c5e39d1d4980e3dd51fbda45912c Mon Sep 17 00:00:00 2001
+From: jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 27 May 2015 16:46:39 +0000
+Subject: [PATCH 12/12] [PATCH 3/13] aarch64 musl support
+
+gcc/Changelog:
+
+2015-05-27  Gregor Richards  <gregor.richards@uwaterloo.ca>
+           Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/config/aarch64/aarch64-linux.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/gcc/config/aarch64/aarch64-linux.h
++++ b/gcc/config/aarch64/aarch64-linux.h
+@@ -23,6 +23,9 @@
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
++#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}"
diff --git a/toolchain/gcc/patches/5.2.0/207-musl_fixincludes.patch b/toolchain/gcc/patches/5.2.0/207-musl_fixincludes.patch
new file mode 100644 (file)
index 0000000..e6fa47f
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/fixincludes/mkfixinc.sh
++++ b/fixincludes/mkfixinc.sh
+@@ -19,7 +19,8 @@ case $machine in
+     powerpc-*-eabi*    | \
+     powerpc-*-rtems*   | \
+     powerpcle-*-eabisim* | \
+-    powerpcle-*-eabi* )
++    powerpcle-*-eabi* | \
++    *-musl* )
+       #  IF there is no include fixing,
+       #  THEN create a no-op fixer and exit
+       (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
diff --git a/toolchain/gcc/patches/5.2.0/208-musl_gomp.patch b/toolchain/gcc/patches/5.2.0/208-musl_gomp.patch
new file mode 100644 (file)
index 0000000..b15403b
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libgomp/config/posix/time.c
++++ b/libgomp/config/posix/time.c
+@@ -29,6 +29,8 @@
+    The following implementation uses the most simple POSIX routines.
+    If present, POSIX 4 clocks should be used instead.  */
++#define _POSIX_C_SOURCE 199309L /* for clocks */
++
+ #include "libgomp.h"
+ #include <unistd.h>
+ #if TIME_WITH_SYS_TIME
diff --git a/toolchain/gcc/patches/5.2.0/209-musl_libstdc++.patch b/toolchain/gcc/patches/5.2.0/209-musl_libstdc++.patch
new file mode 100644 (file)
index 0000000..2c8f636
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/libstdc++-v3/configure.host
++++ b/libstdc++-v3/configure.host
+@@ -274,6 +274,13 @@ case "${host_os}" in
+     os_include_dir="os/bsd/freebsd"
+     ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++    # check for musl by target
++    case "${host_os}" in
++      *-musl*)
++        os_include_dir="os/generic"
++        ;;
++      *)
++
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"
+     elif [ "$bionic" = "yes" ]; then
+@@ -282,6 +289,9 @@ case "${host_os}" in
+       os_include_dir="os/gnu-linux"
+     fi
+     ;;
++
++    esac
++    ;;
+   hpux*)
+     os_include_dir="os/hpux"
+     ;;
diff --git a/toolchain/gcc/patches/5.2.0/230-musl_libssp.patch b/toolchain/gcc/patches/5.2.0/230-musl_libssp.patch
new file mode 100644 (file)
index 0000000..30f42e9
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -727,7 +727,9 @@ proper position among the other output f
+ #endif
+ #ifndef LINK_SSP_SPEC
+-#ifdef TARGET_LIBC_PROVIDES_SSP
++#if DEFAULT_LIBC == LIBC_MUSL
++#define LINK_SSP_SPEC "-lssp_nonshared"
++#elif defined(TARGET_LIBC_PROVIDES_SSP)
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+                      "|fstack-protector-strong|fstack-protector-explicit:}"
+ #else
diff --git a/toolchain/gcc/patches/5.2.0/800-arm_v5te_no_ldrd_strd.patch b/toolchain/gcc/patches/5.2.0/800-arm_v5te_no_ldrd_strd.patch
new file mode 100644 (file)
index 0000000..0edeb13
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/config/arm/arm.h
++++ b/gcc/config/arm/arm.h
+@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att
+ /* Thumb-1 only.  */
+ #define TARGET_THUMB1_ONLY            (TARGET_THUMB1 && !arm_arch_notm)
+-#define TARGET_LDRD                   (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
++#define TARGET_LDRD                   (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
+                                          && !TARGET_THUMB1)
+ #define TARGET_CRC32                  (arm_arch_crc)
diff --git a/toolchain/gcc/patches/5.2.0/810-arm-softfloat-libgcc.patch b/toolchain/gcc/patches/5.2.0/810-arm-softfloat-libgcc.patch
new file mode 100644 (file)
index 0000000..1d06f5b
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/libgcc/config/arm/t-linux
++++ b/libgcc/config/arm/t-linux
+@@ -1,6 +1,10 @@
+ LIB1ASMSRC = arm/lib1funcs.S
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
+-      _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
++      _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
++      _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
++      _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
++      _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
++      _arm_fixsfsi _arm_fixunssfsi
+ # Just for these, we omit the frame pointer since it makes such a big
+ # difference.
+--- a/gcc/config/arm/linux-elf.h
++++ b/gcc/config/arm/linux-elf.h
+@@ -60,8 +60,6 @@
+    %{shared:-lc} \
+    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
+-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
+-
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+ #define LINUX_TARGET_LINK_SPEC  "%{h*} \
diff --git a/toolchain/gcc/patches/5.2.0/820-libgcc_pic.patch b/toolchain/gcc/patches/5.2.0/820-libgcc_pic.patch
new file mode 100644 (file)
index 0000000..42bf0c8
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -887,11 +887,12 @@ $(libgcov-driver-objects): %$(objext): $
+ # Static libraries.
+ libgcc.a: $(libgcc-objects)
++libgcc_pic.a: $(libgcc-s-objects)
+ libgcov.a: $(libgcov-objects)
+ libunwind.a: $(libunwind-objects)
+ libgcc_eh.a: $(libgcc-eh-objects)
+-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
+       -rm -f $@
+       objects="$(objects)";                                   \
+@@ -913,7 +914,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
+ endif
+ ifeq ($(enable_shared),yes)
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
+ ifneq ($(LIBUNWIND),)
+ all: libunwind$(SHLIB_EXT)
+ endif
+@@ -1108,6 +1109,10 @@ install-shared:
+       chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+       $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++      $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
++      chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
++      $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
++
+       $(subst @multilib_dir@,$(MULTIDIR),$(subst \
+               @shlib_base_name@,libgcc_s,$(subst \
+               @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
diff --git a/toolchain/gcc/patches/5.2.0/830-arm_unbreak_armv4t.patch b/toolchain/gcc/patches/5.2.0/830-arm_unbreak_armv4t.patch
new file mode 100644 (file)
index 0000000..37f8f2a
--- /dev/null
@@ -0,0 +1,13 @@
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
+
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -45,7 +45,7 @@
+    The ARM10TDMI core is the default for armv5t, so set
+    SUBTARGET_CPU_DEFAULT to achieve this.  */
+ #undef  SUBTARGET_CPU_DEFAULT
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
+    config.gcc for big endian configurations.  */
diff --git a/toolchain/gcc/patches/5.2.0/840-armv4_pass_fix-v4bx_to_ld.patch b/toolchain/gcc/patches/5.2.0/840-armv4_pass_fix-v4bx_to_ld.patch
new file mode 100644 (file)
index 0000000..cb1fb98
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -94,10 +94,15 @@
+ #define MUSL_DYNAMIC_LINKER \
+   "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
++#undef TARGET_FIX_V4BX_SPEC
++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
++  "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+-#define LINK_SPEC EABI_LINK_SPEC                                      \
++#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC                 \
+   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,                                \
+                      LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
diff --git a/toolchain/gcc/patches/5.2.0/850-use_shared_libgcc.patch b/toolchain/gcc/patches/5.2.0/850-use_shared_libgcc.patch
new file mode 100644 (file)
index 0000000..d7ba962
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -131,10 +131,6 @@
+ #define ENDFILE_SPEC \
+   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
+-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
+-   do not use -lfloat.  */
+-#undef LIBGCC_SPEC
+-
+ /* Clear the instruction cache from `beg' to `end'.  This is
+    implemented in lib1funcs.S, so ensure an error if this definition
+    is used.  */
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
+@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
+       builtin_assert ("system=posix");                        \
+     } while (0)
++#ifndef LIBGCC_SPEC
++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
++#endif
++
+ /* Determine which dynamic linker to use depending on whether GLIBC or
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+--- a/libgcc/mkmap-symver.awk
++++ b/libgcc/mkmap-symver.awk
+@@ -132,5 +132,5 @@ function output(lib) {
+   else if (inherit[lib])
+     printf("} %s;\n", inherit[lib]);
+   else
+-    printf ("\n  local:\n\t*;\n};\n");
++    printf ("\n\t*;\n};\n");
+ }
+--- a/gcc/config/rs6000/linux.h
++++ b/gcc/config/rs6000/linux.h
+@@ -56,6 +56,9 @@
+ #undef        CPP_OS_DEFAULT_SPEC
+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
++#undef LIBGCC_SPEC
++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
++
+ #undef  LINK_SHLIB_SPEC
+ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
diff --git a/toolchain/gcc/patches/5.2.0/851-libgcc_no_compat.patch b/toolchain/gcc/patches/5.2.0/851-libgcc_no_compat.patch
new file mode 100644 (file)
index 0000000..80c3476
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/libgcc/config/t-libunwind
++++ b/libgcc/config/t-libunwind
+@@ -2,8 +2,7 @@
+ HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
+-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
+-  $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+ LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+ # Override the default value from t-slibgcc-elf-ver and mention -lunwind
diff --git a/toolchain/gcc/patches/5.2.0/860-use_eh_frame.patch b/toolchain/gcc/patches/5.2.0/860-use_eh_frame.patch
new file mode 100644 (file)
index 0000000..4586349
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/libgcc/unwind-dw2-fde-dip.c
++++ b/libgcc/unwind-dw2-fde-dip.c
+@@ -46,34 +46,13 @@
+ #include "unwind-compat.h"
+ #include "gthr.h"
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+-      || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(__BIONIC__)
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(TARGET_DL_ITERATE_PHDR) \
+-    && (defined(__DragonFly__) || defined(__FreeBSD__))
+-# define ElfW __ElfN
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(__OpenBSD__)
+-# define ElfW(type) Elf_##type
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && defined(TARGET_DL_ITERATE_PHDR) \
+-    && defined(__sun__) && defined(__svr4__)
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR)
+ # define USE_PT_GNU_EH_FRAME
++# ifdef __OpenBSD__
++#  define ElfW(type) Elf_##type
++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
++#  define ElfW __ElfN
++# endif
+ #endif
+ #if defined(USE_PT_GNU_EH_FRAME)
diff --git a/toolchain/gcc/patches/5.2.0/870-ppc_no_crtsavres.patch b/toolchain/gcc/patches/5.2.0/870-ppc_no_crtsavres.patch
new file mode 100644 (file)
index 0000000..b38b9d5
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/config/rs6000/rs6000.c
++++ b/gcc/config/rs6000/rs6000.c
+@@ -21453,7 +21453,7 @@ rs6000_savres_strategy (rs6000_stack_t *
+   /* Define cutoff for using out-of-line functions to save registers.  */
+   if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
+     {
+-      if (!optimize_size)
++      if (1)
+       {
+         strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
+         strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
diff --git a/toolchain/gcc/patches/5.2.0/880-no_java_section.patch b/toolchain/gcc/patches/5.2.0/880-no_java_section.patch
new file mode 100644 (file)
index 0000000..def6c9f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/defaults.h
++++ b/gcc/defaults.h
+@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
+ /* If we have named section and we support weak symbols, then use the
+    .jcr section for recording java classes which need to be registered
+    at program start-up time.  */
+-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+ #ifndef JCR_SECTION_NAME
+ #define JCR_SECTION_NAME ".jcr"
+ #endif
diff --git a/toolchain/gcc/patches/5.2.0/900-bad-mips16-crt.patch b/toolchain/gcc/patches/5.2.0/900-bad-mips16-crt.patch
new file mode 100644 (file)
index 0000000..dd6e9dc
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/libgcc/config/mips/t-mips16
++++ b/libgcc/config/mips/t-mips16
+@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
+ # Version these symbols if building libgcc.so.
+ SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
++
++CRTSTUFF_T_CFLAGS += -mno-mips16
++CRTSTUFF_T_CFLAGS_S += -mno-mips16
diff --git a/toolchain/gcc/patches/5.2.0/910-mbsd_multi.patch b/toolchain/gcc/patches/5.2.0/910-mbsd_multi.patch
new file mode 100644 (file)
index 0000000..68661d2
--- /dev/null
@@ -0,0 +1,222 @@
+
+       This patch brings over a few features from MirBSD:
+       * -fhonour-copts
+         If this option is not given, it's warned (depending
+         on environment variables). This is to catch errors
+         of misbuilt packages which override CFLAGS themselves.
+       * -Werror-maybe-reset
+         Has the effect of -Wno-error if GCC_NO_WERROR is
+         set and not '0', a no-operation otherwise. This is
+         to be able to use -Werror in "make" but prevent
+         GNU autoconf generated configure scripts from
+         freaking out.
+
+       This patch was authored by Thorsten Glaser <tg at mirbsd.de>
+       with copyright assignment to the FSF in effect.
+
+--- a/gcc/c-family/c-opts.c
++++ b/gcc/c-family/c-opts.c
+@@ -122,6 +122,9 @@ static int class_dump_flags;
+ /* Whether any standard preincluded header has been preincluded.  */
+ static bool done_preinclude;
++/* Check if a port honours COPTS.  */
++static int honour_copts = 0;
++
+ static void handle_OPT_d (const char *);
+ static void set_std_cxx98 (int);
+ static void set_std_cxx11 (int);
+@@ -449,6 +452,12 @@ c_common_handle_option (size_t scode, co
+       flag_no_builtin = !value;
+       break;
++    case OPT_fhonour_copts:
++      if (c_language == clk_c) {
++        honour_copts++;
++      }
++      break;
++
+     case OPT_fconstant_string_class_:
+       constant_string_class_name = arg;
+       break;
+@@ -1034,6 +1043,47 @@ c_common_init (void)
+       return false;
+     }
++  if (c_language == clk_c) {
++    char *ev = getenv ("GCC_HONOUR_COPTS");
++    int evv;
++    if (ev == NULL)
++      evv = -1;
++    else if ((*ev == '0') || (*ev == '\0'))
++      evv = 0;
++    else if (*ev == '1')
++      evv = 1;
++    else if (*ev == '2')
++      evv = 2;
++    else if (*ev == 's')
++      evv = -1;
++    else {
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
++    }
++    if (evv == 1) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in lenient mode");
++        return false;
++      } else if (honour_copts != 1) {
++        warning (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++      }
++    } else if (evv == 2) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in strict mode");
++        return false;
++      } else if (honour_copts != 1) {
++        error ("someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++        return false;
++      }
++    } else if (evv == 0) {
++      if (honour_copts != 1)
++        inform (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++    }
++  }
++
+   return true;
+ }
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -431,6 +431,10 @@ Wfloat-conversion
+ C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
+ Warn for implicit type conversions that cause loss of floating point precision
++Werror-maybe-reset
++C ObjC C++ ObjC++
++; Documented in common.opt
++
+ Wfloat-equal
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
+ Warn if testing floating point numbers for equality
+@@ -1161,6 +1165,9 @@ C++ ObjC++ Optimization Alias(fexception
+ fhonor-std
+ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
++fhonour-copts
++C ObjC C++ ObjC++ RejectNegative
++
+ fhosted
+ C ObjC
+ Assume normal C execution environment
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -561,6 +561,10 @@ Werror=
+ Common Joined
+ Treat specified warning as error
++Werror-maybe-reset
++Common
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
++
+ Wextra
+ Common Var(extra_warnings) Warning
+ Print extra (possibly unwanted) warnings
+@@ -1360,6 +1364,9 @@ fguess-branch-probability
+ Common Report Var(flag_guess_branch_prob) Optimization
+ Enable guessing of branch probabilities
++fhonour-copts
++Common RejectNegative
++
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
+ ; Generate position-independent code for executables if possible
+ ; On SVR4 targets, it also controls whether or not to emit a
+--- a/gcc/opts.c
++++ b/gcc/opts.c
+@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options
+                              opts, opts_set, loc, dc);
+       break;
++    case OPT_Werror_maybe_reset:
++      {
++        char *ev = getenv ("GCC_NO_WERROR");
++        if ((ev != NULL) && (*ev != '0'))
++          warnings_are_errors = 0;
++      }
++      break;
++
++    case OPT_fhonour_copts:
++      break;
++
+     case OPT_Wlarger_than_:
+       opts->x_larger_than_size = value;
+       opts->x_warn_larger_than = value != -1;
+--- a/gcc/doc/cppopts.texi
++++ b/gcc/doc/cppopts.texi
+@@ -163,6 +163,11 @@ in older programs.  This warning is on b
+ Make all warnings into hard errors.  Source code which triggers warnings
+ will be rejected.
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
+ @item -Wsystem-headers
+ @opindex Wsystem-headers
+ Issue warnings for code in system headers.  These are normally unhelpful
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Wdisabled-optimization @gol
+ -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
+ -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
+--Wno-endif-labels -Werror  -Werror=* @gol
++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
+ -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
+ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
+ -Wformat-security  -Wformat-signedness  -Wformat-y2k @gol
+@@ -5371,6 +5371,22 @@ This option is only supported for C and
+ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
+ @option{-Wno-pointer-sign}.
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
++ at item -fhonour-copts
++ at opindex fhonour-copts
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
++given at least once, and warn if it is given more than once.
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
++given exactly once.
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
++is not given exactly once.
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
++This flag and environment variable only affect the C language.
++
+ @item -Wstack-protector
+ @opindex Wstack-protector
+ @opindex Wno-stack-protector
+@@ -7844,7 +7860,7 @@ so, the first branch is redirected to ei
+ second branch or a point immediately following it, depending on whether
+ the condition is known to be true or false.
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
++Enabled at levels @option{-O3}.
+ @item -fsplit-wide-types
+ @opindex fsplit-wide-types
+--- a/gcc/java/jvspec.c
++++ b/gcc/java/jvspec.c
+@@ -629,6 +629,7 @@ lang_specific_pre_link (void)
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
+      is correct.  */ 
+   set_input (concat (main_class_name, "main.c", NULL));
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
+   err = do_spec (jvgenmain_spec);
+   if (err == 0)
+     {
diff --git a/toolchain/gcc/patches/5.2.0/920-specs_nonfatal_getenv.patch b/toolchain/gcc/patches/5.2.0/920-specs_nonfatal_getenv.patch
new file mode 100644 (file)
index 0000000..3d708f2
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -8807,8 +8807,10 @@ getenv_spec_function (int argc, const ch
+   value = getenv (argv[0]);
+   if (!value)
+-    fatal_error (input_location,
+-               "environment variable %qs not defined", argv[0]);
++    {
++      warning (input_location, "environment variable %qs not defined", argv[0]);
++      value = "";
++    }
+   /* We have to escape every character of the environment variable so
+      they are not interpreted as active spec characters.  A
diff --git a/toolchain/gcc/patches/5.2.0/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/5.2.0/930-fix-mips-noexecstack.patch
new file mode 100644 (file)
index 0000000..4bb126e
--- /dev/null
@@ -0,0 +1,111 @@
+From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
+From: Andrew McDonnell <bugs@andrewmcdonnell.net>
+Date: Fri, 3 Oct 2014 19:09:00 +0930
+Subject: Add .note.GNU-stack section
+
+See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
+Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
+
+Re: [Patch, MIPS] Add .note.GNU-stack section
+
+    From: Steve Ellcey <sellcey at mips dot com>
+
+On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
+>
+>
+> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
+
+>         This works except you did not update the assembly files in
+>         libgcc or glibc. We (Cavium) have the same patch in our tree
+>         for a few released versions.
+
+> Mind just checking yours in then Andrew?
+
+> Thanks!
+> -eric
+
+I talked to Andrew about what files he changed in GCC and created and
+tested this new patch.  Andrew also mentioned changing some assembly
+files in glibc but I don't see any use of '.section .note.GNU-stack' in
+any assembly files in glibc (for any platform) so I wasn't planning on
+creating a glibc to add them to mips glibc assembly language files.
+
+OK to check in this patch?
+
+Steve Ellcey
+sellcey@mips.com
+
+
+
+2014-09-26  Steve Ellcey  <sellcey@mips.com>
+---
+ gcc/config/mips/mips.c          | 3 +++
+ libgcc/config/mips/crti.S       | 4 ++++
+ libgcc/config/mips/crtn.S       | 3 +++
+ libgcc/config/mips/mips16.S     | 4 ++++
+ libgcc/config/mips/vr4120-div.S | 4 ++++
+ 5 files changed, 18 insertions(+)
+
+--- a/gcc/config/mips/mips.c
++++ b/gcc/config/mips/mips.c
+@@ -19621,6 +19621,9 @@ mips_lra_p (void)
+ #undef TARGET_LRA_P
+ #define TARGET_LRA_P mips_lra_p
++#undef TARGET_ASM_FILE_END
++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
++
+ struct gcc_target targetm = TARGET_INITIALIZER;
\f
+ #include "gt-mips.h"
+--- a/libgcc/config/mips/crti.S
++++ b/libgcc/config/mips/crti.S
+@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
+ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ <http://www.gnu.org/licenses/>.  */
++
++/* An executable stack is *not* required for these functions.  */
++      .section .note.GNU-stack,"",%progbits
++
+ /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
+    Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
+--- a/libgcc/config/mips/crtn.S
++++ b/libgcc/config/mips/crtn.S
+@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
+ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ <http://www.gnu.org/licenses/>.  */
++/* An executable stack is *not* required for these functions.  */
++      .section .note.GNU-stack,"",%progbits
++
+ /* 4 slots for argument spill area.  1 for cpreturn, 1 for stack.
+    Return spill offset of 40 and 20.  Aligned to 16 bytes for n32.  */
+--- a/libgcc/config/mips/mips16.S
++++ b/libgcc/config/mips/mips16.S
+@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI
+    values using the soft-float calling convention, but do the actual
+    operation using the hard floating point instructions.  */
++/* An executable stack is *not* required for these functions.  */
++      .section .note.GNU-stack,"",%progbits
++      .previous
++
+ #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
+ /* This file contains 32-bit assembly code.  */
+--- a/libgcc/config/mips/vr4120-div.S
++++ b/libgcc/config/mips/vr4120-div.S
+@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
+    -mfix-vr4120.  div and ddiv do not give the correct result when one
+    of the operands is negative.  */
++/* An executable stack is *not* required for these functions.  */
++      .section .note.GNU-stack,"",%progbits
++      .previous
++
+       .set    nomips16
+ #define DIV                                                           \
diff --git a/toolchain/gcc/patches/5.2.0/940-no-clobber-stamp-bits.patch b/toolchain/gcc/patches/5.2.0/940-no-clobber-stamp-bits.patch
new file mode 100644 (file)
index 0000000..bf2ab07
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/libstdc++-v3/include/Makefile.in
++++ b/libstdc++-v3/include/Makefile.in
+@@ -1382,7 +1382,7 @@ stamp-bits: ${bits_headers}
+       @$(STAMP) stamp-bits
+ stamp-bits-sup: stamp-bits ${bits_sup_headers}
+-      @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null
++      @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null
+       @$(STAMP) stamp-bits-sup
+ stamp-c_base: ${c_base_headers}