1/* This file is automatically generated.  DO NOT EDIT! */
2/* Generated from: NetBSD: mknative-gcc,v 1.117 2023/07/31 01:48:37 mrg Exp  */
3/* Generated from: NetBSD: mknative.common,v 1.16 2018/04/15 15:13:37 christos Exp  */
4
5// Control various target specific ABI tweaks.  ARM version.
6
7// Copyright (C) 2004-2022 Free Software Foundation, Inc.
8//
9// This file is part of the GNU ISO C++ Library.  This library is free
10// software; you can redistribute it and/or modify it under the
11// terms of the GNU General Public License as published by the
12// Free Software Foundation; either version 3, or (at your option)
13// any later version.
14
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18// GNU General Public License for more details.
19
20// Under Section 7 of GPL version 3, you are granted additional
21// permissions described in the GCC Runtime Library Exception, version
22// 3.1, as published by the Free Software Foundation.
23
24// You should have received a copy of the GNU General Public License and
25// a copy of the GCC Runtime Library Exception along with this program;
26// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
27// <http://www.gnu.org/licenses/>.
28
29/** @file bits/cxxabi_tweaks.h
30 *  This is an internal header file, included by other library headers.
31 *  Do not attempt to use it directly. @headername{cxxabi.h}
32 */
33
34#ifndef _CXXABI_TWEAKS_H
35#define _CXXABI_TWEAKS_H 1
36
37#ifdef __cplusplus
38namespace __cxxabiv1
39{
40  extern "C"
41  {
42#endif
43
44#ifdef __ARM_EABI__
45  // The ARM EABI uses the least significant bit of a 32-bit
46  // guard variable.
47#define _GLIBCXX_GUARD_TEST(x) ((*(x) & 1) != 0)
48#define _GLIBCXX_GUARD_SET(x) *(x) = 1
49#define _GLIBCXX_GUARD_BIT 1
50#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
51#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
52  typedef int __guard;
53
54#define _GLIBCXX_GUARD_TEST_AND_ACQUIRE(x) \
55  ((__atomic_load_n(x, __ATOMIC_ACQUIRE) & 1) != 0)
56#define _GLIBCXX_GUARD_SET_AND_RELEASE(x) \
57  __atomic_store_n(x, 1, __ATOMIC_RELEASE)
58
59  // We also want the element size in array cookies.
60#define _GLIBCXX_ELTSIZE_IN_COOKIE 1
61
62  // __cxa_vec_ctor should return a pointer to the array.
63  typedef void * __cxa_vec_ctor_return_type;
64#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return x
65  // Constructors and destructors return the "this" pointer.
66  typedef void * __cxa_cdtor_return_type;
67
68#else // __ARM_EABI__
69
70  // The generic ABI uses the first byte of a 64-bit guard variable.
71#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
72#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
73#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
74#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
75#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
76  __extension__ typedef int __guard __attribute__((mode (__DI__)));
77
78  // __cxa_vec_ctor has void return type.
79  typedef void __cxa_vec_ctor_return_type;
80#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
81  // Constructors and destructors do not return a value.
82  typedef void __cxa_cdtor_return_type;
83
84#endif //!__ARM_EABI__
85
86#ifdef __cplusplus
87  }
88} // namespace __cxxabiv1
89#endif
90
91#endif
92