mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-15 19:35:25 -05:00
6b26f9152c
* 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.
92 lines
4 KiB
Diff
92 lines
4 KiB
Diff
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
|