]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgo/runtime/go-ffi.c
Fix boostrap failure in tree-ssa-loop-ch.cc
[thirdparty/gcc.git] / libgo / runtime / go-ffi.c
CommitLineData
5302cd02 1/* go-ffi.c -- libffi support functions.
dffa7328
ILT
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
dffa7328
ILT
7#include <stdlib.h>
8
9#include "runtime.h"
dffa7328
ILT
10
11#ifdef USE_LIBFFI
12
13#include "ffi.h"
14
5302cd02
ILT
15/* The functions in this file are called by the Go runtime code to get
16 the libffi type values. */
17
18ffi_type *go_ffi_type_pointer(void) __attribute__ ((no_split_stack));
a01dda3c 19ffi_type *go_ffi_type_pointer(void) __asm__ ("runtime.ffi__type__pointer");
5302cd02 20ffi_type *go_ffi_type_sint8(void) __attribute__ ((no_split_stack));
a01dda3c 21ffi_type *go_ffi_type_sint8(void) __asm__ ("runtime.ffi__type__sint8");
5302cd02 22ffi_type *go_ffi_type_sint16(void) __attribute__ ((no_split_stack));
a01dda3c 23ffi_type *go_ffi_type_sint16(void) __asm__ ("runtime.ffi__type__sint16");
5302cd02 24ffi_type *go_ffi_type_sint32(void) __attribute__ ((no_split_stack));
a01dda3c 25ffi_type *go_ffi_type_sint32(void) __asm__ ("runtime.ffi__type__sint32");
5302cd02 26ffi_type *go_ffi_type_sint64(void) __attribute__ ((no_split_stack));
a01dda3c 27ffi_type *go_ffi_type_sint64(void) __asm__ ("runtime.ffi__type__sint64");
5302cd02 28ffi_type *go_ffi_type_uint8(void) __attribute__ ((no_split_stack));
a01dda3c 29ffi_type *go_ffi_type_uint8(void) __asm__ ("runtime.ffi__type__uint8");
5302cd02 30ffi_type *go_ffi_type_uint16(void) __attribute__ ((no_split_stack));
a01dda3c 31ffi_type *go_ffi_type_uint16(void) __asm__ ("runtime.ffi__type__uint16");
5302cd02 32ffi_type *go_ffi_type_uint32(void) __attribute__ ((no_split_stack));
a01dda3c 33ffi_type *go_ffi_type_uint32(void) __asm__ ("runtime.ffi__type__uint32");
5302cd02 34ffi_type *go_ffi_type_uint64(void) __attribute__ ((no_split_stack));
a01dda3c 35ffi_type *go_ffi_type_uint64(void) __asm__ ("runtime.ffi__type__uint64");
5302cd02 36ffi_type *go_ffi_type_float(void) __attribute__ ((no_split_stack));
a01dda3c 37ffi_type *go_ffi_type_float(void) __asm__ ("runtime.ffi__type__float");
5302cd02 38ffi_type *go_ffi_type_double(void) __attribute__ ((no_split_stack));
a01dda3c 39ffi_type *go_ffi_type_double(void) __asm__ ("runtime.ffi__type__double");
5302cd02 40ffi_type *go_ffi_type_complex_float(void) __attribute__ ((no_split_stack));
a01dda3c 41ffi_type *go_ffi_type_complex_float(void) __asm__ ("runtime.ffi__type__complex__float");
5302cd02 42ffi_type *go_ffi_type_complex_double(void) __attribute__ ((no_split_stack));
a01dda3c 43ffi_type *go_ffi_type_complex_double(void) __asm__ ("runtime.ffi__type__complex__double");
5302cd02 44ffi_type *go_ffi_type_void(void) __attribute__ ((no_split_stack));
a01dda3c 45ffi_type *go_ffi_type_void(void) __asm__ ("runtime.ffi__type__void");
5302cd02
ILT
46
47_Bool go_ffi_supports_complex(void) __attribute__ ((no_split_stack));
a01dda3c 48_Bool go_ffi_supports_complex(void) __asm__ ("runtime.ffi__supports__complex");
5302cd02
ILT
49
50ffi_type *
51go_ffi_type_pointer(void)
dffa7328 52{
5302cd02 53 return &ffi_type_pointer;
dffa7328
ILT
54}
55
5302cd02
ILT
56ffi_type *
57go_ffi_type_sint8(void)
dffa7328 58{
5302cd02 59 return &ffi_type_sint8;
dffa7328
ILT
60}
61
5302cd02
ILT
62ffi_type *
63go_ffi_type_sint16(void)
dffa7328 64{
5302cd02 65 return &ffi_type_sint16;
dffa7328
ILT
66}
67
5302cd02
ILT
68ffi_type *
69go_ffi_type_sint32(void)
dffa7328 70{
5302cd02 71 return &ffi_type_sint32;
dffa7328
ILT
72}
73
5302cd02
ILT
74ffi_type *
75go_ffi_type_sint64(void)
dffa7328 76{
5302cd02 77 return &ffi_type_sint64;
dffa7328
ILT
78}
79
5302cd02
ILT
80ffi_type *
81go_ffi_type_uint8(void)
82{
83 return &ffi_type_uint8;
84}
38bf819a 85
5302cd02
ILT
86ffi_type *
87go_ffi_type_uint16(void)
dffa7328 88{
5302cd02
ILT
89 return &ffi_type_uint16;
90}
dffa7328 91
5302cd02
ILT
92ffi_type *
93go_ffi_type_uint32(void)
94{
95 return &ffi_type_uint32;
dffa7328
ILT
96}
97
5302cd02
ILT
98ffi_type *
99go_ffi_type_uint64(void)
100{
101 return &ffi_type_uint64;
102}
dffa7328 103
5302cd02
ILT
104ffi_type *
105go_ffi_type_float(void)
dffa7328 106{
dffa7328 107 return &ffi_type_float;
5302cd02
ILT
108}
109
110ffi_type *
111go_ffi_type_double(void)
112{
dffa7328 113 return &ffi_type_double;
5302cd02
ILT
114}
115
116_Bool
117go_ffi_supports_complex(void)
118{
38bf819a 119#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
5302cd02 120 return true;
38bf819a 121#else
5302cd02 122 return false;
dffa7328 123#endif
5302cd02
ILT
124}
125
126ffi_type *
127go_ffi_type_complex_float(void)
128{
38bf819a 129#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
5302cd02 130 return &ffi_type_complex_float;
38bf819a 131#else
5302cd02 132 abort();
dffa7328 133#endif
dffa7328
ILT
134}
135
5302cd02
ILT
136ffi_type *
137go_ffi_type_complex_double(void)
dffa7328 138{
5302cd02
ILT
139#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
140 return &ffi_type_complex_double;
141#else
142 abort();
143#endif
dffa7328
ILT
144}
145
5302cd02
ILT
146ffi_type *
147go_ffi_type_void(void)
dffa7328 148{
5302cd02 149 return &ffi_type_void;
dffa7328
ILT
150}
151
152#endif /* defined(USE_LIBFFI) */