1// Specific definitions for Darwin -*- C++ -*-
2
3// Copyright (C) 2004 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library.  This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING.  If not, write to the Free
18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19// USA.
20
21// As a special exception, you may use this file as part of a free software
22// library without restriction.  Specifically, if other files instantiate
23// templates or use macros or inline functions from this file, or you compile
24// this file and link it with other files to produce an executable, this
25// file does not by itself cause the resulting executable to be covered by
26// the GNU General Public License.  This exception does not however
27// invalidate any other reasons why the executable file might be covered by
28// the GNU General Public License.
29
30
31#ifndef _GLIBCXX_OS_DEFINES
32#define _GLIBCXX_OS_DEFINES 1
33
34// System-specific #define, typedefs, corrections, etc, go here.  This
35// file will come before all others.
36
37/* Darwin has the pthread routines in libSystem, which every program
38   links to, so there's no need for weak-ness for that.  */
39#define _GLIBCXX_GTHREAD_USE_WEAK 0
40
41// On Darwin, in order to enable overriding of operator new and delete,
42// GCC makes the definition of these functions weak, relies on the
43// loader to implement weak semantics properly, and uses
44// -flat_namespace to work around the way that it doesn't.
45#define _GLIBCXX_WEAK_DEFINITION __attribute__ ((weak))
46
47#ifndef _GLIBCXX_VISIBILITY_DEFAULT
48#define _GLIBCXX_VISIBILITY_DEFAULT /* _GLIBCXX_VISIBILITY(default) */
49#endif
50
51/* APPLE LOCAL begin dtrace 6144676 */
52/* Enable dtrace probes.  */
53/* Inline copy of dtrace_cxa_runtime.h. */
54/*
55 * Generated by dtrace(1M).
56 */
57
58#ifndef	_DTRACE_CXA_RUNTIME_H
59#define	_DTRACE_CXA_RUNTIME_H
60
61#include <unistd.h>
62/* APPLE LOCAL begin version */
63#include <Availability.h>
64/* APPLE LOCAL end version */
65
66#ifdef	__cplusplus
67extern "C" {
68#endif
69
70#define CXA_RUNTIME_STABILITY "___dtrace_stability$cxa_runtime$v1$1_1_0_1_1_0_1_1_0_1_1_0_1_1_0"
71
72#define CXA_RUNTIME_TYPEDEFS "___dtrace_typedefs$cxa_runtime$v2"
73
74#define	CXA_RUNTIME_CXA_EXCEPTION_RETHROW() \
75do { \
76	__asm__ volatile(".reference " CXA_RUNTIME_TYPEDEFS); \
77	__dtrace_probe$cxa_runtime$cxa_exception_rethrow$v1(); \
78	__asm__ volatile(".reference " CXA_RUNTIME_STABILITY); \
79} while (0)
80#define	CXA_RUNTIME_CXA_EXCEPTION_RETHROW_ENABLED() \
81	__dtrace_isenabled$cxa_runtime$cxa_exception_rethrow$v1()
82#define	CXA_RUNTIME_CXA_EXCEPTION_THROW(arg0) \
83do { \
84	__asm__ volatile(".reference " CXA_RUNTIME_TYPEDEFS); \
85	__dtrace_probe$cxa_runtime$cxa_exception_throw$v1$766f6964202a(arg0); \
86	__asm__ volatile(".reference " CXA_RUNTIME_STABILITY); \
87} while (0)
88#define	CXA_RUNTIME_CXA_EXCEPTION_THROW_ENABLED() \
89	__dtrace_isenabled$cxa_runtime$cxa_exception_throw$v1()
90
91
92extern void __dtrace_probe$cxa_runtime$cxa_exception_rethrow$v1(void);
93extern int __dtrace_isenabled$cxa_runtime$cxa_exception_rethrow$v1(void);
94extern void __dtrace_probe$cxa_runtime$cxa_exception_throw$v1$766f6964202a(void *);
95extern int __dtrace_isenabled$cxa_runtime$cxa_exception_throw$v1(void);
96
97#ifdef	__cplusplus
98}
99#endif
100
101#endif	/* _DTRACE_CXA_RUNTIME_H */
102/* APPLE LOCAL end dtrace 6144676 */
103
104/* APPLE LOCAL begin version */
105
106#ifndef __GNUC_LIBSTD__
107#define __GNUC_LIBSTD__ 4
108#define __GNUC_LIBSTD_MINOR__ 2
109#endif
110
111#if __IPHONE_OS_VERSION_MIN_REQUIRED
112	#define __TARGETING_4_0_DYLIB  0
113#else
114	#define __TARGETING_4_0_DYLIB (__MAC_OS_X_VERSION_MIN_REQUIRED < 1060)
115#endif
116
117/* APPLE LOCAL end version */
118
119/* APPLE LOCAL begin keymgr */
120#if defined(__APPLE__) && defined(__ppc__) && defined(PIC)
121/* Copyright (C) 1989, 92-97, 1998, Free Software Foundation, Inc.
122
123This file is part of GNU CC.
124
125GNU CC is free software; you can redistribute it and/or modify
126it under the terms of the GNU General Public License as published by
127the Free Software Foundation; either version 2, or (at your option)
128any later version.
129
130GNU CC is distributed in the hope that it will be useful,
131but WITHOUT ANY WARRANTY; without even the implied warranty of
132MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
133GNU General Public License for more details.
134
135You should have received a copy of the GNU General Public License
136along with GNU CC; see the file COPYING.  If not, write to
137the Free Software Foundation, 59 Temple Place - Suite 330,
138Boston, MA 02111-1307, USA.  */
139
140
141/*
142 * This file added by Apple Computer Inc. for its OS X
143 * environment.
144 */
145
146#ifndef __KEYMGR_H
147#define __KEYMGR_H
148
149#ifdef __cplusplus
150extern "C" {
151#endif
152
153
154
155/*
156 * keymgr - Create and maintain process-wide global data known to
157 *	    all threads across all dynamic libraries.
158 *
159 */
160
161typedef enum node_kinds {
162	NODE_THREAD_SPECIFIC_DATA=1,
163	NODE_PROCESSWIDE_PTR=2,
164	NODE_LAST_KIND
165	} TnodeKind ;
166
167/*
168 * These enum members are bits or combination of bits.
169 */
170
171typedef enum node_mode {
172	NM_ALLOW_RECURSION=1,
173	NM_RECURSION_ILLEGAL=2,
174	NM_ENHANCED_LOCKING=3,
175	NM_LOCKED=4
176	} TnodeMode ;
177
178/* WARNING: the return value of _keymgr_set_per_thread_data is
179   not meaningful on Tiger and above.  Use the macro
180   KEYMGR_SET_PER_THREAD_DATA (below) to handle this properly. */
181extern void * _keymgr_get_per_thread_data(unsigned int key) ;
182extern int _keymgr_set_per_thread_data(unsigned int key, void *keydata) ;
183extern void *_keymgr_get_and_lock_processwide_ptr(unsigned int key) ;
184extern void _keymgr_set_and_unlock_processwide_ptr(unsigned int key, void *ptr) ;
185extern void _keymgr_unlock_processwide_ptr(unsigned int key) ;
186extern void _keymgr_set_lockmode_processwide_ptr(unsigned int key, unsigned int mode) ;
187extern unsigned int  _keymgr_get_lockmode_processwide_ptr(unsigned int key) ;
188extern int _keymgr_get_lock_count_processwide_ptr(unsigned int key) ;
189
190extern void *__keymgr_global[];
191typedef struct _Sinfo_Node {
192        unsigned int size ;             /*size of this node*/
193        unsigned short major_version ;  /*API major version.*/
194        unsigned short minor_version ;  /*API minor version.*/
195        } _Tinfo_Node ;
196
197#define KEYMGR_VERSION \
198  (__keymgr_global[2] ? ((_Tinfo_Node *)__keymgr_global[2])->major_version : 0)
199
200#define KEYMGR_SET_PER_THREAD_DATA(key, keydata)   \
201  (KEYMGR_VERSION >= 4                             \
202  ? _keymgr_set_per_thread_data((key), (keydata))  \
203  : (_keymgr_set_per_thread_data((key), (keydata)), 0))
204
205#ifndef NULL
206#ifdef __GNUG__
207#define NULL __null
208#else
209#define NULL 0
210#endif
211#endif
212
213/*
214 * Keys currently in use:
215 */
216
217#define KEYMGR_EH_CONTEXT_KEY		1	/*stores handle for root pointer of exception context node.*/
218
219#define KEYMGR_NEW_HANDLER_KEY		2	/*store handle for new handler pointer.*/
220
221#define KEYMGR_UNEXPECTED_HANDLER_KEY	3	/*store handle for unexpected exception pointer.*/
222
223#define KEYMGR_TERMINATE_HANDLER_KEY	4	/*store handle for terminate handler pointer. */
224
225#define KEYMGR_MODE_BITS		5	/*stores handle for runtime mode bits.*/
226
227#define KEYMGR_IO_LIST			6	/*Root pointer to the list of open streams.*/
228
229#define KEYMGR_IO_STDIN			7	/*GNU stdin.*/
230
231#define KEYMGR_IO_STDOUT		8	/*GNU stdout.*/
232
233#define KEYMGR_IO_STDERR		9	/*GNU stderr.*/
234
235#define KEYMGR_IO_REFCNT		10	/*How many plugins/main program currently using streams.*/
236
237#define KEYMGR_IO_MODE_BITS		11	/*Flags controlling the behavior of C++ I/O.*/
238
239#define KEYMGR_ZOE_IMAGE_LIST		12	/*Head pointer for list of per image dwarf2 unwind sections.*/
240
241#define KEYMGR_EH_GLOBALS_KEY           13      /* Variable used in eh_globals.cc */
242
243/*
244 * Other important data.
245 */
246
247#define KEYMGR_API_REV_MAJOR		2	/*Major revision number of the keymgr API.*/
248#define KEYMGR_API_REV_MINOR		1	/*Minor revision number of the keymgr API.*/
249
250
251
252#ifdef __cplusplus
253}
254#endif
255
256#endif /* __KEYMGR_H */
257#endif /* __APPLE__ etc. */
258/* APPLE LOCAL end keymgr */
259#endif
260