add support for gcc 4.2.1 (last gplv2 version)
patch set consists of: 0001 full musl libc target support 0002 fixes for wrong optimizations of weak defs/aliases 0003 various sh breakage in configure scripts 0005 static pie support 0006 --enable-default-pie support 0008 fix for cross compiling bug in build system 0009 fix for wrong default div strategy for sh2 (missing libgcc code) 0010 fix failure to build on modern host gcc due to gnu-inline 0011 fix sh & alpha bootstrap failures before libc is built 0012 fix broken local-exec TLS with -fPIE on sh
This commit is contained in:
parent
35cdd4619f
commit
06a1f34243
|
@ -0,0 +1,360 @@
|
|||
diff --git a/config.sub b/config.sub
|
||||
index fab0aa3..b83660a 100755
|
||||
--- a/config.sub
|
||||
+++ b/config.sub
|
||||
@@ -120,7 +120,7 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | linux-musl* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
@@ -1211,7 +1211,7 @@ case $os in
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
- | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* | -linux-musl* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
diff --git a/fixincludes/mkfixinc.sh b/fixincludes/mkfixinc.sh
|
||||
index ef048f7..f1cb8a5 100755
|
||||
--- a/fixincludes/mkfixinc.sh
|
||||
+++ b/fixincludes/mkfixinc.sh
|
||||
@@ -28,7 +28,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/gcc/config.gcc b/gcc/config.gcc
|
||||
index 9a142e2..25136b7 100644
|
||||
--- a/gcc/config.gcc
|
||||
+++ b/gcc/config.gcc
|
||||
@@ -468,11 +468,14 @@ case ${target} in
|
||||
esac
|
||||
tmake_file="t-slibgcc-elf-ver t-linux"
|
||||
case ${target} in
|
||||
+ *-*-*musl*)
|
||||
+ tm_defines="${tm_defines} UCLIBC_DEFAULT=0 MUSL_DEFAULT=1"
|
||||
+ ;;
|
||||
*-*-*uclibc*)
|
||||
- tm_defines="${tm_defines} UCLIBC_DEFAULT=1"
|
||||
+ tm_defines="${tm_defines} UCLIBC_DEFAULT=1 MUSL_DEFAULT=0"
|
||||
;;
|
||||
*)
|
||||
- tm_defines="${tm_defines} UCLIBC_DEFAULT=0"
|
||||
+ tm_defines="${tm_defines} UCLIBC_DEFAULT=0 MUSL_DEFAULT=0"
|
||||
;;
|
||||
esac
|
||||
# Assume that glibc or uClibc are being used and so __cxa_atexit is provided.
|
||||
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
|
||||
index 6612f74..f2ce735 100644
|
||||
--- a/gcc/config/arm/linux-eabi.h
|
||||
+++ b/gcc/config/arm/linux-eabi.h
|
||||
@@ -55,6 +55,23 @@
|
||||
#undef GLIBC_DYNAMIC_LINKER
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
|
||||
|
||||
+/* 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
|
||||
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
|
||||
index 7eb2395..213b586 100644
|
||||
--- a/gcc/config/i386/linux.h
|
||||
+++ b/gcc/config/i386/linux.h
|
||||
@@ -103,6 +103,9 @@ Boston, MA 02110-1301, USA. */
|
||||
#define 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"
|
||||
+
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "link_emulation", LINK_EMULATION },\
|
||||
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
|
||||
index cc8ed16..f0f025e 100644
|
||||
--- a/gcc/config/i386/linux64.h
|
||||
+++ b/gcc/config/i386/linux64.h
|
||||
@@ -52,6 +52,13 @@ Boston, MA 02110-1301, USA. */
|
||||
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
|
||||
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.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"
|
||||
+
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
|
||||
%{shared:-shared} \
|
||||
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
|
||||
index 59e3e85..1967b46 100644
|
||||
--- a/gcc/config/linux.h
|
||||
+++ b/gcc/config/linux.h
|
||||
@@ -102,10 +102,12 @@ Boston, MA 02110-1301, USA. */
|
||||
/* Determine which dynamic linker to use depending on whether GLIBC or
|
||||
uClibc is the default C library and whether -muclibc or -mglibc has
|
||||
been passed to change the default. */
|
||||
-#if UCLIBC_DEFAULT
|
||||
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}"
|
||||
+#if MUSL_DEFAULT
|
||||
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";muclibc:" U ";:" M "}"
|
||||
+#elif UCLIBC_DEFAULT
|
||||
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";mmusl:" M ";:" U "}"
|
||||
#else
|
||||
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}"
|
||||
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mmusl:" M ";muclibc:" U ";:" G "}"
|
||||
#endif
|
||||
|
||||
/* For most targets the following definitions suffice;
|
||||
@@ -115,15 +117,89 @@ Boston, MA 02110-1301, USA. */
|
||||
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
|
||||
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
|
||||
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
|
||||
+/* 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 LINUX_DYNAMIC_LINKER \
|
||||
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
|
||||
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
|
||||
#define LINUX_DYNAMIC_LINKER32 \
|
||||
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
|
||||
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
|
||||
#define LINUX_DYNAMIC_LINKER64 \
|
||||
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
|
||||
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
|
||||
|
||||
/* Determine whether the entire c99 runtime
|
||||
is present in the runtime library. */
|
||||
#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
|
||||
|
||||
#define TARGET_POSIX_IO
|
||||
+
|
||||
+/* musl avoids problematic includes by rearranging the include directories.
|
||||
+ * Unfortunately, this is mostly duplicated from cppdefault.c */
|
||||
+#if MUSL_DEFAULT
|
||||
+#define INCLUDE_DEFAULTS_MUSL_GPP \
|
||||
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
|
||||
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 1 }, \
|
||||
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 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
|
||||
diff --git a/gcc/config/linux.opt b/gcc/config/linux.opt
|
||||
index 3f615bb..31fb21b 100644
|
||||
--- a/gcc/config/linux.opt
|
||||
+++ b/gcc/config/linux.opt
|
||||
@@ -27,3 +27,7 @@ Use uClibc instead of GNU libc
|
||||
mglibc
|
||||
Target RejectNegative Report InverseMask(UCLIBC, GLIBC) Var(linux_uclibc) VarExists
|
||||
Use GNU libc instead of uClibc
|
||||
+
|
||||
+mmusl
|
||||
+Target RejectNegative Report Var(linux_musl)
|
||||
+Use musl C library
|
||||
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
|
||||
index ff268d4..97bfc38 100644
|
||||
--- a/gcc/config/mips/linux.h
|
||||
+++ b/gcc/config/mips/linux.h
|
||||
@@ -179,3 +179,9 @@ Boston, MA 02110-1301, USA. */
|
||||
%{profile:-lc_p} %{!profile: -lc}}"
|
||||
|
||||
#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
|
||||
+
|
||||
+#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"
|
||||
diff --git a/gcc/config/sh/linux-unwind.h b/gcc/config/sh/linux-unwind.h
|
||||
index de84a77..98d1661 100644
|
||||
--- a/gcc/config/sh/linux-unwind.h
|
||||
+++ b/gcc/config/sh/linux-unwind.h
|
||||
@@ -80,10 +80,10 @@ shmedia_fallback_frame_state (struct _Unwind_Context *context,
|
||||
&& (*(unsigned long *) (pc+11) == 0x6ff0fff0))
|
||||
{
|
||||
struct rt_sigframe {
|
||||
- struct siginfo *pinfo;
|
||||
+ siginfo_t *pinfo;
|
||||
void *puc;
|
||||
- struct siginfo info;
|
||||
- struct ucontext uc;
|
||||
+ siginfo_t info;
|
||||
+ ucontext_t uc;
|
||||
} *rt_ = context->cfa;
|
||||
/* The void * cast is necessary to avoid an aliasing warning.
|
||||
The aliasing warning is correct, but should not be a problem
|
||||
@@ -179,8 +179,8 @@ sh_fallback_frame_state (struct _Unwind_Context *context,
|
||||
&& (*(unsigned short *) (pc+14) == 0x00ad))))
|
||||
{
|
||||
struct rt_sigframe {
|
||||
- struct siginfo info;
|
||||
- struct ucontext uc;
|
||||
+ siginfo_t info;
|
||||
+ ucontext_t uc;
|
||||
} *rt_ = context->cfa;
|
||||
/* The void * cast is necessary to avoid an aliasing warning.
|
||||
The aliasing warning is correct, but should not be a problem
|
||||
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
|
||||
index 94c3166..306a08c 100644
|
||||
--- a/gcc/config/sh/linux.h
|
||||
+++ b/gcc/config/sh/linux.h
|
||||
@@ -48,6 +48,29 @@ Boston, MA 02110-1301, USA. */
|
||||
|
||||
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
|
||||
|
||||
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
|
||||
+#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}"
|
||||
+#else
|
||||
+#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}"
|
||||
+#endif
|
||||
+
|
||||
+#if TARGET_CPU_DEFAULT & ( MASK_HARD_SH2A_DOUBLE | MASK_SH4 )
|
||||
+/* "-nofpu" if any nofpu option is specified */
|
||||
+#define MUSL_DYNAMIC_LINKER_FP \
|
||||
+ "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \
|
||||
+ "m4-340|m4-400|m4-500|m4al|m5-32media-nofpu|m5-64media-nofpu|" \
|
||||
+ "m5-compact-nofpu:-nofpu}"
|
||||
+#else
|
||||
+/* "-nofpu" if none of the hard fpu options are specified */
|
||||
+#define MUSL_DYNAMIC_LINKER_FP \
|
||||
+ "%{m2a|m4|m4-100|m4-200|m4-300|m4a|m5-32media|m5-64media|m5-compact:;:-nofpu}"
|
||||
+#endif
|
||||
+
|
||||
+#undef MUSL_DYNAMIC_LINKER
|
||||
+#define MUSL_DYNAMIC_LINKER \
|
||||
+ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
|
||||
+ "%{mfdpic:-fdpic}.so.1"
|
||||
+
|
||||
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
|
||||
|
||||
#undef SUBTARGET_LINK_EMUL_SUFFIX
|
||||
diff --git a/gcc/unwind-dw2-fde-glibc.c b/gcc/unwind-dw2-fde-glibc.c
|
||||
index 25bf2bb..59f7615 100644
|
||||
--- a/gcc/unwind-dw2-fde-glibc.c
|
||||
+++ b/gcc/unwind-dw2-fde-glibc.c
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "gthr.h"
|
||||
|
||||
#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
|
||||
- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|
||||
+ && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|
||||
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
|
||||
|
||||
#ifndef __RELOC_POINTER
|
||||
diff --git a/libstdc++-v3/config/os/generic/os_defines.h b/libstdc++-v3/config/os/generic/os_defines.h
|
||||
index bcc533c..a9bfded 100644
|
||||
--- a/libstdc++-v3/config/os/generic/os_defines.h
|
||||
+++ b/libstdc++-v3/config/os/generic/os_defines.h
|
||||
@@ -38,4 +38,9 @@
|
||||
// System-specific #define, typedefs, corrections, etc, go here. This
|
||||
// file will come before all others.
|
||||
|
||||
+// Disable the weak reference logic in gthr.h for os/generic because it
|
||||
+// is broken on every platform unless there is implementation specific
|
||||
+// workaround in gthr-posix.h and at link-time for static linking.
|
||||
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
|
||||
+
|
||||
#endif
|
||||
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
|
||||
index 441eb4c..37e80ab 100644
|
||||
--- a/libstdc++-v3/configure.host
|
||||
+++ b/libstdc++-v3/configure.host
|
||||
@@ -210,6 +210,9 @@ case "${host_os}" in
|
||||
freebsd*)
|
||||
os_include_dir="os/bsd/freebsd"
|
||||
;;
|
||||
+ linux-musl*)
|
||||
+ os_include_dir="os/generic"
|
||||
+ ;;
|
||||
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
|
||||
if [ "$uclibc" = "yes" ]; then
|
||||
os_include_dir="os/uclibc"
|
|
@ -0,0 +1,62 @@
|
|||
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
|
||||
index fcdc02e..db04afd 100644
|
||||
--- a/gcc/cgraph.c
|
||||
+++ b/gcc/cgraph.c
|
||||
@@ -1169,7 +1169,7 @@ cgraph_function_body_availability (struct cgraph_node *node)
|
||||
inline and offline) having same side effect characteristics as
|
||||
good optimization is what this optimization is about. */
|
||||
|
||||
- else if (!(*targetm.binds_local_p) (node->decl)
|
||||
+ else if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl))
|
||||
&& !DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl))
|
||||
avail = AVAIL_OVERWRITABLE;
|
||||
else avail = AVAIL_AVAILABLE;
|
||||
@@ -1190,7 +1190,8 @@ cgraph_variable_initializer_availability (struct cgraph_varpool_node *node)
|
||||
/* If the variable can be overwritten, return OVERWRITABLE. Takes
|
||||
care of at least two notable extensions - the COMDAT variables
|
||||
used to share template instantiations in C++. */
|
||||
- if (!(*targetm.binds_local_p) (node->decl) && !DECL_COMDAT (node->decl))
|
||||
+ if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl))
|
||||
+ && !DECL_COMDAT (node->decl))
|
||||
return AVAIL_OVERWRITABLE;
|
||||
return AVAIL_AVAILABLE;
|
||||
}
|
||||
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
|
||||
index 84ef830..73d9fcc 100644
|
||||
--- a/gcc/ipa-inline.c
|
||||
+++ b/gcc/ipa-inline.c
|
||||
@@ -300,7 +300,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
|
||||
|
||||
if (n->inline_decl)
|
||||
decl = n->inline_decl;
|
||||
- if (!DECL_INLINE (decl))
|
||||
+ if (!DECL_INLINE (decl) || DECL_WEAK (decl))
|
||||
{
|
||||
if (reason)
|
||||
*reason = N_("function not inlinable");
|
||||
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
|
||||
index fdaff50..1bfd577 100644
|
||||
--- a/gcc/ipa-pure-const.c
|
||||
+++ b/gcc/ipa-pure-const.c
|
||||
@@ -512,7 +512,7 @@ analyze_function (struct cgraph_node *fn)
|
||||
/* If this function does not return normally or does not bind local,
|
||||
do not touch this unless it has been marked as const or pure by the
|
||||
front end. */
|
||||
- if (TREE_THIS_VOLATILE (decl)
|
||||
+ if (TREE_THIS_VOLATILE (decl) || DECL_WEAK (decl)
|
||||
|| !targetm.binds_local_p (decl))
|
||||
{
|
||||
l->pure_const_state = IPA_NEITHER;
|
||||
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
|
||||
index 1c0b79b..5a3ba7e 100644
|
||||
--- a/gcc/tree-inline.c
|
||||
+++ b/gcc/tree-inline.c
|
||||
@@ -1522,6 +1522,8 @@ inlinable_function_p (tree fn)
|
||||
else if (!DECL_INLINE (fn) && !flag_unit_at_a_time)
|
||||
inlinable = false;
|
||||
|
||||
+ else if (DECL_WEAK (fn))
|
||||
+ inlinable = false;
|
||||
else if (inline_forbidden_p (fn))
|
||||
{
|
||||
/* See if we should warn about uninlinable functions. Previously,
|
|
@ -0,0 +1,79 @@
|
|||
diff --git a/config.sub b/config.sub
|
||||
index b83660a..b81ad9a 100755
|
||||
--- a/config.sub
|
||||
+++ b/config.sub
|
||||
@@ -277,7 +277,7 @@ case $basic_machine in
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| score \
|
||||
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[1234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
@@ -358,7 +358,7 @@ case $basic_machine in
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[1234]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
@@ -1127,7 +1127,7 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
+ sh[1234] | sh[24]a | sh[1234]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||
diff --git a/gcc/config.gcc b/gcc/config.gcc
|
||||
index 25136b7..3779369 100644
|
||||
--- a/gcc/config.gcc
|
||||
+++ b/gcc/config.gcc
|
||||
@@ -1967,7 +1967,7 @@ score-*-elf)
|
||||
;;
|
||||
sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
|
||||
sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
|
||||
- sh-*-linux* | sh[346lbe]*-*-linux* | \
|
||||
+ sh-*-linux* | sh[12346lbe]*-*-linux* | \
|
||||
sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
|
||||
sh64-*-netbsd* | sh64l*-*-netbsd*)
|
||||
tmake_file="${tmake_file} sh/t-sh sh/t-elf"
|
||||
@@ -2911,7 +2911,7 @@ case "${target}" in
|
||||
esac
|
||||
;;
|
||||
|
||||
- sh[123456ble]-*-* | sh-*-*)
|
||||
+ sh[123456ble]*-*-* | sh-*-*)
|
||||
supported_defaults="cpu"
|
||||
case "`echo $with_cpu | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz- | sed s/sh/m/`" in
|
||||
"" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu )
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index a248d39..c12f091 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -14564,7 +14564,7 @@ foo: .long 25
|
||||
tls_first_minor=14
|
||||
tls_as_opt="-m64 -Aesame --fatal-warnings"
|
||||
;;
|
||||
- sh-*-* | sh[34]-*-*)
|
||||
+ sh-*-* | sh[123456789lbe]*-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",@progbits
|
||||
foo: .long 25
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index b6c394c..1414f9e 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -2538,7 +2538,7 @@ foo: .long 25
|
||||
tls_first_minor=14
|
||||
tls_as_opt="-m64 -Aesame --fatal-warnings"
|
||||
;;
|
||||
- sh-*-* | sh[34]-*-*)
|
||||
+ sh-*-* | sh[123456789lbe]*-*-*)
|
||||
conftest_s='
|
||||
.section ".tdata","awT",@progbits
|
||||
foo: .long 25
|
|
@ -0,0 +1,28 @@
|
|||
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
|
||||
index 1967b46..39f8cb4 100644
|
||||
--- a/gcc/config/linux.h
|
||||
+++ b/gcc/config/linux.h
|
||||
@@ -41,8 +41,8 @@ Boston, MA 02110-1301, USA. */
|
||||
#undef STARTFILE_SPEC
|
||||
#if defined HAVE_LD_PIE
|
||||
#define STARTFILE_SPEC \
|
||||
- "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
|
||||
- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
|
||||
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:%{static:rcrt1.o%s;:Scrt1.o%s};:crt1.o%s}} \
|
||||
+ crti.o%s %{shared|pie:crtbeginS.o%s;static:crtbeginT.o%s;:crtbegin.o%s}"
|
||||
#else
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
|
||||
diff --git a/gcc/gcc.c b/gcc/gcc.c
|
||||
index 0b5ee4b..41d17a5 100644
|
||||
--- a/gcc/gcc.c
|
||||
+++ b/gcc/gcc.c
|
||||
@@ -684,7 +684,7 @@ proper position among the other output files. */
|
||||
|
||||
#ifndef LINK_PIE_SPEC
|
||||
#ifdef HAVE_LD_PIE
|
||||
-#define LINK_PIE_SPEC "%{pie:-pie} "
|
||||
+#define LINK_PIE_SPEC "%{pie:-pie %{static:--no-dynamic-linker}} "
|
||||
#else
|
||||
#define LINK_PIE_SPEC "%{pie:} "
|
||||
#endif
|
|
@ -0,0 +1,39 @@
|
|||
diff --git a/gcc/config.gcc b/gcc/config.gcc
|
||||
index 3779369..a6d95ca 100644
|
||||
--- a/gcc/config.gcc
|
||||
+++ b/gcc/config.gcc
|
||||
@@ -3101,6 +3101,12 @@ case ${target} in
|
||||
;;
|
||||
esac
|
||||
|
||||
+case "x${enable_default_pie}" in
|
||||
+xyes)
|
||||
+ tm_defines="${tm_defines} ENABLE_DEFAULT_PIE"
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
t=
|
||||
all_defaults="abi cpu arch tune schedule float mode fpu divide"
|
||||
for option in $all_defaults
|
||||
diff --git a/gcc/gcc.c b/gcc/gcc.c
|
||||
index 41d17a5..b9bbcb6 100644
|
||||
--- a/gcc/gcc.c
|
||||
+++ b/gcc/gcc.c
|
||||
@@ -846,8 +846,16 @@ static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
|
||||
#define GOMP_SELF_SPECS "%{fopenmp: -pthread}"
|
||||
#endif
|
||||
|
||||
+#ifndef PIE_SELF_SPECS
|
||||
+#ifdef ENABLE_DEFAULT_PIE
|
||||
+#define PIE_SELF_SPECS "%{shared|pie|r|nostdlib|nopie|no-pie:;:-pie} %{fpic|fPIC|fpie|fPIE|fno-pic|fno-PIC|fno-pie|fno-PIE|D__KERNEL__:;:-fPIE}"
|
||||
+#else
|
||||
+#define PIE_SELF_SPECS ""
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
static const char *const driver_self_specs[] = {
|
||||
- DRIVER_SELF_SPECS, GOMP_SELF_SPECS
|
||||
+ DRIVER_SELF_SPECS, GOMP_SELF_SPECS, PIE_SELF_SPECS
|
||||
};
|
||||
|
||||
#ifndef OPTION_DEFAULT_SPECS
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 218d8fa..45c1764 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -208,7 +208,7 @@ BASE_TARGET_EXPORTS = \
|
||||
RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
|
||||
STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
|
||||
WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
|
||||
- $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
|
||||
+ $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
|
||||
|
||||
RAW_CXX_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
|
||||
index fc4e1f2..1a4cf00 100644
|
||||
--- a/gcc/config/sh/sh.h
|
||||
+++ b/gcc/config/sh/sh.h
|
||||
@@ -649,10 +649,6 @@ do { \
|
||||
/* ??? Should we use the integer SHmedia function instead? */ \
|
||||
else if (TARGET_SHCOMPACT && TARGET_FPU_ANY) \
|
||||
sh_div_strategy = SH_DIV_CALL_FP; \
|
||||
- /* SH1 .. SH3 cores often go into small-footprint systems, so \
|
||||
- default to the smallest implementation available. */ \
|
||||
- else if (TARGET_SH2) /* ??? EXPERIMENTAL */ \
|
||||
- sh_div_strategy = SH_DIV_CALL_TABLE; \
|
||||
else \
|
||||
sh_div_strategy = SH_DIV_CALL_DIV1; \
|
||||
} \
|
|
@ -0,0 +1,53 @@
|
|||
diff --git a/gcc/toplev.c b/gcc/toplev.c
|
||||
index 53fcdfe..85f8504 100644
|
||||
--- a/gcc/toplev.c
|
||||
+++ b/gcc/toplev.c
|
||||
@@ -533,6 +533,7 @@ read_integral_parameter (const char *p, const char *pname, const int defval)
|
||||
|
||||
#if GCC_VERSION < 3004 || !defined (__cplusplus)
|
||||
|
||||
+#if 0
|
||||
/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
|
||||
If X is 0, return -1. */
|
||||
|
||||
@@ -582,6 +583,7 @@ exact_log2 (unsigned HOST_WIDE_INT x)
|
||||
return floor_log2 (x);
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
#endif /* GCC_VERSION < 3004 || !defined (__cplusplus) */
|
||||
|
||||
diff --git a/gcc/toplev.h b/gcc/toplev.h
|
||||
index c935f7e..c8d4bb2 100644
|
||||
--- a/gcc/toplev.h
|
||||
+++ b/gcc/toplev.h
|
||||
@@ -152,10 +152,10 @@ extern void decode_d_option (const char *);
|
||||
extern bool fast_math_flags_set_p (void);
|
||||
|
||||
/* Return log2, or -1 if not exact. */
|
||||
-extern int exact_log2 (unsigned HOST_WIDE_INT);
|
||||
+//extern int exact_log2 (unsigned HOST_WIDE_INT);
|
||||
|
||||
/* Return floor of log2, with -1 for zero. */
|
||||
-extern int floor_log2 (unsigned HOST_WIDE_INT);
|
||||
+//extern int floor_log2 (unsigned HOST_WIDE_INT);
|
||||
|
||||
/* Inline versions of the above for speed. */
|
||||
#if GCC_VERSION >= 3004
|
||||
@@ -170,13 +170,13 @@ extern int floor_log2 (unsigned HOST_WIDE_INT);
|
||||
# define CTZ_HWI __builtin_ctz
|
||||
# endif
|
||||
|
||||
-extern inline int
|
||||
+static inline int
|
||||
floor_log2 (unsigned HOST_WIDE_INT x)
|
||||
{
|
||||
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
|
||||
}
|
||||
|
||||
-extern inline int
|
||||
+static inline int
|
||||
exact_log2 (unsigned HOST_WIDE_INT x)
|
||||
{
|
||||
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
|
|
@ -0,0 +1,36 @@
|
|||
diff -ru gcc-core/gcc/config/sh/linux-unwind.h gcc-core/gcc/config/sh/linux-unwind.h
|
||||
--- gcc-core/gcc/config/sh/linux-unwind.h 2005-06-28 20:45:37.000000000 -0500
|
||||
+++ gcc-core/gcc/config/sh/linux-unwind.h 2008-02-06 17:41:12.000000000 -0600
|
||||
@@ -26,6 +26,8 @@
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#ifndef inhibit_libc
|
||||
+
|
||||
/* Do code reading to identify a signal frame, and set the frame
|
||||
state data appropriately. See unwind-dw2.c for the structs. */
|
||||
|
||||
@@ -249,3 +251,5 @@
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
#endif /* defined (__SH5__) */
|
||||
+
|
||||
+#endif
|
||||
diff -ru gcc-core/gcc/config/alpha/linux-unwind.h gcc-core2/gcc/config/alpha/linux-unwind.h
|
||||
--- gcc-core/gcc/config/alpha/linux-unwind.h 2005-06-24 20:22:41.000000000 -0500
|
||||
+++ gcc-core2/gcc/config/alpha/linux-unwind.h 2010-01-10 20:05:56.000000000 -0600
|
||||
@@ -26,6 +26,8 @@
|
||||
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
|
||||
+#ifndef inhibit_libc
|
||||
+
|
||||
/* Do code reading to identify a signal frame, and set the frame
|
||||
state data appropriately. See unwind-dw2.c for the structs. */
|
||||
|
||||
@@ -80,3 +82,5 @@
|
||||
fs->retaddr_column = 64;
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
+
|
||||
+#endif
|
|
@ -0,0 +1,10 @@
|
|||
--- gcc-4.2.1/gcc/config/sh/sh.c.orig 2015-11-06 04:41:52.683021006 +0000
|
||||
+++ gcc-4.2.1/gcc/config/sh/sh.c 2015-11-06 04:42:00.643020520 +0000
|
||||
@@ -8343,6 +8343,7 @@ nonpic_symbol_mentioned_p (rtx x)
|
||||
|| XINT (x, 1) == UNSPEC_GOTPLT
|
||||
|| XINT (x, 1) == UNSPEC_GOTTPOFF
|
||||
|| XINT (x, 1) == UNSPEC_DTPOFF
|
||||
+ || XINT (x, 1) == UNSPEC_TPOFF
|
||||
|| XINT (x, 1) == UNSPEC_PLT))
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue