[PATCH] D32128: [sanitizer] Don't include <linux/user.h> in sanitizer_stoptheworld_linux_libcdep.cc on ARM Android.

Maxim Ostapenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 10:45:21 PDT 2017


m.ostapenko created this revision.
m.ostapenko added a project: Sanitizers.
Herald added subscribers: kubamracek, srhines, rengolin, aemerson.

Turned out that adding defined(__arm__) in sanitizer_stoptheworld_linux_libcdep.cc breaks android arm with some toolchains.

  .../llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc:36:11: fatal error:
        'linux/user.h' file not found
  # include <linux/user.h>  // for pt_regs
            ^
  1 error generated.
  
  Context:
  #if SANITIZER_ANDROID && defined(__arm__)
  # include <linux/user.h>  // for pt_regs
  #else

This patch removes corresponding `#if SANITIZER_ANDROID && defined(__arm__)` and a bit rearranges adjacent сode.
I don't have Android ARM target, so Kostya, could you help me in testing?


Repository:
  rL LLVM

https://reviews.llvm.org/D32128

Files:
  lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc


Index: lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
===================================================================
--- lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -32,17 +32,13 @@
 #include <sys/types.h> // for pid_t
 #include <sys/uio.h> // for iovec
 #include <elf.h> // for NT_PRSTATUS
-#if SANITIZER_ANDROID && defined(__arm__)
-# include <linux/user.h>  // for pt_regs
-#else
-# ifdef __aarch64__
+#if defined(__aarch64__) && !SANITIZER_ANDROID
 // GLIBC 2.20+ sys/user does not include asm/ptrace.h
-#  include <asm/ptrace.h>
-# endif
-# include <sys/user.h>  // for user_regs_struct
-# if SANITIZER_ANDROID && SANITIZER_MIPS
-#   include <asm/reg.h>  // for mips SP register in sys/user.h
-# endif
+# include <asm/ptrace.h>
+#endif
+#include <sys/user.h>  // for user_regs_struct
+#if SANITIZER_ANDROID && SANITIZER_MIPS
+# include <asm/reg.h>  // for mips SP register in sys/user.h
 #endif
 #include <sys/wait.h> // for signal-related stuff
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32128.95449.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170417/d2e42a66/attachment.bin>


More information about the llvm-commits mailing list