summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-7.1/0049-libsanitizer-Use-stack_t-instead-of-struct-sigaltsta.patch
blob: ee15c6cac802fb72401b29a725107d2281ebabd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
From 4c07606bb77bbd30f02adb947d480516da3fa3f7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 11 Jun 2017 10:09:13 -0700
Subject: [PATCH] libsanitizer: Use stack_t instead of struct sigaltstack

Upstream-Status: Submitted

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 libsanitizer/sanitizer_common/sanitizer_linux.cc                    | 4 ++--
 libsanitizer/sanitizer_common/sanitizer_linux.h                     | 6 +++---
 .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc        | 3 ++-
 3 files changed, 7 insertions(+), 6 deletions(-)

Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
===================================================================
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -14,6 +14,10 @@
 
 #if SANITIZER_FREEBSD || SANITIZER_LINUX
 
+#if !SANITIZER_ANDROID
+#include <sys/signal.h>
+#endif
+
 #include "sanitizer_common.h"
 #include "sanitizer_flags.h"
 #include "sanitizer_internal_defs.h"
@@ -71,10 +75,6 @@ extern "C" {
 extern char **environ;  // provided by crt1
 #endif  // SANITIZER_FREEBSD
 
-#if !SANITIZER_ANDROID
-#include <sys/signal.h>
-#endif
-
 #if SANITIZER_LINUX
 // <linux/time.h>
 struct kernel_timeval {
@@ -605,8 +605,8 @@ uptr internal_prctl(int option, uptr arg
 }
 #endif
 
-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const stack_t *ss,
+                         stack_t *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }
 
Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
===================================================================
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux.h
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux.h
@@ -19,7 +19,10 @@
 #include "sanitizer_platform_limits_posix.h"
 
 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;
+
+#ifndef __stack_t_defined
+struct stack_t;
+#endif
 
 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -28,8 +31,8 @@ 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 stack_t* ss,
+                          stack_t* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
     __sanitizer_sigset_t *oldset);
 
Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
===================================================================
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -16,6 +16,7 @@
                         defined(__aarch64__) || defined(__powerpc64__) || \
                         defined(__s390__))
 
+#include <signal.h>
 #include "sanitizer_stoptheworld.h"
 
 #include "sanitizer_platform_limits_posix.h"
@@ -273,7 +274,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;
Index: gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
===================================================================
--- gcc-7.1.0.orig/libsanitizer/tsan/tsan_platform_linux.cc
+++ gcc-7.1.0/libsanitizer/tsan/tsan_platform_linux.cc
@@ -14,6 +14,7 @@
 #include "sanitizer_common/sanitizer_platform.h"
 #if SANITIZER_LINUX || SANITIZER_FREEBSD
 
+#include <signal.h>
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_libc.h"
 #include "sanitizer_common/sanitizer_linux.h"
@@ -28,7 +29,6 @@
 
 #include <fcntl.h>
 #include <pthread.h>
-#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -287,7 +287,7 @@ void InitializePlatform() {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  res_state statp = (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];
Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
===================================================================
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc
@@ -14,6 +14,7 @@
 
 #if SANITIZER_FREEBSD || SANITIZER_LINUX
 
+#include <signal.h>
 #include "sanitizer_allocator_internal.h"
 #include "sanitizer_atomic.h"
 #include "sanitizer_common.h"
@@ -30,7 +31,6 @@
 
 #include <link.h>
 #include <pthread.h>
-#include <signal.h>
 #include <sys/resource.h>
 #include <syslog.h>
 
Index: gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
===================================================================
--- gcc-7.1.0.orig/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ gcc-7.1.0/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
@@ -12,6 +12,7 @@
 
 #include "sanitizer_platform.h"
 #if SANITIZER_POSIX
+#include <signal.h>
 #include "sanitizer_allocator_internal.h"
 #include "sanitizer_common.h"
 #include "sanitizer_flags.h"