[compiler-rt] f52e365 - [sanitizer] Use newfstatat for x32

H.J. Lu via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 15:55:55 PDT 2022


Author: H.J. Lu
Date: 2022-05-04T15:54:42-07:00
New Revision: f52e365092aa08f35b9e2b0d9b8410780c7be39a

URL: https://github.com/llvm/llvm-project/commit/f52e365092aa08f35b9e2b0d9b8410780c7be39a
DIFF: https://github.com/llvm/llvm-project/commit/f52e365092aa08f35b9e2b0d9b8410780c7be39a.diff

LOG: [sanitizer] Use newfstatat for x32

Since newfstatat is supported on x32, use it for x32.

Differential Revision: https://reviews.llvm.org/D124968

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 8e144a4e9a0e8..e2c32d679ad8d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -343,7 +343,7 @@ uptr internal_stat(const char *path, void *buf) {
 #if SANITIZER_FREEBSD
   return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf, 0);
 #    elif SANITIZER_LINUX
-#      if SANITIZER_WORDSIZE == 64
+#      if SANITIZER_WORDSIZE == 64 || SANITIZER_X32
   return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, (uptr)buf,
                           0);
 #      else
@@ -366,7 +366,7 @@ uptr internal_lstat(const char *path, void *buf) {
   return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf,
                           AT_SYMLINK_NOFOLLOW);
 #    elif SANITIZER_LINUX
-#      if defined(_LP64)
+#      if defined(_LP64) || SANITIZER_X32
   return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, (uptr)buf,
                           AT_SYMLINK_NOFOLLOW);
 #      else


        


More information about the llvm-commits mailing list