FreeBSD/Linux Kernel Cross Reference
sys/sys/cdefs_aout.h
1 /* $NetBSD: cdefs_aout.h,v 1.15 2004/06/07 18:42:18 drochner 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 #define __strong_alias(alias,sym) \
26 __asm__(".global " _C_LABEL_STRING(#alias) "\n" \
27 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
28 #define __weak_alias(alias,sym) \
29 __asm__(".weak " _C_LABEL_STRING(#alias) "\n" \
30 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
31 #define __weak_extern(sym) \
32 __asm__(".weak " _C_LABEL_STRING(#sym));
33 #define __warn_references(sym,msg) \
34 __asm__(".stabs \"" msg "\",30,0,0,0"); \
35 __asm__(".stabs \"_" #sym "\",1,0,0,0");
36 #else /* __STDC__ */
37 #define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
38 #define ___weak_alias(alias,sym) \
39 __asm__(".weak alias\nalias = sym");
40 #define __weak_extern(sym) ___weak_extern(_/**/sym)
41 #define ___weak_extern(sym) \
42 __asm__(".weak sym");
43 #define __warn_references(sym,msg) \
44 __asm__(".stabs msg,30,0,0,0"); \
45 __asm__(".stabs \"_/**/sym\",1,0,0,0");
46 #endif /* __STDC__ */
47 #else /* __GNUC__ */
48 #define __warn_references(sym,msg)
49 #endif /* __GNUC__ */
50
51 #if defined(__sh__) /* XXX SH COFF */
52 #undef __indr_reference(sym,alias)
53 #undef __warn_references(sym,msg)
54 #define __warn_references(sym,msg)
55 #endif
56
57 #define __IDSTRING(_n,_s) \
58 __asm__(".data ; .asciz \"" _s "\" ; .text")
59
60 #undef __KERNEL_RCSID
61
62 #define __RCSID(_s) __IDSTRING(rcsid,_s)
63 #define __SCCSID(_s)
64 #define __SCCSID2(_s)
65 #if 0 /* XXX userland __COPYRIGHTs have \ns in them */
66 #define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
67 #else
68 #define __COPYRIGHT(_s) \
69 static const char copyright[] __attribute__((__unused__)) = _s
70 #endif
71
72 #if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
73 #define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
74 #else
75 #define __KERNEL_RCSID(_n,_s)
76 #endif
77 #define __KERNEL_SCCSID(_n,_s)
78 #define __KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
79
80 #ifndef __lint__
81 #define __link_set_make_entry(set, sym, type) \
82 static void const * const \
83 __link_set_##set##_sym_##sym __used = &sym; \
84 __asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
85 #else
86 #define __link_set_make_entry(set, sym, type) \
87 extern void const * const __link_set_##set##_sym_##sym
88 #endif /* __lint__ */
89
90 #define __link_set_add_text(set, sym) __link_set_make_entry(set, sym, 23)
91 #define __link_set_add_rodata(set, sym) __link_set_make_entry(set, sym, 23)
92 #define __link_set_add_data(set, sym) __link_set_make_entry(set, sym, 25)
93 #define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym, 27)
94
95 #define __link_set_decl(set, ptype) \
96 extern struct { \
97 int __ls_length; \
98 ptype *__ls_items[1]; \
99 } __link_set_##set
100
101 #define __link_set_start(set) (&(__link_set_##set).__ls_items[0])
102 #define __link_set_end(set) \
103 (&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
104
105 #define __link_set_count(set) ((__link_set_##set).__ls_length)
106
107 #endif /* !_SYS_CDEFS_AOUT_H_ */
Cache object: 1f05ac981482eff4c6d8237662583b1d
|