Skip to content

Commit

Permalink
add support for GCC 6.5.0
Browse files Browse the repository at this point in the history
new patch: 0017-c++-abi-break.diff fixes a C++ ABI break regression.
0010-static-pie-support.diff was removed as it doesn't apply anymore,
and forward-porting it requires arcane knowledge of GCC details.

the patches 0018 and 0019 have been copied from GCC 7.3.0. the static
pie patch from GCC 6.4.0, renumbered 0020, depends on the reversions
they make.
  • Loading branch information
rofl0r authored and richfelker committed Feb 13, 2019
1 parent a14e91f commit 7ea4872
Show file tree
Hide file tree
Showing 19 changed files with 1,109 additions and 0 deletions.
1 change: 1 addition & 0 deletions hashes/gcc-6.5.0.tar.xz.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
368b3f5d294b1a8727b372ac0a77703d8b41968a gcc-6.5.0.tar.xz
13 changes: 13 additions & 0 deletions patches/gcc-6.5.0/0001-linux_libc_has_function.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/gcc/config/linux.c b/gcc/config/linux.c
index 250296b..16c3768 100644
--- a/gcc/config/linux.c
+++ b/gcc/config/linux.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
bool
linux_libc_has_function (enum function_class fn_class)
{
- if (OPTION_GLIBC)
+ if (OPTION_GLIBC || OPTION_MUSL)
return true;
if (OPTION_BIONIC)
if (fn_class == function_c94
14 changes: 14 additions & 0 deletions patches/gcc-6.5.0/0002-ssp_nonshared.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0f042b0..0576ea7 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -860,7 +860,8 @@ proper position among the other output files. */
#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" \
13 changes: 13 additions & 0 deletions patches/gcc-6.5.0/0003-mips-unwind.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/libgcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h
index bf12de5..4035c121 100644
--- a/libgcc/config/mips/linux-unwind.h
+++ b/libgcc/config/mips/linux-unwind.h
@@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
state data appropriately. See unwind-dw2.c for the structs. */

#include <signal.h>
-#include <asm/unistd.h>
+#include <sys/syscall.h>

/* The third parameter to the signal handler points to something with
* this structure defined in asm/ucontext.h, but the name clashes with
30 changes: 30 additions & 0 deletions patches/gcc-6.5.0/0004-posix_memalign.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
index a9c2be4..2596a90 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>

/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");

static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;
47 changes: 47 additions & 0 deletions patches/gcc-6.5.0/0005-cilkrts.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
index cb582dd..e43d7d5 100644
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -51,6 +51,7 @@
#if defined __linux__
# include <sys/sysinfo.h>
# include <sys/syscall.h>
+# include <sched.h>
#elif defined __APPLE__
# include <sys/sysctl.h>
// Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
@@ -400,28 +401,19 @@ COMMON_SYSDEP void __cilkrts_sleep(void)

COMMON_SYSDEP void __cilkrts_yield(void)
{
-#if __APPLE__ || __FreeBSD__ || __VXWORKS__
- // On MacOS, call sched_yield to yield quantum. I'm not sure why we
- // don't do this on Linux also.
- sched_yield();
-#elif defined(__DragonFly__)
- // On DragonFly BSD, call sched_yield to yield quantum.
- sched_yield();
-#elif defined(__MIC__)
+#if defined(__MIC__)
// On MIC, pthread_yield() really trashes things. Arch's measurements
// showed that calling _mm_delay_32() (or doing nothing) was a better
// option. Delaying 1024 clock cycles is a reasonable compromise between
// giving up the processor and latency starting up when work becomes
// available
_mm_delay_32(1024);
-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
- // On Android and Solaris, call sched_yield to yield quantum. I'm not
- // sure why we don't do this on Linux also.
- sched_yield();
-#else
- // On Linux, call pthread_yield (which in turn will call sched_yield)
- // to yield quantum.
+#elif defined(__sun__) && !defined(__svr4__)
+ // On old SunOS call pthread_yield to yield a quantum.
pthread_yield();
+#else
+ // On other platforms call sched_yield to yield a quantum.
+ sched_yield();
#endif
}

58 changes: 58 additions & 0 deletions patches/gcc-6.5.0/0006-libatomic-test-fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/libatomic/testsuite/Makefile.am b/libatomic/testsuite/Makefile.am
index 561b7e2..2548a1b 100644
--- a/libatomic/testsuite/Makefile.am
+++ b/libatomic/testsuite/Makefile.am
@@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
+
+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
diff --git a/libatomic/testsuite/Makefile.in b/libatomic/testsuite/Makefile.in
index 34f83e0..4af67ad 100644
--- a/libatomic/testsuite/Makefile.in
+++ b/libatomic/testsuite/Makefile.in
@@ -222,6 +222,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)

RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
all: all-am

.SUFFIXES:
@@ -428,6 +429,10 @@ uninstall-am:
uninstall uninstall-am


+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libatomic/testsuite/lib/libatomic.exp b/libatomic/testsuite/lib/libatomic.exp
index cafab54..dd2e1a4 100644
--- a/libatomic/testsuite/lib/libatomic.exp
+++ b/libatomic/testsuite/lib/libatomic.exp
@@ -74,6 +74,7 @@ proc libatomic_init { args } {
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
+ global BUILD_CC
global GCC_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
@@ -89,6 +90,8 @@ proc libatomic_init { args } {
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } elseif [info exists BUILD_CC] {
+ set GCC_UNDER_TEST $BUILD_CC
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
60 changes: 60 additions & 0 deletions patches/gcc-6.5.0/0007-libgomp-test-fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am
index 66a9d94..83d3f67 100644
--- a/libgomp/testsuite/Makefile.am
+++ b/libgomp/testsuite/Makefile.am
@@ -12,6 +12,11 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"

+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
+
+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@

# Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
# following variables have to be "routed through" this Makefile, for expansion
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 4dbb406..001a163 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -254,6 +254,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)

RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
all: all-am

.SUFFIXES:
@@ -462,6 +463,10 @@ uninstall-am:
ps ps-am uninstall uninstall-am


+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
+
# Instead of directly in ../testsuite/libgomp-test-support.exp.in, the
# following variables have to be "routed through" this Makefile, for expansion
# of the several (Makefile) variables used therein.
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 1cb4991..398ba1f 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -85,6 +85,7 @@ proc libgomp_init { args } {
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
+ global BUILD_CC
global GCC_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
@@ -107,6 +108,8 @@ proc libgomp_init { args } {
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } elseif [info exists BUILD_CC] {
+ set GCC_UNDER_TEST $BUILD_CC
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
58 changes: 58 additions & 0 deletions patches/gcc-6.5.0/0008-libitm-test-fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/libitm/testsuite/Makefile.am b/libitm/testsuite/Makefile.am
index 561b7e2..2548a1b 100644
--- a/libitm/testsuite/Makefile.am
+++ b/libitm/testsuite/Makefile.am
@@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
+
+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in
index 4d79781..46cdc8b 100644
--- a/libitm/testsuite/Makefile.in
+++ b/libitm/testsuite/Makefile.in
@@ -232,6 +232,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)

RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
all: all-am

.SUFFIXES:
@@ -438,6 +439,10 @@ uninstall-am:
uninstall uninstall-am


+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libitm/testsuite/lib/libitm.exp b/libitm/testsuite/lib/libitm.exp
index 0416296..748f492 100644
--- a/libitm/testsuite/lib/libitm.exp
+++ b/libitm/testsuite/lib/libitm.exp
@@ -74,6 +74,7 @@ proc libitm_init { args } {
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
+ global BUILD_CC
global GCC_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
@@ -89,6 +90,8 @@ proc libitm_init { args } {
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } elseif [info exists BUILD_CC] {
+ set GCC_UNDER_TEST $BUILD_CC
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
58 changes: 58 additions & 0 deletions patches/gcc-6.5.0/0009-libvtv-test-fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff --git a/libvtv/testsuite/Makefile.am b/libvtv/testsuite/Makefile.am
index 561b7e2..2548a1b 100644
--- a/libvtv/testsuite/Makefile.am
+++ b/libvtv/testsuite/Makefile.am
@@ -11,3 +11,9 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
+
+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
diff --git a/libvtv/testsuite/Makefile.in b/libvtv/testsuite/Makefile.in
index e19e13e..6528f38 100644
--- a/libvtv/testsuite/Makefile.in
+++ b/libvtv/testsuite/Makefile.in
@@ -227,6 +227,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)

RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
+EXTRA_DEJAGNU_SITE_CONFIG = extra.exp
all: all-am

.SUFFIXES:
@@ -433,6 +434,10 @@ uninstall-am:
uninstall uninstall-am


+extra.exp:
+ echo 'set BUILD_CC "$(CC)"' > [email protected]
+ mv [email protected] $@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/libvtv/testsuite/lib/libvtv.exp b/libvtv/testsuite/lib/libvtv.exp
index edf5fdd..a596091 100644
--- a/libvtv/testsuite/lib/libvtv.exp
+++ b/libvtv/testsuite/lib/libvtv.exp
@@ -74,6 +74,7 @@ proc libvtv_init { args } {
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
+ global BUILD_CC
global GCC_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
@@ -89,6 +90,8 @@ proc libvtv_init { args } {
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
+ } elseif [info exists BUILD_CC] {
+ set GCC_UNDER_TEST $BUILD_CC
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
Loading

0 comments on commit 7ea4872

Please sign in to comment.