void-packages/srcpkgs/gcc/files/gcc-6.3.0-musl.diff

545 lines
17 KiB
Diff

# HG changeset patch
# Parent 90a7a3809a7ccb60e357b5e88382260877f82257
Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
diff -r 90a7a3809a7c libstdc++-v3/configure.host
--- a/libstdc++-v3/configure.host Thu Dec 24 11:22:15 2015 -0500
+++ b/libstdc++-v3/configure.host Thu Dec 24 11:24:45 2015 -0500
@@ -266,6 +266,13 @@
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
@@ -274,6 +274,9 @@
os_include_dir="os/gnu-linux"
fi
;;
+
+ esac
+ ;;
hpux*)
os_include_dir="os/hpux"
;;
diff -r 30a957f60ddb gcc/ginclude/stddef.h
--- a/gcc/ginclude/stddef.h Thu Dec 24 11:24:45 2015 -0500
+++ b/gcc/ginclude/stddef.h Thu Dec 24 11:24:47 2015 -0500
@@ -184,6 +184,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
@@ -200,6 +201,7 @@
#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 long ssize_t;
#endif /* __BEOS__ */
#endif /* !(defined (__GNUG__) && defined (size_t)) */
+#endif /* __DEFINED_size_t */
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
# HG changeset patch
# Parent 90228af47e55eb338c7f672e4aca5ac81cf5f14c
A fix for libgomp to correctly request a POSIX version for time support.
diff -r 90228af47e55 libgomp/config/posix/time.c
--- a/libgomp/config/posix/time.c Thu Dec 24 11:24:47 2015 -0500
+++ b/libgomp/config/posix/time.c Thu Dec 24 11:24:49 2015 -0500
@@ -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 -r b08d4bc3d2ba libgcc/unwind-dw2-fde-dip.c
--- a/libgcc/unwind-dw2-fde-dip.c Thu Dec 24 11:24:49 2015 -0500
+++ b/libgcc/unwind-dw2-fde-dip.c Thu Dec 24 11:24:51 2015 -0500
@@ -46,6 +46,10 @@
#include "unwind-compat.h"
#include "gthr.h"
+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+# define USE_PT_GNU_EH_FRAME
+#endif
+
#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)))
diff -r 1f375ed3689f gcc/gcc.c
--- a/gcc/gcc.c Thu Dec 24 11:24:53 2015 -0500
+++ b/gcc/gcc.c Thu Dec 24 11:24:56 2015 -0500
@@ -860,7 +860,7 @@
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+ "|fstack-protector-strong|fstack-protector-explicit:-lssp_nonshared}"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
# HG changeset patch
# Parent 76b553fabcf19eec5df2df7f05ce15a4bf8c3996
Support for mips-linux-musl.
diff -r 76b553fabcf1 gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h Thu Dec 24 11:25:02 2015 -0500
+++ b/gcc/config/mips/linux.h Thu Dec 24 11:25:04 2015 -0500
@@ -31,6 +31,13 @@
#undef UCLIBC_DYNAMIC_LINKER32
#define UCLIBC_DYNAMIC_LINKER32 \
"%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/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"
+
#undef UCLIBC_DYNAMIC_LINKER64
#define UCLIBC_DYNAMIC_LINKER64 \
"%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
# HG changeset patch
# Parent 971d410411735f0b04eb07236659097986926213
Support for powerpc-linux-musl.
diff -r 971d41041173 gcc/config.gcc
--- a/gcc/config.gcc Fri Dec 25 08:44:09 2015 -0500
+++ b/gcc/config.gcc Fri Dec 25 09:42:16 2015 -0500
@@ -2475,6 +2475,10 @@
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
diff -r a522e4b04c77 gcc/config/microblaze/microblaze.h
--- a/gcc/config/microblaze/microblaze.h Thu Dec 24 11:25:11 2015 -0500
+++ b/gcc/config/microblaze/microblaze.h Thu Dec 24 11:25:13 2015 -0500
@@ -218,6 +218,12 @@
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
&& (ALIGN) < BITS_PER_WORD \
diff -r f2936ad874dd gcc/config/sh/linux.h
--- a/gcc/config/sh/linux.h Fri Sep 28 16:32:03 2012 +1000
+++ b/gcc/config/sh/linux.h Thu Dec 24 11:25:15 2015 -0500
@@ -64,7 +64,14 @@
#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"
Do not use weak references on any targets for gthread. Necessary on musl, safe elsewhere.
diff -r e180e4cfc879 libgcc/gthr.h
--- a/libgcc/gthr.h Thu Dec 24 11:25:15 2015 -0500
+++ b/libgcc/gthr.h Thu Dec 24 11:25:17 2015 -0500
@@ -136,10 +136,8 @@
/* The pe-coff weak support isn't fully compatible to ELF's weak.
For static libraries it might would work, but as we need to deal
with shared versions too, we disable it for mingw-targets. */
-#ifdef __MINGW32__
#undef GTHREAD_USE_WEAK
#define GTHREAD_USE_WEAK 0
-#endif
#ifndef GTHREAD_USE_WEAK
#define GTHREAD_USE_WEAK 1
From 0a9ed0479203cb7e69c3745b0c259007410f39ba Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 47/47] libgcc_s: Use alias for __cpu_indicator_init instead of
symver
Adapter from
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
This fix was debated but hasnt been applied gcc upstream since
they expect musl to support '@' in symbol versioning which is
a sun/gnu versioning extention. This patch however avoids the
need for the '@' symbols at all
libgcc/Changelog:
2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
(__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
* config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
gcc/Changelog:
2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init
call __cpu_indicator_init_local instead of __cpu_indicator_init.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Rejected
gcc/config/i386/i386.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 861a029..1c97d72 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40497,10 +40497,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
- /* Make it call __cpu_indicator_init in libgcc. */
+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
tree call_expr, fndecl, type;
type = build_function_type_list (integer_type_node, NULL_TREE);
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
call_expr = build_call_expr (fndecl, 0);
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 8c2248d..6c82f15 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
return 0;
}
-#if defined SHARED && defined USE_ELF_SYMVER
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
+#ifndef SHARED
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 11bb46e..4f47f7b 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,4 +3,4 @@
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
+HOST_LIBGCC2_CFLAGS += -mlong-double-80
--
2.9.0
--- a/boehm-gc/os_dep.c 2013-09-17 07:46:00.969884340 +0000
+++ b/boehm-gc/os_dep.c 2013-09-17 06:53:53.629884946 +0000
@@ -26,7 +26,7 @@
# define __KERNEL__
# include <asm/signal.h>
# undef __KERNEL__
-# else
+# elif defined(__GLIBC__)
/* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
/* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */
/* prototypes, so we have to include the top-level sigcontext.h to */
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -459,9 +459,7 @@
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+# if (defined(LINUX) || defined (__GLIBC__))
/* We have the header files for a glibc that includes dl_iterate_phdr. */
/* It may still not be available in the library on the target system. */
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -696,7 +696,7 @@
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
-# if defined(__GLIBC__)&& __GLIBC__>=2
+# if 1
# define SEARCH_FOR_DATA_START
# else /* !GLIBC2 */
extern char **__environ;
@@ -1167,7 +1167,7 @@
# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
# endif
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if 1
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
@@ -1387,7 +1387,7 @@
# define HBLKSIZE 4096
# endif
# define USE_GENERIC_PUSH_REGS
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
+# if 1
# define LINUX_STACKBOTTOM
# else
# define STACKBOTTOM 0x80000000
@@ -1909,7 +1909,7 @@
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if 1
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
--- a/libjava/gnu/gcj/convert/natIconv.cc
+++ b/libjava/gnu/gcj/convert/natIconv.cc
@@ -24,6 +24,13 @@
#ifdef HAVE_ICONV
#include <iconv.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define UCS2_CHARSET "UCS-2BE"
+#else
+#define UCS2_CHARSET "UCS-2LE"
+#endif
template<typename T>
static inline size_t
@@ -45,7 +52,7 @@
_Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
buffer[len] = '\0';
- iconv_t h = iconv_open ("UCS-2", buffer);
+ iconv_t h = iconv_open (UCS2_CHARSET, buffer);
if (h == (iconv_t) -1)
throw new ::java::io::UnsupportedEncodingException (encoding);
@@ -99,18 +106,6 @@
throw new ::java::io::CharConversionException ();
}
- if (iconv_byte_swap)
- {
- size_t max = (old_out - outavail) / sizeof (jchar);
- for (size_t i = 0; i < max; ++i)
- {
- // Byte swap.
- jchar c = (((out[outpos + i] & 0xff) << 8)
- | ((out[outpos + i] >> 8) & 0xff));
- outbuf[i] = c;
- }
- }
-
inpos += old_in - inavail;
return (old_out - outavail) / sizeof (jchar);
#else /* HAVE_ICONV */
@@ -145,7 +140,7 @@
_Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
buffer[len] = '\0';
- iconv_t h = iconv_open (buffer, "UCS-2");
+ iconv_t h = iconv_open (buffer, UCS2_CHARSET);
if (h == (iconv_t) -1)
throw new ::java::io::UnsupportedEncodingException (encoding);
@@ -187,20 +182,6 @@
char *inbuf = (char *) &chars[inpos];
char *outbuf = (char *) &out[count];
- if (iconv_byte_swap)
- {
- // Ugly performance penalty -- don't use losing systems!
- temp_buffer = (jchar *) _Jv_Malloc (inlength * sizeof (jchar));
- for (int i = 0; i < inlength; ++i)
- {
- // Byte swap.
- jchar c = (((chars[inpos + i] & 0xff) << 8)
- | ((chars[inpos + i] >> 8) & 0xff));
- temp_buffer[i] = c;
- }
- inbuf = (char *) temp_buffer;
- }
-
size_t loop_old_in = old_in;
while (1)
{
@@ -252,44 +233,7 @@
jboolean
gnu::gcj::convert::IOConverter::iconv_init (void)
{
- // Some versions of iconv() always return their UCS-2 results in
- // big-endian order, and they also require UCS-2 inputs to be in
- // big-endian order. For instance, glibc 2.1.3 does this. If the
- // UTF-8=>UCS-2 iconv converter has this feature, then we assume
- // that all UCS-2 converters do. (This might not be the best
- // heuristic, but is is all we've got.)
- jboolean result = false;
-#ifdef HAVE_ICONV
- iconv_t handle = iconv_open ("UCS-2", "UTF-8");
- if (handle != (iconv_t) -1)
- {
- jchar c;
- unsigned char in[4];
- char *inp, *outp;
- size_t inc, outc, r;
-
- // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv
- // needs the trailing NUL byte, otherwise iconv fails with EINVAL.
- in[0] = 0xef;
- in[1] = 0xbb;
- in[2] = 0xbf;
- in[3] = 0x00;
-
- inp = (char *) in;
- inc = 4;
- outp = (char *) &c;
- outc = 2;
-
- r = iconv_adapter (iconv, handle, &inp, &inc, &outp, &outc);
- // Conversion must be complete for us to use the result.
- if (r != (size_t) -1 && inc == 0 && outc == 0)
- result = (c != 0xfeff);
-
- // Release iconv handle.
- iconv_close (handle);
- }
-#endif /* HAVE_ICONV */
- return result;
+ return false;
}
void
--- a/libjava/gnu/classpath/natSystemProperties.cc
+++ b/libjava/gnu/classpath/natSystemProperties.cc
@@ -289,7 +289,7 @@
// just default to `en_US'.
setlocale (LC_ALL, "");
char *locale = setlocale (LC_MESSAGES, "");
- if (locale && strlen (locale) >= 2)
+ if (locale && strlen (locale) >= 2 && (locale[2] == '\0' || locale[2] == '_'))
{
char buf[3];
buf[2] = '\0';
--- a/libjava/posix-threads.cc
+++ b/libjava/posix-threads.cc
@@ -657,6 +657,7 @@
struct sched_param param;
pthread_attr_t attr;
struct starter *info;
+ size_t ss;
if (data->flags & FLAG_START)
return;
@@ -675,8 +676,25 @@
// Set stack size if -Xss option was given.
if (gcj::stack_size > 0)
{
- int e = pthread_attr_setstacksize (&attr, gcj::stack_size);
+ ss = gcj::stack_size;
+ }
+ else
+ {
+ int e = pthread_attr_getstacksize (&attr, &ss);
+ if (e != 0)
+ JvFail (strerror (e));
+
+ // Request at least 1meg of stack
+ if (ss >= 1024 * 1024)
+ ss = 0;
+ else
+ ss = 1024 * 1024;
+ }
+
+ if (ss)
+ {
+ int e = pthread_attr_setstacksize (&attr, ss);
if (e != 0)
JvFail (strerror (e));
}
info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -166,6 +166,13 @@ cat > sysinfo.c <<EOF
#if defined(HAVE_SCHED_H)
#include <sched.h>
#endif
+#if !defined(__GLIBC__)
+#include <sys/types.h>
+#undef off64_t
+#undef loff_t
+typedef off_t loff_t;
+typedef off_t off64_t;
+#endif
/* Constants that may only be defined as expressions on some systems,
expressions too complex for -fdump-go-spec to handle. These are
--- a/libgo/runtime/proc.c 2016-09-23 16:17:22.000000000 +0200
+++ b/libgo/runtime/proc.c 2016-10-03 07:33:42.186000000 +0200
@@ -150,6 +150,20 @@
asm ("st %%g7, %0" : "=m"(c->uc_mcontext.gregs[REG_G7]));
}
+# elif !defined(__GLIBC__)
+
+static inline void
+initcontext(void)
+{
+ // FIXME: Do we need to save (part of) the current context?
+}
+
+static inline void
+fixcontext(ucontext_t *c __attribute__ ((unused)))
+{
+ // FIXME: Do we need to restore (part of) the current context?
+}
+
# else
# error unknown case for SETCONTEXT_CLOBBERS_TLS