]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/sys/cdefs_aout.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / sys / cdefs_aout.h
1 /* $NetBSD: cdefs_aout.h,v 1.20 2006/05/18 17:55:38 christos Exp $ */
2
3 /*
4 * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
5 * Public domain.
6 */
7
8 #ifndef _SYS_CDEFS_AOUT_H_
9 #define _SYS_CDEFS_AOUT_H_
10
11 #define _C_LABEL(x) __CONCAT(_,x)
12 #define _C_LABEL_STRING(x) "_"x
13
14 #if __STDC__
15 #define ___RENAME(x) __asm(___STRING(_C_LABEL(x)))
16 #else
17 #define ___RENAME(x) ____RENAME(_/**/x)
18 #define ____RENAME(x) __asm(___STRING(x))
19 #endif
20
21 #define __indr_reference(sym,alias) /* nada, since we do weak refs */
22
23 #ifdef __GNUC__
24 #if __STDC__
25 #ifndef DONT_USE_STRONG_WEAK_ALIAS
26 #define __strong_alias(alias,sym) \
27 __asm(".global " _C_LABEL_STRING(#alias) "\n" \
28 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
29 #define __weak_alias(alias,sym) \
30 __asm(".weak " _C_LABEL_STRING(#alias) "\n" \
31 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
32
33 /* Do not use __weak_extern, use __weak_reference instead */
34 #define __weak_extern(sym) \
35 __asm(".weak " _C_LABEL_STRING(#sym));
36
37 #if __GNUC_PREREQ__(4, 0)
38 #define __weak_reference(sym) __attribute__((__weakref__))
39 #else
40 #define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))
41 #endif
42
43 #define __warn_references(sym,msg) \
44 __asm(".stabs \"" msg "\",30,0,0,0"); \
45 __asm(".stabs \"_" #sym "\",1,0,0,0");
46 #else
47 #define __strong_alias(alias,sym) /* NOTHING */
48 #define __weak_alias(alias,sym) /* NOTHING */
49 #define __weak_extern(sym) /* NOTHING */
50 #define __weak_reference(sym) /* NOTHING */
51
52 #define __warn_references(sym,msg) \
53 __asm(".stabs \"" msg "\",30,0,0,0"); \
54 __asm(".stabs \"_" #sym "\",1,0,0,0");
55 #endif
56 #else /* __STDC__ */
57 #define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
58 #define ___weak_alias(alias,sym) \
59 __asm(".weak alias\nalias = sym");
60 /* Do not use __weak_extern, use __weak_reference instead */
61 #define __weak_extern(sym) ___weak_extern(_/**/sym)
62 #define ___weak_extern(sym) \
63 __asm(".weak sym");
64
65 #if __GNUC_PREREQ__(4, 0)
66 #define __weak_reference(sym) __attribute__((__weakref__))
67 #else
68 #define ___weak_reference(sym) ; __asm(".weak sym");
69 #define __weak_reference(sym) ___weak_reference(_/**/sym)
70 #endif
71
72 #define __warn_references(sym,msg) \
73 __asm(".stabs msg,30,0,0,0"); \
74 __asm(".stabs \"_/**/sym\",1,0,0,0");
75 #endif /* __STDC__ */
76 #else /* __GNUC__ */
77 #define __warn_references(sym,msg)
78 #endif /* __GNUC__ */
79
80 #if defined(__sh__) /* XXX SH COFF */
81 #undef __indr_reference(sym,alias)
82 #undef __warn_references(sym,msg)
83 #define __warn_references(sym,msg)
84 #endif
85
86 #define __IDSTRING(_n,_s) \
87 __asm(".data ; .asciz \"" _s "\" ; .text")
88
89 #undef __KERNEL_RCSID
90
91 #define __RCSID(_s) __IDSTRING(rcsid,_s)
92 #define __SCCSID(_s)
93 #define __SCCSID2(_s)
94 #if 0 /* XXX userland __COPYRIGHTs have \ns in them */
95 #define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
96 #else
97 #define __COPYRIGHT(_s) \
98 static const char copyright[] __attribute__((__unused__)) = _s
99 #endif
100
101 #if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
102 #define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
103 #else
104 #define __KERNEL_RCSID(_n,_s)
105 #endif
106 #define __KERNEL_SCCSID(_n,_s)
107 #define __KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
108
109 #ifndef __lint__
110 #define __link_set_make_entry(set, sym, type) \
111 static void const * const \
112 __link_set_##set##_sym_##sym __used = &sym; \
113 __asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
114 #else
115 #define __link_set_make_entry(set, sym, type) \
116 extern void const * const __link_set_##set##_sym_##sym
117 #endif /* __lint__ */
118
119 #define __link_set_add_text(set, sym) __link_set_make_entry(set, sym, 23)
120 #define __link_set_add_rodata(set, sym) __link_set_make_entry(set, sym, 23)
121 #define __link_set_add_data(set, sym) __link_set_make_entry(set, sym, 25)
122 #define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym, 27)
123
124 #define __link_set_decl(set, ptype) \
125 extern struct { \
126 int __ls_length; \
127 ptype *__ls_items[1]; \
128 } __link_set_##set
129
130 #define __link_set_start(set) (&(__link_set_##set).__ls_items[0])
131 #define __link_set_end(set) \
132 (&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
133
134 #define __link_set_count(set) ((__link_set_##set).__ls_length)
135
136 #endif /* !_SYS_CDEFS_AOUT_H_ */