gnu: clang-runtime: Fix build issues against glibc 2.26.
* gnu/packages/patches/clang-runtime-asan-build-fixes.patch, gnu/packages/patches/clang-runtime-esan-build-fixes.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/llvm.scm (clang-runtime-from-llvm): Add 'patches' parameter and honor it. (clang-runtime): Pass patch list. (clang-runtime-3.9.1, clang-runtime-3.7, clang-runtime-3.6) (clang-runtime-3.5): Likewise.
This commit is contained in:
parent
59377c9e12
commit
6b26f9152c
@ -576,6 +576,8 @@ dist_patch_DATA = \
|
||||
%D%/packages/patches/chmlib-inttypes.patch \
|
||||
%D%/packages/patches/clang-libc-search-path.patch \
|
||||
%D%/packages/patches/clang-3.8-libc-search-path.patch \
|
||||
%D%/packages/patches/clang-runtime-asan-build-fixes.patch \
|
||||
%D%/packages/patches/clang-runtime-esan-build-fixes.patch \
|
||||
%D%/packages/patches/clementine-use-openssl.patch \
|
||||
%D%/packages/patches/clisp-remove-failing-test.patch \
|
||||
%D%/packages/patches/clucene-pkgconfig.patch \
|
||||
|
@ -1,7 +1,7 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
|
||||
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2016 Dennis Mungai <dmngaie@gmail.com>
|
||||
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
|
||||
@ -98,7 +98,8 @@ of programming tools as well as libraries with equivalent functionality.")
|
||||
"-DLLVM_REQUIRES_RTTI=1")
|
||||
,flags))))))
|
||||
|
||||
(define (clang-runtime-from-llvm llvm hash)
|
||||
(define* (clang-runtime-from-llvm llvm hash
|
||||
#:optional (patches '()))
|
||||
(package
|
||||
(name "clang-runtime")
|
||||
(version (package-version llvm))
|
||||
@ -107,7 +108,8 @@ of programming tools as well as libraries with equivalent functionality.")
|
||||
(method url-fetch)
|
||||
(uri (string-append "http://llvm.org/releases/"
|
||||
version "/compiler-rt-" version ".src.tar.xz"))
|
||||
(sha256 (base32 hash))))
|
||||
(sha256 (base32 hash))
|
||||
(patches (map search-patch patches))))
|
||||
(build-system cmake-build-system)
|
||||
(native-inputs (package-native-inputs llvm))
|
||||
(inputs
|
||||
@ -212,7 +214,8 @@ code analysis tools.")
|
||||
(define-public clang-runtime
|
||||
(clang-runtime-from-llvm
|
||||
llvm
|
||||
"0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"))
|
||||
"0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"
|
||||
'("clang-runtime-asan-build-fixes.patch")))
|
||||
|
||||
(define-public clang
|
||||
(clang-from-llvm llvm clang-runtime
|
||||
@ -235,7 +238,9 @@ code analysis tools.")
|
||||
(define-public clang-runtime-3.9.1
|
||||
(clang-runtime-from-llvm
|
||||
llvm-3.9.1
|
||||
"16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"))
|
||||
"16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"
|
||||
'("clang-runtime-asan-build-fixes.patch"
|
||||
"clang-runtime-esan-build-fixes.patch")))
|
||||
|
||||
(define-public clang-3.9.1
|
||||
(clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1
|
||||
@ -257,7 +262,8 @@ code analysis tools.")
|
||||
(define-public clang-runtime-3.7
|
||||
(clang-runtime-from-llvm
|
||||
llvm-3.7
|
||||
"10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"))
|
||||
"10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"
|
||||
'("clang-runtime-asan-build-fixes.patch")))
|
||||
|
||||
(define-public clang-3.7
|
||||
(clang-from-llvm llvm-3.7 clang-runtime-3.7
|
||||
@ -278,7 +284,8 @@ code analysis tools.")
|
||||
(define-public clang-runtime-3.6
|
||||
(clang-runtime-from-llvm
|
||||
llvm-3.6
|
||||
"11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"))
|
||||
"11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"
|
||||
'("clang-runtime-asan-build-fixes.patch")))
|
||||
|
||||
(define-public clang-3.6
|
||||
(clang-from-llvm llvm-3.6 clang-runtime-3.6
|
||||
@ -301,7 +308,8 @@ code analysis tools.")
|
||||
(define-public clang-runtime-3.5
|
||||
(clang-runtime-from-llvm
|
||||
llvm-3.5
|
||||
"1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal"))
|
||||
"1hsdnzzdr5kglz6fnv3lcsjs222zjsy14y8ax9dy6zqysanplbal"
|
||||
'("clang-runtime-asan-build-fixes.patch")))
|
||||
|
||||
(define-public clang-3.5
|
||||
(clang-from-llvm llvm-3.5 clang-runtime-3.5
|
||||
|
92
gnu/packages/patches/clang-runtime-asan-build-fixes.patch
Normal file
92
gnu/packages/patches/clang-runtime-asan-build-fixes.patch
Normal file
@ -0,0 +1,92 @@
|
||||
This patch works around build issues in libsanitizer. Note that we carry the
|
||||
same patches for GCC since it includes the same libsanitizer.
|
||||
|
||||
Work around this build error on glibc 2.26:
|
||||
|
||||
/tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc: In function 'bool __asan::AsanInterceptsSignal(int)':
|
||||
/tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/asan/asan_linux.cc:224:20: error: 'SIGSEGV' was not declared in this scope
|
||||
|
||||
diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
|
||||
index c504168..59087b9 100644
|
||||
--- a/lib/asan/asan_linux.cc
|
||||
+++ b/lib/asan/asan_linux.cc
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
+#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <unwind.h>
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Now, work around this other error:
|
||||
|
||||
/tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: In function 'int __sanitizer::TracerThread(void*)':
|
||||
/tmp/guix-build-clang-runtime-3.5.2.drv-0/compiler-rt-3.5.2.src/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:239:22: error: aggregate 'sigaltstack handler_stack' has incomplete type and cannot be defined
|
||||
|
||||
|
||||
diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
|
||||
index 2cefa20..223d9c6 100644
|
||||
--- a/lib/sanitizer_common/sanitizer_linux.cc
|
||||
+++ b/lib/sanitizer_common/sanitizer_linux.cc
|
||||
@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
|
||||
}
|
||||
#endif
|
||||
|
||||
-uptr internal_sigaltstack(const struct sigaltstack *ss,
|
||||
- struct sigaltstack *oss) {
|
||||
+uptr internal_sigaltstack(const void *ss, void *oss) {
|
||||
return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
|
||||
}
|
||||
|
||||
diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h
|
||||
index 4497702..1594058 100644
|
||||
--- a/lib/sanitizer_common/sanitizer_linux.h
|
||||
+++ b/lib/sanitizer_common/sanitizer_linux.h
|
||||
@@ -19,7 +19,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_sigaltstack(const struct sigaltstack* ss,
|
||||
- struct sigaltstack* oss);
|
||||
+uptr internal_sigaltstack(const void* ss, void* oss);
|
||||
uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
|
||||
__sanitizer_sigset_t *oldset);
|
||||
void internal_sigfillset(__sanitizer_sigset_t *set);
|
||||
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
|
||||
index c919e4f..014162af 100644
|
||||
--- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
|
||||
+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
|
||||
@@ -267,7 +267,7 @@ static int TracerThread(void* argument) {
|
||||
|
||||
// Alternate stack for signal handling.
|
||||
InternalScopedBuffer<char> 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/lib/tsan/tsan_platform_linux.cc b/lib/tsan/tsan_platform_linux.cc
|
||||
index 09cec5f..908f4fe 100644
|
||||
--- a/lib/tsan/rtl/tsan_platform_linux.cc
|
||||
+++ b/lib/tsan/rtl/tsan_platform_linux.cc
|
||||
@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) {
|
||||
int ExtractResolvFDs(void *state, int *fds, int nfd) {
|
||||
#if SANITIZER_LINUX
|
||||
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];
|
||||
--
|
||||
2.9.3
|
19
gnu/packages/patches/clang-runtime-esan-build-fixes.patch
Normal file
19
gnu/packages/patches/clang-runtime-esan-build-fixes.patch
Normal file
@ -0,0 +1,19 @@
|
||||
Fix esan compilation against glibc 2.26:
|
||||
|
||||
/tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp: In static member function ‘static int __esan::SidelineThread::runSideline(void*)’:
|
||||
/tmp/guix-build-clang-runtime-3.9.1.drv-0/compiler-rt-3.9.1.src/lib/esan/esan_sideline_linux.cpp:73:22: error: aggregate ‘__esan::SidelineThread::runSideline(void*)::sigaltstack SigAltStack’ has incomplete type and cannot be defined
|
||||
|
||||
Patch from <https://github.com/google/sanitizers/issues/822>.
|
||||
|
||||
index d04f5909d..bc272dfe4 100644
|
||||
--- a/lib/esan/esan_sideline_linux.cpp
|
||||
+++ b/lib/esan/esan_sideline_linux.cpp
|
||||
@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) {
|
||||
|
||||
// Set up a signal handler on an alternate stack for safety.
|
||||
InternalScopedBuffer<char> StackMap(SigAltStackSize);
|
||||
- struct sigaltstack SigAltStack;
|
||||
+ stack_t SigAltStack;
|
||||
SigAltStack.ss_sp = StackMap.data();
|
||||
SigAltStack.ss_size = SigAltStackSize;
|
||||
SigAltStack.ss_flags = 0;
|
Loading…
Reference in New Issue
Block a user