diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-06-11 10:15:44 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-11 15:57:08 +0100 |
| commit | 8cf90598628039f6912cc44420b29af9c9cec6c3 (patch) | |
| tree | 615d83e9ead958d9342fc7be5f4926793ce74453 /meta/recipes-devtools/gcc | |
| parent | 16cb2a0764c643cfa90b393865b70c61dc7a58b3 (diff) | |
| download | poky-8cf90598628039f6912cc44420b29af9c9cec6c3.tar.gz | |
gcc-sanitizer: Fix build with glibc 2.26
sigaltstack is no more exposed by glibc see (bug 21517)
therefore adjust to use stack_t instead
Use res_state typedef instead of referring to __res_state struct
(From OE-Core rev: c5cb3a582531dd1b9c40df5bcaa6f8bf5b451a54)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-7.1.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-7.1/0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch | 160 |
2 files changed, 161 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.1.inc b/meta/recipes-devtools/gcc/gcc-7.1.inc index 96fc11c943..f30a73c31c 100644 --- a/meta/recipes-devtools/gcc/gcc-7.1.inc +++ b/meta/recipes-devtools/gcc/gcc-7.1.inc | |||
| @@ -73,6 +73,7 @@ SRC_URI = "\ | |||
| 73 | file://0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ | 73 | file://0046-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ |
| 74 | file://0047-sync-gcc-stddef.h-with-musl.patch \ | 74 | file://0047-sync-gcc-stddef.h-with-musl.patch \ |
| 75 | file://0048-gcc-Enable-static-PIE.patch \ | 75 | file://0048-gcc-Enable-static-PIE.patch \ |
| 76 | file://0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch \ | ||
| 76 | ${BACKPORTS} \ | 77 | ${BACKPORTS} \ |
| 77 | " | 78 | " |
| 78 | BACKPORTS = "\ | 79 | BACKPORTS = "\ |
diff --git a/meta/recipes-devtools/gcc/gcc-7.1/0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch b/meta/recipes-devtools/gcc/gcc-7.1/0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch new file mode 100644 index 0000000000..ee15c6cac8 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-7.1/0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | From 4c07606bb77bbd30f02adb947d480516da3fa3f7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sun, 11 Jun 2017 10:09:13 -0700 | ||
| 4 | Subject: [PATCH] libsanitizer: Use stack_t instead of struct sigaltstack | ||
| 5 | |||
| 6 | Upstream-Status: Submitted | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | libsanitizer/sanitizer_common/sanitizer_linux.cc | 4 ++-- | ||
| 11 | libsanitizer/sanitizer_common/sanitizer_linux.h | 6 +++--- | ||
| 12 | .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 3 ++- | ||
| 13 | 3 files changed, 7 insertions(+), 6 deletions(-) | ||
| 14 | |||
| 15 | Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc | ||
| 16 | =================================================================== | ||
| 17 | --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.cc | ||
| 18 | +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc | ||
| 19 | @@ -14,6 +14,10 @@ | ||
| 20 | |||
| 21 | #if SANITIZER_FREEBSD || SANITIZER_LINUX | ||
| 22 | |||
| 23 | +#if !SANITIZER_ANDROID | ||
| 24 | +#include <sys/signal.h> | ||
| 25 | +#endif | ||
| 26 | + | ||
| 27 | #include "sanitizer_common.h" | ||
| 28 | #include "sanitizer_flags.h" | ||
| 29 | #include "sanitizer_internal_defs.h" | ||
| 30 | @@ -71,10 +75,6 @@ extern "C" { | ||
| 31 | extern char **environ; // provided by crt1 | ||
| 32 | #endif // SANITIZER_FREEBSD | ||
| 33 | |||
| 34 | -#if !SANITIZER_ANDROID | ||
| 35 | -#include <sys/signal.h> | ||
| 36 | -#endif | ||
| 37 | - | ||
| 38 | #if SANITIZER_LINUX | ||
| 39 | // <linux/time.h> | ||
| 40 | struct kernel_timeval { | ||
| 41 | @@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg | ||
| 42 | } | ||
| 43 | #endif | ||
| 44 | |||
| 45 | -uptr internal_sigaltstack(const struct sigaltstack *ss, | ||
| 46 | - struct sigaltstack *oss) { | ||
| 47 | +uptr internal_sigaltstack(const stack_t *ss, | ||
| 48 | + stack_t *oss) { | ||
| 49 | return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); | ||
| 50 | } | ||
| 51 | |||
| 52 | Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h | ||
| 53 | =================================================================== | ||
| 54 | --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.h | ||
| 55 | +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h | ||
| 56 | @@ -19,7 +19,10 @@ | ||
| 57 | #include "sanitizer_platform_limits_posix.h" | ||
| 58 | |||
| 59 | struct link_map; // Opaque type returned by dlopen(). | ||
| 60 | -struct sigaltstack; | ||
| 61 | + | ||
| 62 | +#ifndef __stack_t_defined | ||
| 63 | +struct stack_t; | ||
| 64 | +#endif | ||
| 65 | |||
| 66 | namespace __sanitizer { | ||
| 67 | // Dirent structure for getdents(). Note that this structure is different from | ||
| 68 | @@ -28,8 +31,8 @@ struct linux_dirent; | ||
| 69 | |||
| 70 | // Syscall wrappers. | ||
| 71 | uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); | ||
| 72 | -uptr internal_sigaltstack(const struct sigaltstack* ss, | ||
| 73 | - struct sigaltstack* oss); | ||
| 74 | +uptr internal_sigaltstack(const stack_t* ss, | ||
| 75 | + stack_t* oss); | ||
| 76 | uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, | ||
| 77 | __sanitizer_sigset_t *oldset); | ||
| 78 | |||
| 79 | Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | ||
| 80 | =================================================================== | ||
| 81 | --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | ||
| 82 | +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | ||
| 83 | @@ -16,6 +16,7 @@ | ||
| 84 | defined(__aarch64__) || defined(__powerpc64__) || \ | ||
| 85 | defined(__s390__)) | ||
| 86 | |||
| 87 | +#include <signal.h> | ||
| 88 | #include "sanitizer_stoptheworld.h" | ||
| 89 | |||
| 90 | #include "sanitizer_platform_limits_posix.h" | ||
| 91 | @@ -273,7 +274,7 @@ static int TracerThread(void* argument) | ||
| 92 | |||
| 93 | // Alternate stack for signal handling. | ||
| 94 | InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize); | ||
| 95 | - struct sigaltstack handler_stack; | ||
| 96 | + stack_t handler_stack; | ||
| 97 | internal_memset(&handler_stack, 0, sizeof(handler_stack)); | ||
| 98 | handler_stack.ss_sp = handler_stack_memory.data(); | ||
| 99 | handler_stack.ss_size = kHandlerStackSize; | ||
| 100 | Index: gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc | ||
| 101 | =================================================================== | ||
| 102 | --- gcc-7.1.0.orig/libsanitizer/tsan/tsan_platform_linux.cc | ||
| 103 | +++ gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc | ||
| 104 | @@ -14,6 +14,7 @@ | ||
| 105 | #include "sanitizer_common/sanitizer_platform.h" | ||
| 106 | #if SANITIZER_LINUX || SANITIZER_FREEBSD | ||
| 107 | |||
| 108 | +#include <signal.h> | ||
| 109 | #include "sanitizer_common/sanitizer_common.h" | ||
| 110 | #include "sanitizer_common/sanitizer_libc.h" | ||
| 111 | #include "sanitizer_common/sanitizer_linux.h" | ||
| 112 | @@ -28,7 +29,6 @@ | ||
| 113 | |||
| 114 | #include <fcntl.h> | ||
| 115 | #include <pthread.h> | ||
| 116 | -#include <signal.h> | ||
| 117 | #include <stdio.h> | ||
| 118 | #include <stdlib.h> | ||
| 119 | #include <string.h> | ||
| 120 | @@ -287,7 +287,7 @@ void InitializePlatform() { | ||
| 121 | int ExtractResolvFDs(void *state, int *fds, int nfd) { | ||
| 122 | #if SANITIZER_LINUX && !SANITIZER_ANDROID | ||
| 123 | int cnt = 0; | ||
| 124 | - __res_state *statp = (__res_state*)state; | ||
| 125 | + res_state statp = (res_state)state; | ||
| 126 | for (int i = 0; i < MAXNS && cnt < nfd; i++) { | ||
| 127 | if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) | ||
| 128 | fds[cnt++] = statp->_u._ext.nssocks[i]; | ||
| 129 | Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc | ||
| 130 | =================================================================== | ||
| 131 | --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc | ||
| 132 | +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc | ||
| 133 | @@ -14,6 +14,7 @@ | ||
| 134 | |||
| 135 | #if SANITIZER_FREEBSD || SANITIZER_LINUX | ||
| 136 | |||
| 137 | +#include <signal.h> | ||
| 138 | #include "sanitizer_allocator_internal.h" | ||
| 139 | #include "sanitizer_atomic.h" | ||
| 140 | #include "sanitizer_common.h" | ||
| 141 | @@ -30,7 +31,6 @@ | ||
| 142 | |||
| 143 | #include <link.h> | ||
| 144 | #include <pthread.h> | ||
| 145 | -#include <signal.h> | ||
| 146 | #include <sys/resource.h> | ||
| 147 | #include <syslog.h> | ||
| 148 | |||
| 149 | Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | ||
| 150 | =================================================================== | ||
| 151 | --- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | ||
| 152 | +++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc | ||
| 153 | @@ -12,6 +12,7 @@ | ||
| 154 | |||
| 155 | #include "sanitizer_platform.h" | ||
| 156 | #if SANITIZER_POSIX | ||
| 157 | +#include <signal.h> | ||
| 158 | #include "sanitizer_allocator_internal.h" | ||
| 159 | #include "sanitizer_common.h" | ||
| 160 | #include "sanitizer_flags.h" | ||
