]> git.ipfire.org Git - thirdparty/gcc.git/blame - libsanitizer/sanitizer_common/sanitizer_getauxval.h
[Ada] Sem_Ch13: fix uninitialized parameter static analysis warning
[thirdparty/gcc.git] / libsanitizer / sanitizer_common / sanitizer_getauxval.h
CommitLineData
d2ef4bee 1//===-- sanitizer_getauxval.h -----------------------------------*- C++ -*-===//
2//
2fc4da48 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
d2ef4bee 6//
7//===----------------------------------------------------------------------===//
8//
9// Common getauxval() guards and definitions.
10// getauxval() is not defined until glibc version 2.16, or until API level 21
11// for Android.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef SANITIZER_GETAUXVAL_H
16#define SANITIZER_GETAUXVAL_H
17
18#include "sanitizer_platform.h"
19
20#if SANITIZER_LINUX || SANITIZER_FUCHSIA
21
22# include <features.h>
23
24# ifndef __GLIBC_PREREQ
25# define __GLIBC_PREREQ(x, y) 0
26# endif
27
28# if __GLIBC_PREREQ(2, 16) || (SANITIZER_ANDROID && __ANDROID_API__ >= 21) || \
29 SANITIZER_FUCHSIA
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.
41extern "C" SANITIZER_WEAK_ATTRIBUTE
42unsigned long getauxval(unsigned long type); // NOLINT
43# endif
44
45#endif // SANITIZER_LINUX || SANITIZER_FUCHSIA
46
47#endif // SANITIZER_GETAUXVAL_H