diff mbox series

Fix libsanitizer bootstrap with glibc 2.26

Message ID 20171103172212.y24p4olbg3cg6zs2@basil.nowhere.org
State New
Headers show
Series Fix libsanitizer bootstrap with glibc 2.26 | expand

Commit Message

Andi Kleen Nov. 3, 2017, 5:22 p.m. UTC
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.

Comments

Andi Kleen Nov. 3, 2017, 5:25 p.m. UTC | #1
On Fri, Nov 03, 2017 at 10:22:12AM -0700, Andi Kleen wrote:
> 
> It looks like some non POSIX symbols got removed from the header
> files, which breaks the libsanitizer build.

nm, looks like i was on a old checkout. Seems to be already fixed
in current trunk.

-Andi
diff mbox series

Patch

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];