From d65930708f1a55d9c1ecdb53e189d154902b0f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 17 Feb 2018 23:34:47 +0100 Subject: [PATCH] gnu: gcc@4.9: Fix libsanitizer compilation with glibc 2.26. * gnu/packages/patches/gcc-4.9-libsanitizer-fix.patch: New file. * gnu/packages/gcc.scm (gcc-4.9)[source](patches): Add it. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/gcc.scm | 5 +- .../patches/gcc-4.9-libsanitizer-fix.patch | 66 +++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/gcc-4.9-libsanitizer-fix.patch diff --git a/gnu/local.mk b/gnu/local.mk index a9cbc733be..2e5d44d821 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -662,6 +662,7 @@ dist_patch_DATA = \ %D%/packages/patches/gcc-asan-missing-include.patch \ %D%/packages/patches/gcc-cross-environment-variables.patch \ %D%/packages/patches/gcc-fix-texi2pod.patch \ + %D%/packages/patches/gcc-4.9-libsanitizer-fix.patch \ %D%/packages/patches/gcc-libsanitizer-fix.patch \ %D%/packages/patches/gcc-libvtv-runpath.patch \ %D%/packages/patches/gcc-strmov-store-file-names.patch \ diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 2c7650d3f1..62b8968823 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2014, 2015, 2018 Mark H Weaver ;;; Copyright © 2014, 2015, 2016, 2017 Ricardo Wurmus ;;; Copyright © 2015 Andreas Enge @@ -392,7 +392,8 @@ (define-public gcc-4.9 (sha256 (base32 "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc")) - (patches (search-patches "gcc-arm-bug-71399.patch" + (patches (search-patches "gcc-4.9-libsanitizer-fix.patch" + "gcc-arm-bug-71399.patch" "gcc-asan-missing-include.patch" "gcc-libvtv-runpath.patch" "gcc-fix-texi2pod.patch")) diff --git a/gnu/packages/patches/gcc-4.9-libsanitizer-fix.patch b/gnu/packages/patches/gcc-4.9-libsanitizer-fix.patch new file mode 100644 index 0000000000..e76caf3e11 --- /dev/null +++ b/gnu/packages/patches/gcc-4.9-libsanitizer-fix.patch @@ -0,0 +1,66 @@ +This is a backport of this patch from 6.5 to 4.9: + + https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=8937b94d1a643fd9760714642296d034a45254a8 + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc +index 69c9c10..8e53673 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc +@@ -599,8 +599,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { + return internal_syscall(__NR_prctl, option, arg2, arg3, arg4, arg5); + } + +-uptr internal_sigaltstack(const struct sigaltstack *ss, +- struct sigaltstack *oss) { ++uptr internal_sigaltstack(const void *ss, void *oss) { + return internal_syscall(__NR_sigaltstack, (uptr)ss, (uptr)oss); + } + +diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h +index 6422df1..8a8e526 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.h ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h +@@ -18,7 +18,6 @@ + #include "sanitizer_platform_limits_posix.h" + + struct link_map; // Opaque type returned by dlopen(). +-struct sigaltstack; + + namespace __sanitizer { + // Dirent structure for getdents(). Note that this structure is different from +@@ -28,8 +27,7 @@ struct linux_dirent; + // Syscall wrappers. + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); + uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5); +-uptr internal_sigaltstack(const struct sigaltstack* ss, +- struct sigaltstack* oss); ++uptr internal_sigaltstack(const void *ss, void *oss); + uptr internal_sigaction(int signum, const __sanitizer_kernel_sigaction_t *act, + __sanitizer_kernel_sigaction_t *oldact); + uptr internal_sigprocmask(int how, __sanitizer_kernel_sigset_t *set, +diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +index 6ee63ec..50c21a3 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc +@@ -238,7 +238,7 @@ static int TracerThread(void* argument) { + + // Alternate stack for signal handling. + InternalScopedBuffer handler_stack_memory(kHandlerStackSize); +- struct sigaltstack handler_stack; ++ stack_t handler_stack; + internal_memset(&handler_stack, 0, sizeof(handler_stack)); + handler_stack.ss_sp = handler_stack_memory.data(); + handler_stack.ss_size = kHandlerStackSize; +diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc +index fe69430..49f5270 100644 +--- a/libsanitizer/tsan/tsan_platform_linux.cc ++++ b/libsanitizer/tsan/tsan_platform_linux.cc +@@ -351,7 +351,7 @@ bool IsGlobalVar(uptr addr) { + // closes within glibc. The code is a pure hack. + int ExtractResolvFDs(void *state, int *fds, int nfd) { + int cnt = 0; +- __res_state *statp = (__res_state*)state; ++ struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { + if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) + fds[cnt++] = statp->_u._ext.nssocks[i];