Cherry picked the gcc commits 14c2f22a1877f6b60a2f7c2f83ffb032759456a6 and 72edc2c02f8b4768ad660f46a1c7e2400c0a8e06 changes and edited to apply with patch_args -p0 --- libgcc/config/aarch64/linux-unwind.h +++ libgcc/config/aarch64/linux-unwind.h @@ -55,7 +55,7 @@ aarch64_fallback_frame_state (struct _Unwind_Context *context, struct rt_sigframe { siginfo_t info; - struct ucontext uc; + ucontext_t uc; }; struct rt_sigframe *rt_; --- libgcc/config/alpha/linux-unwind.h +++ libgcc/config/alpha/linux-unwind.h @@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwind_Context *context, { struct rt_sigframe { siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_ = context->cfa; sc = &rt_->uc.uc_mcontext; } --- libgcc/config/bfin/linux-unwind.h +++ libgcc/config/bfin/linux-unwind.h @@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwind_Context *context, void *puc; char retcode[8]; siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_ = context->cfa; /* The void * cast is necessary to avoid an aliasing warning. --- libgcc/config/i386/linux-unwind.h +++ libgcc/config/i386/linux-unwind.h @@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context, if (*(unsigned char *)(pc+0) == 0x48 && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL) { - struct ucontext *uc_ = context->cfa; + ucontext_t *uc_ = context->cfa; /* The void * cast is necessary to avoid an aliasing warning. The aliasing warning is correct, but should not be a problem because it does not alias anything. */ @@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind_Context *context, siginfo_t *pinfo; void *puc; siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_ = context->cfa; /* The void * cast is necessary to avoid an aliasing warning. The aliasing warning is correct, but should not be a problem --- libgcc/config/m68k/linux-unwind.h +++ libgcc/config/m68k/linux-unwind.h @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* is unfortunately broken right now. */ struct uw_ucontext { unsigned long uc_flags; - struct ucontext *uc_link; + ucontext_t *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; unsigned long uc_filler[80]; --- libgcc/config/nios2/linux-unwind.h +++ libgcc/config/nios2/linux-unwind.h @@ -38,7 +38,7 @@ struct nios2_mcontext { struct nios2_ucontext { unsigned long uc_flags; - struct ucontext *uc_link; + ucontext_t *uc_link; stack_t uc_stack; struct nios2_mcontext uc_mcontext; sigset_t uc_sigmask; /* mask last for extensibility */ --- libgcc/config/pa/linux-unwind.h +++ libgcc/config/pa/linux-unwind.h @@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwind_Context *context, struct sigcontext *sc; struct rt_sigframe { siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *frame; /* rt_sigreturn trampoline: --- libgcc/config/sh/linux-unwind.h +++ libgcc/config/sh/linux-unwind.h @@ -82,7 +82,7 @@ sh_fallback_frame_state (struct _Unwind_Context *context, { struct rt_sigframe { siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_ = context->cfa; /* The void * cast is necessary to avoid an aliasing warning. The aliasing warning is correct, but should not be a problem --- libgcc/config/tilepro/linux-unwind.h +++ libgcc/config/tilepro/linux-unwind.h @@ -61,7 +61,7 @@ tile_fallback_frame_state (struct _Unwind_Context *context, struct rt_sigframe { unsigned char save_area[C_ABI_SAVE_AREA_SIZE]; siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_; /* Return if this is not a signal handler. */ --- libgcc/config/xtensa/linux-unwind.h +++ libgcc/config/xtensa/linux-unwind.h @@ -67,7 +67,7 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context, struct rt_sigframe { siginfo_t info; - struct ucontext uc; + ucontext_t uc; } *rt_; /* movi a2, __NR_rt_sigreturn; syscall */ --- libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 2015-10-21 09:32:45.000000000 +0200 +++ libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc 2017-08-05 18:16:36.004549680 +0200 @@ -267,7 +267,7 @@ // Alternate stack for signal handling. InternalScopedBuffer 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; --- libsanitizer/sanitizer_common/sanitizer_linux.cc 2015-11-23 10:07:18.000000000 +0100 +++ libsanitizer/sanitizer_common/sanitizer_linux.cc 2017-08-05 19:03:06.916498311 +0200 @@ -546,8 +546,7 @@ } #endif -uptr internal_sigaltstack(const struct sigaltstack *ss, - struct sigaltstack *oss) { +uptr internal_sigaltstack(const void *ss, void *oss) { return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); } --- libsanitizer/sanitizer_common/sanitizer_linux.h 2015-10-21 09:32:45.000000000 +0200 +++ libsanitizer/sanitizer_common/sanitizer_linux.h 2017-08-05 19:03:47.631527380 +0200 @@ -20,6 +20,5 @@ struct link_map; // Opaque type returned by dlopen(). -struct sigaltstack; namespace __sanitizer { // Dirent structure for getdents(). Note that this structure is different from @@ -28,8 +29,7 @@ // 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 void* ss, void* oss); uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, __sanitizer_sigset_t *oldset); void internal_sigfillset(__sanitizer_sigset_t *set); --- libsanitizer/tsan/tsan_platform_linux.cc +++ 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]; --- libjava/include/i386-signal.h 2011-12-20 13:18:26.000000000 +0100 +++ libjava/include/i386-signal.h 2017-08-07 16:28:12.038745548 +0200 @@ -29,7 +29,7 @@ #define HANDLE_DIVIDE_OVERFLOW \ do \ { \ - struct ucontext *_uc = (struct ucontext *)_p; \ + ucontext_t *_uc = (ucontext_t *)_p; \ gregset_t &_gregs = _uc->uc_mcontext.gregs; \ unsigned char *_eip = (unsigned char *)_gregs[REG_EIP]; \ \ --- libjava/include/s390-signal.h 2011-01-03 21:52:22.000000000 +0100 +++ libjava/include/s390-signal.h 2017-08-07 16:28:25.206763588 +0200 @@ -51,7 +51,7 @@ struct \ { \ unsigned long int uc_flags; \ - struct ucontext *uc_link; \ + ucontext_t *uc_link; \ stack_t uc_stack; \ mcontext_t uc_mcontext; \ unsigned long sigmask[2]; \ --- libjava/include/x86_64-signal.h 2013-01-04 13:49:55.000000000 +0100 +++ libjava/include/x86_64-signal.h 2017-08-07 16:28:36.446778971 +0200 @@ -28,7 +28,7 @@ #define HANDLE_DIVIDE_OVERFLOW \ do \ { \ - struct ucontext *_uc = (struct ucontext *)_p; \ + ucontext_t *_uc = (ucontext_t *)_p; \ gregset_t &_gregs = _uc->uc_mcontext.gregs; \ unsigned char *_rip = (unsigned char *)_gregs[REG_RIP]; \ \