libgo: update to Go 1.11
[official-gcc.git] / libgo / runtime / go-ffi.c
blobb030f5e918ed3d5f4328f53d83ba03da38f91799
1 /* go-ffi.c -- libffi support functions.
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. */
7 #include <stdlib.h>
9 #include "runtime.h"
11 #ifdef USE_LIBFFI
13 #include "ffi.h"
15 /* The functions in this file are called by the Go runtime code to get
16 the libffi type values. */
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");
47 _Bool go_ffi_supports_complex(void) __attribute__ ((no_split_stack));
48 _Bool go_ffi_supports_complex(void) __asm__ ("runtime.ffi_supports_complex");
50 ffi_type *
51 go_ffi_type_pointer(void)
53 return &ffi_type_pointer;
56 ffi_type *
57 go_ffi_type_sint8(void)
59 return &ffi_type_sint8;
62 ffi_type *
63 go_ffi_type_sint16(void)
65 return &ffi_type_sint16;
68 ffi_type *
69 go_ffi_type_sint32(void)
71 return &ffi_type_sint32;
74 ffi_type *
75 go_ffi_type_sint64(void)
77 return &ffi_type_sint64;
80 ffi_type *
81 go_ffi_type_uint8(void)
83 return &ffi_type_uint8;
86 ffi_type *
87 go_ffi_type_uint16(void)
89 return &ffi_type_uint16;
92 ffi_type *
93 go_ffi_type_uint32(void)
95 return &ffi_type_uint32;
98 ffi_type *
99 go_ffi_type_uint64(void)
101 return &ffi_type_uint64;
104 ffi_type *
105 go_ffi_type_float(void)
107 return &ffi_type_float;
110 ffi_type *
111 go_ffi_type_double(void)
113 return &ffi_type_double;
116 _Bool
117 go_ffi_supports_complex(void)
119 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
120 return true;
121 #else
122 return false;
123 #endif
126 ffi_type *
127 go_ffi_type_complex_float(void)
129 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
130 return &ffi_type_complex_float;
131 #else
132 abort();
133 #endif
136 ffi_type *
137 go_ffi_type_complex_double(void)
139 #ifdef FFI_TARGET_HAS_COMPLEX_TYPE
140 return &ffi_type_complex_double;
141 #else
142 abort();
143 #endif
146 ffi_type *
147 go_ffi_type_void(void)
149 return &ffi_type_void;
152 #endif /* defined(USE_LIBFFI) */