]> git.ipfire.org Git - thirdparty/gcc.git/blame - libsanitizer/include/sanitizer/common_interface_defs.h
Define/use hardware pointer type for stack unwind
[thirdparty/gcc.git] / libsanitizer / include / sanitizer / common_interface_defs.h
CommitLineData
f35db108
WM
1//===-- sanitizer/common_interface_defs.h -----------------------*- C++ -*-===//
2//
3// This file is distributed under the University of Illinois Open Source
4// License. See LICENSE.TXT for details.
5//
6//===----------------------------------------------------------------------===//
7//
8// This file is shared between AddressSanitizer and ThreadSanitizer.
9// It contains basic macro and types.
10// NOTE: This file may be included into user code.
11//===----------------------------------------------------------------------===//
12
13#ifndef SANITIZER_COMMON_INTERFACE_DEFS_H
14#define SANITIZER_COMMON_INTERFACE_DEFS_H
15
16// ----------- ATTENTION -------------
17// This header should NOT include any other headers to avoid portability issues.
18
19#if defined(_WIN32)
20// FIXME find out what we need on Windows. __declspec(dllexport) ?
21# define SANITIZER_INTERFACE_ATTRIBUTE
22# define SANITIZER_WEAK_ATTRIBUTE
23#elif defined(SANITIZER_GO)
24# define SANITIZER_INTERFACE_ATTRIBUTE
25# define SANITIZER_WEAK_ATTRIBUTE
26#else
27# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
28# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
29#endif
30
31// __has_feature
32#if !defined(__has_feature)
33# define __has_feature(x) 0
34#endif
35
36// For portability reasons we do not include stddef.h, stdint.h or any other
37// system header, but we do need some basic types that are not defined
38// in a portable way by the language itself.
39namespace __sanitizer {
40
41#if defined(_WIN64)
42// 64-bit Windows uses LLP64 data model.
43typedef unsigned long long uptr; // NOLINT
44typedef signed long long sptr; // NOLINT
45#else
46typedef unsigned long uptr; // NOLINT
47typedef signed long sptr; // NOLINT
48#endif // defined(_WIN64)
d1caed14
L
49#if defined(__x86_64__)
50// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use
51// 64-bit pointer to unwind stack frame.
52typedef unsigned long long uhwptr; // NOLINT
53#else
54typedef uptr uhwptr; // NOLINT
55#endif
f35db108
WM
56typedef unsigned char u8;
57typedef unsigned short u16; // NOLINT
58typedef unsigned int u32;
59typedef unsigned long long u64; // NOLINT
60typedef signed char s8;
61typedef signed short s16; // NOLINT
62typedef signed int s32;
63typedef signed long long s64; // NOLINT
64
65} // namespace __sanitizer
66
67extern "C" {
68 // Tell the tools to write their reports to "path.<pid>" instead of stderr.
69 void __sanitizer_set_report_path(const char *path)
70 SANITIZER_INTERFACE_ATTRIBUTE;
71} // extern "C"
72
73#endif // SANITIZER_COMMON_INTERFACE_DEFS_H