gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / clang-runtime-asan-build-fixes.patch
1 This patch works around build issues in libsanitizer. Note that we carry the
2 same patches for GCC since it includes the same libsanitizer.
3
4 Work around this build error on glibc 2.26:
5
6 /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)':
7 /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
8
9 diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
10 index c504168..59087b9 100644
11 --- a/lib/asan/asan_linux.cc
12 +++ b/lib/asan/asan_linux.cc
13 @@ -29,6 +29,7 @@
14 #include <dlfcn.h>
15 #include <fcntl.h>
16 #include <pthread.h>
17 +#include <signal.h>
18 #include <stdio.h>
19 #include <unistd.h>
20 #include <unwind.h>
21
22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 Now, work around this other error:
24
25 /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*)':
26 /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
27
28
29 diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
30 index 2cefa20..223d9c6 100644
31 --- a/lib/sanitizer_common/sanitizer_linux.cc
32 +++ b/lib/sanitizer_common/sanitizer_linux.cc
33 @@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
34 }
35 #endif
36
37 -uptr internal_sigaltstack(const struct sigaltstack *ss,
38 - struct sigaltstack *oss) {
39 +uptr internal_sigaltstack(const void *ss, void *oss) {
40 return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
41 }
42
43 diff --git a/lib/sanitizer_common/sanitizer_linux.h b/lib/sanitizer_common/sanitizer_linux.h
44 index 4497702..1594058 100644
45 --- a/lib/sanitizer_common/sanitizer_linux.h
46 +++ b/lib/sanitizer_common/sanitizer_linux.h
47 @@ -19,7 +19,6 @@
48 #include "sanitizer_platform_limits_posix.h"
49
50 struct link_map; // Opaque type returned by dlopen().
51 -struct sigaltstack;
52
53 namespace __sanitizer {
54 // Dirent structure for getdents(). Note that this structure is different from
55 @@ -28,8 +27,7 @@ struct linux_dirent;
56
57 // Syscall wrappers.
58 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
59 -uptr internal_sigaltstack(const struct sigaltstack* ss,
60 - struct sigaltstack* oss);
61 +uptr internal_sigaltstack(const void* ss, void* oss);
62 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
63 __sanitizer_sigset_t *oldset);
64 void internal_sigfillset(__sanitizer_sigset_t *set);
65 diff --git a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
66 index c919e4f..014162af 100644
67 --- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
68 +++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
69 @@ -267,7 +267,7 @@ static int TracerThread(void* argument) {
70
71 // Alternate stack for signal handling.
72 InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
73 - struct sigaltstack handler_stack;
74 + stack_t handler_stack;
75 internal_memset(&handler_stack, 0, sizeof(handler_stack));
76 handler_stack.ss_sp = handler_stack_memory.data();
77 handler_stack.ss_size = kHandlerStackSize;
78 diff --git a/lib/tsan/tsan_platform_linux.cc b/lib/tsan/tsan_platform_linux.cc
79 index 09cec5f..908f4fe 100644
80 --- a/lib/tsan/rtl/tsan_platform_linux.cc
81 +++ b/lib/tsan/rtl/tsan_platform_linux.cc
82 @@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) {
83 int ExtractResolvFDs(void *state, int *fds, int nfd) {
84 #if SANITIZER_LINUX
85 int cnt = 0;
86 - __res_state *statp = (__res_state*)state;
87 + struct __res_state *statp = (struct __res_state*)state;
88 for (int i = 0; i < MAXNS && cnt < nfd; i++) {
89 if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
90 fds[cnt++] = statp->_u._ext.nssocks[i];
91 --
92 2.9.3