@ -1,59 +0,0 @@ |
|||
From 594e3c1ab576daddeb86015efc8b1677020b1878 Mon Sep 17 00:00:00 2001 |
|||
From: Szabolcs Nagy <nsz@port70.net> |
|||
Date: Sat, 24 Oct 2015 20:39:30 +0000 |
|||
Subject: [PATCH 1/6] cilkrts |
|||
|
|||
---
|
|||
libcilkrts/runtime/os-unix.c | 22 +++++++--------------- |
|||
1 file changed, 7 insertions(+), 15 deletions(-) |
|||
|
|||
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 |
|||
} |
|||
|
|||
--
|
|||
2.8.1 |
|||
|
@ -1,42 +0,0 @@ |
|||
From bab47fac06af5d891caaccac99f1dc1e75bdc219 Mon Sep 17 00:00:00 2001 |
|||
From: Szabolcs Nagy <nsz@port70.net> |
|||
Date: Sat, 1 Aug 2015 23:24:07 +0000 |
|||
Subject: [PATCH 2/6] posix_memalign |
|||
|
|||
---
|
|||
gcc/config/i386/pmm_malloc.h | 9 +++++---- |
|||
1 file changed, 5 insertions(+), 4 deletions(-) |
|||
|
|||
diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
|
|||
index a1f98d3..4f6b2dc 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; |
|||
--
|
|||
2.8.1 |
|||
|
@ -1,56 +0,0 @@ |
|||
From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001 |
|||
From: Szabolcs Nagy <nsz@port70.net> |
|||
Date: Sat, 24 Oct 2015 20:09:53 +0000 |
|||
Subject: [PATCH 3/6] libgcc_s |
|||
|
|||
---
|
|||
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 3d044e8..82523e1 100644
|
|||
--- a/gcc/config/i386/i386.c
|
|||
+++ b/gcc/config/i386/i386.c
|
|||
@@ -40269,10 +40269,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.8.1 |
|||
|
@ -1,25 +0,0 @@ |
|||
From edec78452d693fb524daa9a6efd45c850b27b25c Mon Sep 17 00:00:00 2001 |
|||
From: Szabolcs Nagy <nsz@port70.net> |
|||
Date: Fri, 6 Nov 2015 23:59:20 +0000 |
|||
Subject: [PATCH 4/6] linux_libc_has_function |
|||
|
|||
---
|
|||
gcc/config/linux.c | 2 +- |
|||
1 file changed, 1 insertion(+), 1 deletion(-) |
|||
|
|||
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 |
|||
--
|
|||
2.8.1 |
|||
|
@ -1,75 +0,0 @@ |
|||
From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001 |
|||
From: Szabolcs Nagy <nsz@port70.net> |
|||
Date: Sat, 7 Nov 2015 02:08:05 +0000 |
|||
Subject: [PATCH 5/6] nopie |
|||
|
|||
---
|
|||
gcc/configure | 27 +++++++++++++++++++++++++++ |
|||
gcc/configure.ac | 13 +++++++++++++ |
|||
2 files changed, 40 insertions(+) |
|||
|
|||
diff --git a/gcc/configure b/gcc/configure
|
|||
index 1c6e340..7e8b5d6 100755
|
|||
--- a/gcc/configure
|
|||
+++ b/gcc/configure
|
|||
@@ -29390,6 +29390,33 @@ fi
|
|||
$as_echo "$gcc_cv_no_pie" >&6; } |
|||
if test "$gcc_cv_no_pie" = "yes"; then |
|||
NO_PIE_FLAG="-no-pie" |
|||
+else
|
|||
+ # Check if -nopie works.
|
|||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
|
|||
+$as_echo_n "checking for -nopie option... " >&6; }
|
|||
+if test "${gcc_cv_nopie+set}" = set; then :
|
|||
+ $as_echo_n "(cached) " >&6
|
|||
+else
|
|||
+ saved_LDFLAGS="$LDFLAGS"
|
|||
+ LDFLAGS="$LDFLAGS -nopie"
|
|||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|||
+/* end confdefs.h. */
|
|||
+int main(void) {return 0;}
|
|||
+_ACEOF
|
|||
+if ac_fn_cxx_try_link "$LINENO"; then :
|
|||
+ gcc_cv_nopie=yes
|
|||
+else
|
|||
+ gcc_cv_nopie=no
|
|||
+fi
|
|||
+rm -f core conftest.err conftest.$ac_objext \
|
|||
+ conftest$ac_exeext conftest.$ac_ext
|
|||
+ LDFLAGS="$saved_LDFLAGS"
|
|||
+fi
|
|||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
|
|||
+$as_echo "$gcc_cv_nopie" >&6; }
|
|||
+ if test "$gcc_cv_nopie" = "yes"; then
|
|||
+ NO_PIE_FLAG="-nopie"
|
|||
+ fi
|
|||
fi |
|||
|
|||
|
|||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
|||
index 6c1dcd9..0ca7647 100644
|
|||
--- a/gcc/configure.ac
|
|||
+++ b/gcc/configure.ac
|
|||
@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option],
|
|||
LDFLAGS="$saved_LDFLAGS"]) |
|||
if test "$gcc_cv_no_pie" = "yes"; then |
|||
NO_PIE_FLAG="-no-pie" |
|||
+else
|
|||
+ # Check if -nopie works.
|
|||
+ AC_CACHE_CHECK([for -nopie option],
|
|||
+ [gcc_cv_nopie],
|
|||
+ [saved_LDFLAGS="$LDFLAGS"
|
|||
+ LDFLAGS="$LDFLAGS -nopie"
|
|||
+ AC_LINK_IFELSE([int main(void) {return 0;}],
|
|||
+ [gcc_cv_nopie=yes],
|
|||
+ [gcc_cv_nopie=no])
|
|||
+ LDFLAGS="$saved_LDFLAGS"])
|
|||
+ if test "$gcc_cv_nopie" = "yes"; then
|
|||
+ NO_PIE_FLAG="-nopie"
|
|||
+ fi
|
|||
fi |
|||
AC_SUBST([NO_PIE_FLAG]) |
|||
|
|||
--
|
|||
2.8.1 |
|||
|