runtime: enable precise GC checks when using stack maps
[gcc.git] / libgo / runtime / go-ffi.c
1 /* go-ffi.c -- libffi support functions.
2
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
6
7 #include <stdlib.h>
8
9 #include "runtime.h"
10
11 #ifdef USE_LIBFFI
12
13 #include "ffi.h"
14
15 /* The functions in this file are called by the Go runtime code to get
16 the libffi type values. */
17
18 ffi_type *go_ffi_type_pointer(void) __attribute__ ((no_split_stack));
19 ffi_type *go_ffi_type_pointer(void) __asm__ ("runtime.ffi_type_pointer");
20 ffi_type *go_ffi_type_sint8(void) __attribute__ ((no_split_stack));
21 ffi_type *go_ffi_type_sint8(void) __asm__ ("runtime.ffi_type_sint8");
22 ffi_type *go_ffi_type_sint16(void) __attribute__ ((no_split_stack));
23 ffi_type *go_ffi_type_sint16(void) __asm__ ("runtime.ffi_type_sint16");
24 ffi_type *go_ffi_type_sint32(void) __attribute__ ((no_split_stack));
25 ffi_type *go_ffi_type_sint32(void) __asm__ ("runtime.ffi_type_sint32");
26 ffi_type *go_ffi_type_sint64(void) __attribute__ ((no_split_stack));
27 ffi_type *go_ffi_type_sint64(void) __asm__ ("runtime.ffi_type_sint64");
28 ffi_type *go_ffi_type_uint8(void) __attribute__ ((no_split_stack));
29 ffi_type *go_ffi_type_uint8(void) __asm__ ("runtime.ffi_type_uint8");
30 ffi_type *go_ffi_type_uint16(void) __attribute__ ((no_split_stack));
31 ffi_type *go_ffi_type_uint16(void) __asm__ ("runtime.ffi_type_uint16");
32 ffi_type *go_ffi_type_uint32(void) __attribute__ ((no_split_stack));
33 ffi_type *go_ffi_type_uint32(void) __asm__ ("runtime.ffi_type_uint32");
34 ffi_type *go_ffi_type_uint64(void) __attribute__ ((no_split_stack));
35 ffi_type *go_ffi_type_uint64(void) __asm__ ("runtime.ffi_type_uint64");
36 ffi_type *go_ffi_type_float(void) __attribute__ ((no_split_stack));
37 ffi_type *go_ffi_type_float(void) __asm__ ("runtime.ffi_type_float");
38 ffi_type *go_ffi_type_double(void) __attribute__ ((no_split_stack));
39 ffi_type *go_ffi_type_double(void) __asm__ ("runtime.ffi_type_double");
40 ffi_type *go_ffi_type_complex_float(void) __attribute__ ((no_split_stack));
41 ffi_type *go_ffi_type_complex_float(void) __asm__ ("runtime.ffi_type_complex_float");
42 ffi_type *go_ffi_type_complex_double(void) __attribute__ ((no_split_stack));
43 ffi_type *go_ffi_type_complex_double(void) __asm__ ("runtime.ffi_type_complex_double");
44 ffi_type *go_ffi_type_void(void) __attribute__ ((no_split_stack));
45 ffi_type *go_ffi_type_void(void) __asm__ ("runtime.ffi_type_void");
46
47 _Bool go_ffi_supports_complex(void) __attribute__ ((no_split_stack));
48 _Bool go_ffi_supports_complex(void) __asm__ ("runtime.ffi_supports_complex");
49
50 ffi_type *
51 go_ffi_type_pointer(void)
52 {
53 return &ffi_type_pointer;
54 }
55
56 ffi_type *
57 go_ffi_type_sint8(void)
58 {
59 return &ffi_type_sint8;
60 }
61
62 ffi_type *
63 go_ffi_type_sint16(void)
64 {
65 return &ffi_type_sint16;
66 }
67
68 ffi_type *
69 go_ffi_type_sint32(void)
70 {
71 return &ffi_type_sint32;
72 }
73
74 ffi_type *
75 go_ffi_type_sint64(void)
76 {
77 return &ffi_type_sint64;
78 }
79
80 ffi_type *
81 go_ffi_type_uint8(void)
82 {
83 return &ffi_type_uint8;
84 }
85
86 ffi_type *
87 go_ffi_type_uint16(void)
88 {
89 return &ffi_type_uint16;
90 }
91
92 ffi_type *
93 go_ffi_type_uint32(void)
94 {
95 return &ffi_type_uint32;
96 }
97
98 ffi_type *
99 go_ffi_type_uint64(void)
100 {
101 return &ffi_type_uint64;
102 }
103
104 ffi_type *
105 go_ffi_type_float(void)
106 {
107 return &ffi_type_float;
108 }
109
110 ffi_type *
111 go_ffi_type_double(void)
112 {
113 return &ffi_type_double;
114 }
115
116 _Bool
117 go_ffi_supports_complex(void)
118 {
119 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
120 return true;
121 #else
122 return false;
123 #endif
124 }
125
126 ffi_type *
127 go_ffi_type_complex_float(void)
128 {
129 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
130 return &ffi_type_complex_float;
131 #else
132 abort();
133 #endif
134 }
135
136 ffi_type *
137 go_ffi_type_complex_double(void)
138 {
139 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
140 return &ffi_type_complex_double;
141 #else
142 abort();
143 #endif
144 }
145
146 ffi_type *
147 go_ffi_type_void(void)
148 {
149 return &ffi_type_void;
150 }
151
152 #endif /* defined(USE_LIBFFI) */