cdefs.h revision 1.1 1 /* $NetBSD: cdefs.h,v 1.1 1998/06/20 04:58:51 eeh Exp $ */
2
3 /*
4 * Written by J.T. Conklin <jtc (at) wimsey.com> 01/17/95.
5 * Public domain.
6 */
7
8 #ifndef _MACHINE_CDEFS_H_
9 #define _MACHINE_CDEFS_H_
10
11 #ifdef __ELF__
12
13 #define _C_LABEL(x) x
14
15 #ifdef __GNUC__
16 #define __RENAME(x) __asm__(___STRING(_C_LABEL(x)))
17 #else
18 #define __RENAME(x)
19 #endif
20
21 #define __DO_NOT_DO_WEAK__ /* NO WEAK SYMS IN LIBC YET */
22
23 #ifndef __DO_NOT_DO_WEAK__
24 #define __indr_reference(sym,alias) /* nada, since we do weak refs */
25 #endif /* !__DO_NOT_DO_WEAK__ */
26
27 #ifdef __STDC__
28
29 #ifndef __DO_NOT_DO_WEAK__
30 #define __weak_alias(alias,sym) \
31 __asm__(".weak " #alias " ; " #alias " = " #sym);
32 #endif /* !__DO_NOT_DO_WEAK__ */
33 #define __warn_references(sym,msg) \
34 __asm__(".section .gnu.warning." #sym " ; .ascii \"" msg "\" ; .text");
35
36 #else /* !__STDC__ */
37
38 #ifndef __DO_NOT_DO_WEAK__
39 #define __weak_alias(alias,sym) \
40 __asm__(".weak alias ; alias = sym");
41 #endif /* !__DO_NOT_DO_WEAK__ */
42 #define __warn_references(sym,msg) \
43 __asm__(".section .gnu.warning.sym ; .ascii msg ; .text");
44
45 #endif /* !__STDC__ */
46
47 #else /* !__ELF__ */
48
49 #define _C_LABEL(x) __CONCAT(_,x)
50
51 #ifdef __GNUC__
52 #define __RENAME(x) __asm__(___STRING(_C_LABEL(x)))
53 #else
54 #define __RENAME(x)
55 #endif
56
57 #ifdef __GNUC__
58 #ifdef __STDC__
59 #define __indr_reference(sym,alias) \
60 __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
61 __asm__(".stabs \"_" #sym "\",1,0,0,0");
62 #define __warn_references(sym,msg) \
63 __asm__(".stabs \"" msg "\",30,0,0,0"); \
64 __asm__(".stabs \"_" #sym "\",1,0,0,0");
65 #else
66 #define __indr_reference(sym,alias) \
67 __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
68 __asm__(".stabs \"_/**/sym\",1,0,0,0");
69 #define __warn_references(sym,msg) \
70 __asm__(".stabs msg,30,0,0,0"); \
71 __asm__(".stabs \"_/**/sym\",1,0,0,0");
72 #endif
73 #else
74 #define __indr_reference(sym,alias)
75 #define __warn_references(sym,msg)
76 #endif
77
78 #endif /* __ELF__ */
79
80 #endif /* !_MACHINE_CDEFS_H_ */
81
82
83
84