xref: /netbsd/sys/sys/cdefs_aout.h (revision c4a72b64)
1 /*	$NetBSD: cdefs_aout.h,v 1.12 2002/12/05 05:47:24 simonb 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 
13 #if __STDC__
14 #define	___RENAME(x)	__asm__(___STRING(_C_LABEL(x)))
15 #else
16 #define	___RENAME(x)	____RENAME(_/**/x)
17 #define	____RENAME(x)	__asm__(___STRING(x))
18 #endif
19 
20 #ifdef __GNUC__
21 #if __STDC__
22 #define	__indr_reference(sym,alias)					\
23 	__asm__(".stabs \"_" #alias "\",11,0,0,0");			\
24 	__asm__(".stabs \"_" #sym "\",1,0,0,0");
25 
26 #define	__warn_references(sym,msg)					\
27 	__asm__(".stabs \"" msg "\",30,0,0,0");				\
28 	__asm__(".stabs \"_" #sym "\",1,0,0,0");
29 #else /* __STDC__ */
30 #define	__indr_reference(sym,alias)					\
31 	__asm__(".stabs \"_/**/alias\",11,0,0,0");			\
32 	__asm__(".stabs \"_/**/sym\",1,0,0,0");
33 
34 #define	__warn_references(sym,msg)					\
35 	__asm__(".stabs msg,30,0,0,0");					\
36 	__asm__(".stabs \"_/**/sym\",1,0,0,0");
37 #endif /* __STDC__ */
38 #else /* __GNUC__ */
39 #define	__warn_references(sym,msg)
40 #endif /* __GNUC__ */
41 
42 #if defined(__sh__)		/* XXX SH COFF */
43 #undef __indr_reference(sym,alias)
44 #undef __warn_references(sym,msg)
45 #define __warn_references(sym,msg)
46 #endif
47 
48 #define __IDSTRING(_n,_s)						\
49 	__asm__(".data ; .asciz \"" _s "\" ; .text")
50 
51 #undef __KERNEL_RCSID
52 
53 #define __RCSID(_s)	__IDSTRING(rcsid,_s)
54 #define __SCCSID(_s)
55 #define __SCCSID2(_s)
56 #if 0	/* XXX userland __COPYRIGHTs have \ns in them */
57 #define __COPYRIGHT(_s)	__IDSTRING(copyright,_s)
58 #else
59 #define __COPYRIGHT(_s)							\
60 	static const char copyright[] __attribute__((__unused__)) = _s
61 #endif
62 
63 #if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
64 #define	__KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
65 #else
66 #define	__KERNEL_RCSID(_n,_s)
67 #endif
68 #define	__KERNEL_SCCSID(_n,_s)
69 #define	__KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
70 
71 #ifndef __lint__
72 #define	__link_set_make_entry(set, sym, type)				\
73 	static void const * const __link_set_##set##_sym_##sym = &sym;	\
74 	__asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
75 #else
76 #define	__link_set_make_entry(set, sym, type)				\
77 	extern void const * const __link_set_##set##_sym_##sym
78 #endif /* __lint__ */
79 
80 #define	__link_set_add_text(set, sym)	__link_set_make_entry(set, sym, 23)
81 #define	__link_set_add_rodata(set, sym)	__link_set_make_entry(set, sym, 23)
82 #define	__link_set_add_data(set, sym)	__link_set_make_entry(set, sym, 25)
83 #define	__link_set_add_bss(set, sym)	__link_set_make_entry(set, sym, 27)
84 
85 #define	__link_set_decl(set, ptype)					\
86 extern struct {								\
87 	int	__ls_length;						\
88 	ptype	*__ls_items[1];						\
89 } __link_set_##set
90 
91 #define	__link_set_start(set)	(&(__link_set_##set).__ls_items[0])
92 #define	__link_set_end(set)						\
93 	(&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
94 
95 #define	__link_set_count(set)	((__link_set_##set).__ls_length)
96 
97 #endif /* !_SYS_CDEFS_AOUT_H_ */
98