aboutsummaryrefslogtreecommitdiffstats
path: root/toolchain/gcc/patches/5.2.0/200-musl_config.patch
diff options
context:
space:
mode:
Diffstat (limited to 'toolchain/gcc/patches/5.2.0/200-musl_config.patch')
-rw-r--r--toolchain/gcc/patches/5.2.0/200-musl_config.patch176
1 files changed, 143 insertions, 33 deletions
diff --git a/toolchain/gcc/patches/5.2.0/200-musl_config.patch b/toolchain/gcc/patches/5.2.0/200-musl_config.patch
index c6887a1bff..a2b41b3726 100644
--- a/toolchain/gcc/patches/5.2.0/200-musl_config.patch
+++ b/toolchain/gcc/patches/5.2.0/200-musl_config.patch
@@ -1,3 +1,30 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 8 May 2015 08:25:47 +0000 (+0000)
+Subject: [PATCH 2/13] musl libc config
+X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb
+
+[PATCH 2/13] musl libc config
+
+2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
+ Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ * config.gcc (LIBC_MUSL): New tm_defines macro.
+ * config/linux.h (OPTION_MUSL): Define.
+ (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,)
+ (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,)
+ (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
+ (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
+ (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
+ * config/linux.opt (mmusl): New option.
+ * doc/invoke.texi (GNU/Linux Options): Document -mmusl.
+ * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*.
+ (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*.
+ * configure: Regenerate.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -575,7 +575,7 @@ case ${target} in
@@ -34,9 +61,15 @@
#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. */
+@@ -50,21 +52,25 @@ see the files COPYING3 and COPYING.RUNTI
+ } while (0)
+
+ /* 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. */
++ uClibc or Bionic or musl is the default C library and whether
++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
++ the default. */
-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
@@ -64,7 +97,15 @@
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -84,21 +89,92 @@ see the files COPYING3 and COPYING.RUNTI
+@@ -81,24 +87,100 @@ see the files COPYING3 and COPYING.RUNTI
+ #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
+ #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
+ #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
++/* Should be redefined for each target that supports musl. */
++#define MUSL_DYNAMIC_LINKER "/dev/null"
++#define MUSL_DYNAMIC_LINKER32 "/dev/null"
++#define MUSL_DYNAMIC_LINKER64 "/dev/null"
++#define MUSL_DYNAMIC_LINKERX32 "/dev/null"
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -163,37 +204,106 @@
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
+@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l
+ Use GNU C library
+
muclibc
- Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
Use uClibc C library
+
+mmusl
-+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
+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 */
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -27742,6 +27742,9 @@ if test "${gcc_cv_libc_provides_ssp+set}
+ else
+ gcc_cv_libc_provides_ssp=no
+ case "$target" in
++ *-*-musl*)
++ # All versions of musl provide stack protector
++ gcc_cv_libc_provides_ssp=yes;;
+ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+ # glibc 2.4 and later provides __stack_chk_fail and
+ # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -27774,6 +27777,7 @@ fi
+ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ # simply assert that glibc does provide this, which is true for all
+ # realistically usable GNU/Hurd configurations.
++ # All supported versions of musl provide it as well
+ gcc_cv_libc_provides_ssp=yes;;
+ *-*-darwin* | *-*-freebsd*)
+ ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
+@@ -27870,6 +27874,9 @@ case "$target" in
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
++ *-linux-musl*)
++ gcc_cv_target_dl_iterate_phdr=yes
++ ;;
+ esac
+
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5229,6 +5229,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
+ gcc_cv_libc_provides_ssp,
+ [gcc_cv_libc_provides_ssp=no
+ case "$target" in
++ *-*-musl*)
++ # All versions of musl provide stack protector
++ gcc_cv_libc_provides_ssp=yes;;
+ *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
+ # glibc 2.4 and later provides __stack_chk_fail and
+ # either __stack_chk_guard, or TLS access to stack guard canary.
+@@ -5255,6 +5258,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
+ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ # simply assert that glibc does provide this, which is true for all
+ # realistically usable GNU/Hurd configurations.
++ # All supported versions of musl provide it as well
+ gcc_cv_libc_provides_ssp=yes;;
+ *-*-darwin* | *-*-freebsd*)
+ AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
+@@ -5328,6 +5332,9 @@ case "$target" in
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
++ *-linux-musl*)
++ gcc_cv_target_dl_iterate_phdr=yes
++ ;;
+ esac
+ GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -667,7 +667,7 @@ Objective-C and Objective-C++ Dialects}.
+ -mcpu=@var{cpu}}
+
+ @emph{GNU/Linux Options}
+-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
++@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
+ -tno-android-cc -tno-android-ld}
+
+ @emph{H8/300 Options}
+@@ -15324,13 +15324,19 @@ These @samp{-m} options are defined for
+ @item -mglibc
+ @opindex mglibc
+ Use the GNU C library. This is the default except
+-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
++on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
++@samp{*-*-linux-*android*} targets.
+
+ @item -muclibc
+ @opindex muclibc
+ Use uClibc C library. This is the default on
+ @samp{*-*-linux-*uclibc*} targets.
+
++@item -mmusl
++@opindex mmusl
++Use the musl C library. This is the default on
++@samp{*-*-linux-*musl*} targets.
++
+ @item -mbionic
+ @opindex mbionic
+ Use Bionic C library. This is the default on