[sanitizer] Fix test with GLIBC 2.34

This commit is contained in:
Vitaly Buka 2021-11-14 11:30:13 -08:00
parent 3e0f3041cc
commit dd63c6e6b9
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}