Rune - Clean up strings
[rune.git] / libruntime / rt_stubs.c
1 /*
2  * STUBS.C
3  *
4  * These stubs exist to allow external APIs to load at run-time without libgen
5  * when used directly in a Rune executable.
6  */
7 #include "defs.h"
8
9 void _GenInternalCallWrapper(void);
10 void _initType(Type *type, typelist_t *list, int op);
11 void _initPtrType(Type *type, Type *ptrto, int sqflags);
12 void _SyscallAdd(Syscall *sc);
13 void _InternalRegisterType(const char *str, const char *linkname, Type *type);
14
15 extern int _LibGenActive;
16 extern Type _Int8Type;
17 extern Type _Int16Type;
18 extern Type _Int32Type;
19 extern Type _Int64Type;
20 extern Type _UInt8Type;
21 extern Type _UInt16Type;
22 extern Type _UInt32Type;
23 extern Type _UInt64Type;
24 extern Type _StrType;
25 extern Type _UCharPtrType;
26 extern Type _UCharPtrPtrType;
27 extern Type _CUCharPtrPtrType;
28
29 __weak_reference(_GenInternalCallWrapper, GenInternalCallWrapper);
30 __weak_reference(_initType, initType);
31 __weak_reference(_initPtrType, initPtrType);
32 __weak_reference(_SyscallAdd, SyscallAdd);
33 __weak_reference(_InternalRegisterType, InternalRegisterType);
34
35 void
36 _GenInternalCallWrapper(void)
37 {
38         dpanic("_GenInternalCallWrapper: requires linking against libgen");
39 }
40
41 void
42 _initType(Type *type, typelist_t *list, int op)
43 {
44         dpanic("_initType: requires linking against libgen");
45 }
46
47 void
48 _initPtrType(Type *type, Type *ptrto, int sqflags)
49 {
50         dpanic("_initPtrType: requires linking against libgen");
51 }
52
53 void
54 _SyscallAdd(Syscall *sc)
55 {
56         dpanic("_SyscallAdd: requires linking against libgen");
57 }
58
59 void
60 _InternalRegisterType(const char *str, const char *linkname, Type *type)
61 {
62         dpanic("_InternalRegisterType: requires linking against libgen");
63 }
64
65 int _LibGenActive = 0;
66 Type _Int8Type = { .ty_Flags = 0 };
67 Type _Int16Type = { .ty_Flags = 0 };
68 Type _Int32Type = { .ty_Flags = 0 };
69 Type _Int64Type = { .ty_Flags = 0 };
70 Type _UInt8Type = { .ty_Flags = 0 };
71 Type _UInt16Type = { .ty_Flags = 0 };
72 Type _UInt32Type = { .ty_Flags = 0 };
73 Type _UInt64Type = { .ty_Flags = 0 };
74 Type _SizeType = { .ty_Flags = 0 };
75 Type _OffType = { .ty_Flags = 0 };
76 Type _StrType = { .ty_Flags = 0 };
77 Type _UCharPtrType = { .ty_Flags = 0 };
78 Type _UCharPtrPtrType = { .ty_Flags = 0 };
79 Type _CUCharPtrPtrType = { .ty_Flags = 0 };
80
81 __weak_reference(_LibGenActive, LibGenActive);
82 __weak_reference(_Int8Type, Int8Type);
83 __weak_reference(_Int16Type, Int16Type);
84 __weak_reference(_Int32Type, Int32Type);
85 __weak_reference(_Int64Type, Int64Type);
86 __weak_reference(_UInt8Type, UInt8Type);
87 __weak_reference(_UInt16Type, UInt16Type);
88 __weak_reference(_UInt32Type, UInt32Type);
89 __weak_reference(_UInt64Type, UInt64Type);
90 __weak_reference(_SizeType, SizeType);
91 __weak_reference(_OffType, OffType);
92 __weak_reference(_StrType, StrType);
93 __weak_reference(_UCharPtrType, UCharPtrType);
94 __weak_reference(_UCharPtrPtrType, UCharPtrPtrType);
95 __weak_reference(_CUCharPtrPtrType, CUCharPtrPtrType);
96
97 void RUNEENTRYABI _rune_entry_main(void) { }
98 __weak_reference(_rune_entry_main, rune_entry_main);
99
100 static void *Dummy;
101
102 void **_start_runectors = &Dummy;
103 void **_stop_runectors = &Dummy;
104 __weak_reference(_start_runectors, start_runectors);
105 __weak_reference(_stop_runectors, stop_runectors);
106