[sanitizer] Fix test for GLIBC 2.31

Newer GLIBC uses sysconf to get SIGSTKSZ.
This commit is contained in:
Vitaly Buka 2021-11-13 14:24:50 -08:00
parent 6a40854ce5
commit e56d680fe8
1 changed files with 5 additions and 1 deletions

View File

@ -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)