]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/sanitizer_common/sanitizer_getauxval.h
Upgrade Unbound to 1.8.0. More to follow.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / sanitizer_common / sanitizer_getauxval.h
1 //===-- sanitizer_getauxval.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Common getauxval() guards and definitions.
11 // getauxval() is not defined until glibc version 2.16, or until API level 21
12 // for Android.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef SANITIZER_GETAUXVAL_H
17 #define SANITIZER_GETAUXVAL_H
18
19 #include "sanitizer_platform.h"
20
21 #if SANITIZER_LINUX
22
23 # include <features.h>
24
25 # ifndef __GLIBC_PREREQ
26 #  define __GLIBC_PREREQ(x, y) 0
27 # endif
28
29 # if __GLIBC_PREREQ(2, 16) || (SANITIZER_ANDROID && __ANDROID_API__ >= 21)
30 #  define SANITIZER_USE_GETAUXVAL 1
31 # else
32 #  define SANITIZER_USE_GETAUXVAL 0
33 # endif
34
35 # if SANITIZER_USE_GETAUXVAL
36 #  include <sys/auxv.h>
37 # else
38 // The weak getauxval definition allows to check for the function at runtime.
39 // This is useful for Android, when compiled at a lower API level yet running
40 // on a more recent platform that offers the function.
41 extern "C" SANITIZER_WEAK_ATTRIBUTE
42 unsigned long getauxval(unsigned long type);  // NOLINT
43 # endif
44
45 #endif // SANITIZER_LINUX
46
47 #endif // SANITIZER_GETAUXVAL_H