|
@@ -1,15 +1,25 @@
|
|
|
-# HG changeset patch
|
|
|
-# Parent e5b4564f249f8634194bdabef4b3057d0e54ee97
|
|
|
-Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
|
|
|
+From 0b54799d80fb859c7b142467e4d42c99db59df50 Mon Sep 17 00:00:00 2001
|
|
|
+From: Khem Raj <raj.khem@gmail.com>
|
|
|
+Date: Tue, 8 Dec 2015 08:30:35 +0000
|
|
|
+Subject: [PATCH 44/46] Adding -mmusl as a musl libc specifier, and the
|
|
|
+ necessary hacks for it to know how to find musl's dynamic linker.
|
|
|
|
|
|
Upstream-Status: Backport [partial]
|
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
|
+---
|
|
|
+ gcc/config.gcc | 10 ++++-
|
|
|
+ gcc/config/linux.h | 100 +++++++++++++++++++++++++++++++++++++-----
|
|
|
+ gcc/config/linux.opt | 4 ++
|
|
|
+ gcc/config/rs6000/secureplt.h | 1 +
|
|
|
+ gcc/config/rs6000/sysv4.h | 5 +++
|
|
|
+ gcc/ginclude/stddef.h | 3 ++
|
|
|
+ 6 files changed, 110 insertions(+), 13 deletions(-)
|
|
|
|
|
|
-Index: gcc-4.9.0/gcc/config.gcc
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/config.gcc 2014-04-22 22:44:17.153567150 -0700
|
|
|
-+++ gcc-4.9.0/gcc/config.gcc 2014-04-23 23:54:31.427357051 -0700
|
|
|
-@@ -594,7 +594,7 @@
|
|
|
+diff --git a/gcc/config.gcc b/gcc/config.gcc
|
|
|
+index 3825bd5..39ce047 100644
|
|
|
+--- a/gcc/config.gcc
|
|
|
++++ b/gcc/config.gcc
|
|
|
+@@ -575,7 +575,7 @@ case ${target} in
|
|
|
esac
|
|
|
|
|
|
# Common C libraries.
|
|
@@ -18,7 +28,7 @@ Index: gcc-4.9.0/gcc/config.gcc
|
|
|
|
|
|
# 32-bit x86 processors supported by --with-arch=. Each processor
|
|
|
# MUST be separated by exactly one space.
|
|
|
-@@ -719,6 +719,9 @@
|
|
|
+@@ -720,6 +720,9 @@ case ${target} in
|
|
|
*-*-*uclibc*)
|
|
|
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
|
|
|
;;
|
|
@@ -28,7 +38,7 @@ Index: gcc-4.9.0/gcc/config.gcc
|
|
|
*)
|
|
|
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
|
|
|
;;
|
|
|
-@@ -2328,6 +2331,11 @@
|
|
|
+@@ -2420,6 +2423,11 @@ powerpc*-*-linux*)
|
|
|
powerpc*-*-linux*paired*)
|
|
|
tm_file="${tm_file} rs6000/750cl.h" ;;
|
|
|
esac
|
|
@@ -40,11 +50,11 @@ Index: gcc-4.9.0/gcc/config.gcc
|
|
|
if test x${enable_secureplt} = xyes; then
|
|
|
tm_file="rs6000/secureplt.h ${tm_file}"
|
|
|
fi
|
|
|
-Index: gcc-4.9.0/gcc/config/linux.h
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/config/linux.h 2014-01-02 14:23:26.000000000 -0800
|
|
|
-+++ gcc-4.9.0/gcc/config/linux.h 2014-04-24 00:11:29.034028895 -0700
|
|
|
-@@ -32,10 +32,12 @@
|
|
|
+diff --git a/gcc/config/linux.h b/gcc/config/linux.h
|
|
|
+index 22b9be5..ca9a17f 100644
|
|
|
+--- a/gcc/config/linux.h
|
|
|
++++ b/gcc/config/linux.h
|
|
|
+@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
|
|
|
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
|
|
|
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
|
|
@@ -57,7 +67,7 @@ Index: gcc-4.9.0/gcc/config/linux.h
|
|
|
#endif
|
|
|
|
|
|
#define GNU_USER_TARGET_OS_CPP_BUILTINS() \
|
|
|
-@@ -53,18 +55,21 @@
|
|
|
+@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
uClibc or Bionic is the default C library and whether
|
|
|
-muclibc or -mglibc or -mbionic has been passed to change the default. */
|
|
|
|
|
@@ -87,7 +97,7 @@ Index: gcc-4.9.0/gcc/config/linux.h
|
|
|
#else
|
|
|
#error "Unsupported DEFAULT_LIBC"
|
|
|
#endif /* DEFAULT_LIBC */
|
|
|
-@@ -84,16 +89,16 @@
|
|
|
+@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
|
|
#define GNU_USER_DYNAMIC_LINKER \
|
|
|
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
|
|
@@ -108,7 +118,7 @@ Index: gcc-4.9.0/gcc/config/linux.h
|
|
|
|
|
|
/* Whether we have Bionic libc runtime */
|
|
|
#undef TARGET_HAS_BIONIC
|
|
|
-@@ -127,3 +132,74 @@
|
|
|
+@@ -123,3 +128,74 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
# define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
|
|
|
|
|
|
#endif
|
|
@@ -183,11 +193,11 @@ Index: gcc-4.9.0/gcc/config/linux.h
|
|
|
+ { 0, 0, 0, 0, 0, 0 } \
|
|
|
+ }
|
|
|
+#endif
|
|
|
-Index: gcc-4.9.0/gcc/config/linux.opt
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/config/linux.opt 2014-01-02 14:23:26.000000000 -0800
|
|
|
-+++ gcc-4.9.0/gcc/config/linux.opt 2014-04-22 22:44:17.280233817 -0700
|
|
|
-@@ -30,3 +30,7 @@
|
|
|
+diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
|
|
|
+index c054338..9334f74 100644
|
|
|
+--- 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
|
|
@@ -195,48 +205,20 @@ Index: gcc-4.9.0/gcc/config/linux.opt
|
|
|
+mmusl
|
|
|
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
|
|
|
+Use musl C library
|
|
|
-Index: gcc-4.9.0/gcc/ginclude/stddef.h
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/ginclude/stddef.h 2014-01-02 14:23:26.000000000 -0800
|
|
|
-+++ gcc-4.9.0/gcc/ginclude/stddef.h 2014-04-22 22:44:17.280233817 -0700
|
|
|
-@@ -181,6 +181,7 @@
|
|
|
- #ifndef _GCC_SIZE_T
|
|
|
- #ifndef _SIZET_
|
|
|
- #ifndef __size_t
|
|
|
-+#ifndef __DEFINED_size_t /* musl */
|
|
|
- #define __size_t__ /* BeOS */
|
|
|
- #define __SIZE_T__ /* Cray Unicos/Mk */
|
|
|
- #define _SIZE_T
|
|
|
-@@ -197,6 +198,7 @@
|
|
|
- #define ___int_size_t_h
|
|
|
- #define _GCC_SIZE_T
|
|
|
- #define _SIZET_
|
|
|
-+#define __DEFINED_size_t /* musl */
|
|
|
- #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
|
|
|
- || defined(__FreeBSD_kernel__)
|
|
|
- /* __size_t is a typedef on FreeBSD 5, must not trash it. */
|
|
|
-@@ -214,6 +216,7 @@
|
|
|
- typedef long ssize_t;
|
|
|
- #endif /* __BEOS__ */
|
|
|
- #endif /* !(defined (__GNUG__) && defined (size_t)) */
|
|
|
-+#endif /* __DEFINED_size_t */
|
|
|
- #endif /* __size_t */
|
|
|
- #endif /* _SIZET_ */
|
|
|
- #endif /* _GCC_SIZE_T */
|
|
|
-Index: gcc-4.9.0/gcc/config/rs6000/secureplt.h
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/config/rs6000/secureplt.h 2014-01-02 14:23:26.000000000 -0800
|
|
|
-+++ gcc-4.9.0/gcc/config/rs6000/secureplt.h 2014-04-23 23:55:15.114024175 -0700
|
|
|
-@@ -18,3 +18,4 @@
|
|
|
+diff --git a/gcc/config/rs6000/secureplt.h b/gcc/config/rs6000/secureplt.h
|
|
|
+index b463463..77edf2a 100644
|
|
|
+--- a/gcc/config/rs6000/secureplt.h
|
|
|
++++ b/gcc/config/rs6000/secureplt.h
|
|
|
+@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3. If not see
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
#define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
|
|
|
+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
|
|
|
-Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
|
|
|
-===================================================================
|
|
|
---- gcc-4.9.0.orig/gcc/config/rs6000/sysv4.h 2014-04-23 23:52:13.854023015 -0700
|
|
|
-+++ gcc-4.9.0/gcc/config/rs6000/sysv4.h 2014-04-24 00:10:55.550695334 -0700
|
|
|
-@@ -538,6 +538,10 @@
|
|
|
+diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
|
|
|
+index c6c31dc..7cd07e0 100644
|
|
|
+--- a/gcc/config/rs6000/sysv4.h
|
|
|
++++ b/gcc/config/rs6000/sysv4.h
|
|
|
+@@ -538,6 +538,10 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
|
|
|
#define CC1_SECURE_PLT_DEFAULT_SPEC ""
|
|
|
#endif
|
|
|
|
|
@@ -245,19 +227,9 @@ Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
|
|
|
+#endif
|
|
|
+
|
|
|
/* Pass -G xxx to the compiler. */
|
|
|
+ #undef CC1_SPEC
|
|
|
#define CC1_SPEC "%{G*} %(cc1_cpu)" \
|
|
|
- "%{meabi: %{!mcall-*: -mcall-sysv }} \
|
|
|
-@@ -585,7 +589,8 @@
|
|
|
-
|
|
|
- /* 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 "\
|
|
|
-@@ -894,6 +899,7 @@
|
|
|
+@@ -889,6 +893,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 }, \
|
|
@@ -265,3 +237,34 @@ Index: gcc-4.9.0/gcc/config/rs6000/sysv4.h
|
|
|
{ "cpp_os_ads", CPP_OS_ADS_SPEC }, \
|
|
|
{ "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
|
|
|
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
|
|
|
+diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
|
|
|
+index f20a41b..eb879ef 100644
|
|
|
+--- 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 */
|
|
|
+--
|
|
|
+2.6.3
|
|
|
+
|