[PATCH] Fix libsanitizer bootstrap with glibc 2.26
Andi Kleen
andi@firstfloor.org
Fri Nov 3 17:22:00 GMT 2017
It looks like some non POSIX symbols got removed from the header
files, which breaks the libsanitizer build.
struct sigaltstack now only exists as stack_t (which is the offical
POSIX name)
__res_state typedef is now only struct __res_state
This fixes bootstrap of trunk on a current opensuse tumbleweed system.
I realize this is a downstream version, but fixing bootstrap is rather
important.
Now passes bootstrap with this patch.
libsanitizer/:
2017-11-03 Andi Kleen <ak@linux.intel.com>
* sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
(TracerThread): Use stack_t instead of struct sigaltstack
* tsan/tsan_platform_linux.cc (ExtractResolvFDs):
Use struct __res_state instead of __res_state.
diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 891386dc0ba..14dedcae64f 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -273,11 +273,11 @@ 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;
- internal_sigaltstack(&handler_stack, nullptr);
+ internal_sigaltstack((struct sigaltstack *)&handler_stack, nullptr);
// Install our handler for synchronous signals. Other signals should be
// blocked by the mask we inherited from the parent thread.
diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
index 2ed5718a12e..6f972ab0dd6 100644
--- a/libsanitizer/tsan/tsan_platform_linux.cc
+++ b/libsanitizer/tsan/tsan_platform_linux.cc
@@ -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;
+ 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];
More information about the Gcc-patches
mailing list