[compiler-rt] e56d680 - [sanitizer] Fix test for GLIBC 2.31

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 13 14:28:48 PST 2021


Author: Vitaly Buka
Date: 2021-11-13T14:28:38-08:00
New Revision: e56d680fe870c293908f7d1ba577d973cc5af5d6

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

LOG: [sanitizer] Fix test for GLIBC 2.31

Newer GLIBC uses sysconf to get SIGSTKSZ.

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 0ffb346ebb450..9853abd2fb32c 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
+// RUN: %clangxx -O2 -ldl %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,6 +12,9 @@
 #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);
   return 0;
 }
 #endif  // defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 16)


        


More information about the llvm-commits mailing list