[llvm] bdc4ec0 - [AIX] Avoid use of mtim.tv_nsec member of stat structure on AIX

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 15:30:21 PDT 2021


Author: Hubert Tong
Date: 2021-04-26T18:30:13-04:00
New Revision: bdc4ec04d42a0d9c7db9842754487e97d9778639

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

LOG: [AIX] Avoid use of mtim.tv_nsec member of stat structure on AIX

The value observed for the `mtim.tv_nsec` member is erroneous in some
AIX environments. Avoid using this member by forcing
`HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC` to `0`.

This resolves "mtime changed" errors such as the one
http://lab.llvm.org:8014/#/builders/126/builds/330/steps/5/logs/FAIL__Clang__test_c
has.

Reviewed By: daltenty, jsji

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

Added: 
    

Modified: 
    llvm/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index fa250b917f6fa..dd16d89b7342b 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -280,8 +280,14 @@ endif()
 
 CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC)
-CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec
-    "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+# The st_mtim.tv_nsec member of a `stat` structure is not reliable on some AIX
+# environments.
+  set(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0)
+else()
+  CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec
+      "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
+endif()
 
 check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
 if( LLVM_USING_GLIBC )


        


More information about the llvm-commits mailing list