[compiler-rt] dd63c6e - [sanitizer] Fix test with GLIBC 2.34

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 14 11:31:00 PST 2021


Author: Vitaly Buka
Date: 2021-11-14T11:30:50-08:00
New Revision: dd63c6e6b97b83487e6549ce4f86d031e37a6f92

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

LOG: [sanitizer] Fix test with GLIBC 2.34

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/sysconf_interceptor_bypass_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/sysconf_interceptor_bypass_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/sysconf_interceptor_bypass_test.cpp
index 027aca5796542..5e6bbad95451f 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/sysconf_interceptor_bypass_test.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/sysconf_interceptor_bypass_test.cpp
@@ -1,6 +1,7 @@
 // RUN: %clangxx -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>
+#include <unistd.h>
 
 #if !defined(__GLIBC_PREREQ)
 #define __GLIBC_PREREQ(a, b) 0
@@ -10,10 +11,11 @@
 // glbc version 2.16.
 #if __GLIBC_PREREQ(2, 16)
 extern "C" long sysconf(int name) {
-  if (name == 158 /*_SC_SIGSTKSZ */) {
-    // Asan calls it during initialization but late enough to succeed.
+#  ifdef _SC_SIGSTKSZ
+  // Asan needs this one during initialization but late enough to succeed.
+  if (name == _SC_SIGSTKSZ)
     return 0x10000;
-  }
+#  endif
   fprintf(stderr, "sysconf wrapper called: %d\n", name);
   return 0;
 }


        


More information about the llvm-commits mailing list