[compiler-rt] 7e980c4 - [sanitizer] Another try to fix the test with GLIBC 2.34

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


Author: Vitaly Buka
Date: 2021-11-14T00:32:23-08:00
New Revision: 7e980c46ed6a9195e221c682f226ac6ad4d227ea

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

LOG: [sanitizer] Another try to fix the 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 9853abd2fb32c..027aca5796542 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,7 +1,6 @@
-// RUN: %clangxx -O2 -ldl %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
 
 #include <stdio.h>
-#include <dlfcn.h>
 
 #if !defined(__GLIBC_PREREQ)
 #define __GLIBC_PREREQ(a, b) 0
@@ -11,10 +10,11 @@
 // glbc version 2.16.
 #if __GLIBC_PREREQ(2, 16)
 extern "C" long sysconf(int name) {
-  fprintf(stderr, "sysconf wrapper called\n");
-  auto *addr = (long(*)(int))dlsym(RTLD_NEXT, "sysconf");
-  if (addr)
-    return (*addr)(name);
+  if (name == 158 /*_SC_SIGSTKSZ */) {
+    // Asan calls it during initialization but late enough to succeed.
+    return 0x10000;
+  }
+  fprintf(stderr, "sysconf wrapper called: %d\n", name);
   return 0;
 }
 #endif  // defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 16)


        


More information about the llvm-commits mailing list