Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / sys / cdefs_aout.h @ 13

History | View | Annotate | Download (3.83 KB)

1 13 up20180614
/*        $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
#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
32
/* Do not use __weak_extern, use __weak_reference instead */
33
#define        __weak_extern(sym)                                                \
34
    __asm(".weak " _C_LABEL_STRING(#sym));
35
36
#if __GNUC_PREREQ__(4, 0)
37
#define        __weak_reference(sym)        __attribute__((__weakref__))
38
#else
39
#define        __weak_reference(sym)        ; __asm(".weak " _C_LABEL_STRING(#sym))
40
#endif
41
42
#define        __warn_references(sym,msg)                                        \
43
        __asm(".stabs \"" msg "\",30,0,0,0");                                \
44
        __asm(".stabs \"_" #sym "\",1,0,0,0");
45
#else /* __STDC__ */
46
#define        __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)
47
#define        ___weak_alias(alias,sym)                                        \
48
    __asm(".weak alias\nalias = sym");
49
/* Do not use __weak_extern, use __weak_reference instead */
50
#define        __weak_extern(sym) ___weak_extern(_/**/sym)
51
#define        ___weak_extern(sym)                                                \
52
    __asm(".weak sym");
53
54
#if __GNUC_PREREQ__(4, 0)
55
#define        __weak_reference(sym)        __attribute__((__weakref__))
56
#else
57
#define        ___weak_reference(sym)        ; __asm(".weak sym");
58
#define        __weak_reference(sym)        ___weak_reference(_/**/sym)
59
#endif
60
61
#define        __warn_references(sym,msg)                                        \
62
        __asm(".stabs msg,30,0,0,0");                                        \
63
        __asm(".stabs \"_/**/sym\",1,0,0,0");
64
#endif /* __STDC__ */
65
#else /* __GNUC__ */
66
#define        __warn_references(sym,msg)
67
#endif /* __GNUC__ */
68
69
#if defined(__sh__)                /* XXX SH COFF */
70
#undef __indr_reference(sym,alias)
71
#undef __warn_references(sym,msg)
72
#define        __warn_references(sym,msg)
73
#endif
74
75
#define        __IDSTRING(_n,_s)                                                \
76
        __asm(".data ; .asciz \"" _s "\" ; .text")
77
78
#undef __KERNEL_RCSID
79
80
#define        __RCSID(_s)        __IDSTRING(rcsid,_s)
81
#define        __SCCSID(_s)
82
#define        __SCCSID2(_s)
83
#if 0        /* XXX userland __COPYRIGHTs have \ns in them */
84
#define        __COPYRIGHT(_s)        __IDSTRING(copyright,_s)
85
#else
86
#define        __COPYRIGHT(_s)                                                        \
87
        static const char copyright[] __attribute__((__unused__)) = _s
88
#endif
89
90
#if defined(USE_KERNEL_RCSIDS) || !defined(_KERNEL)
91
#define        __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
92
#else
93
#define        __KERNEL_RCSID(_n,_s)
94
#endif
95
#define        __KERNEL_SCCSID(_n,_s)
96
#define        __KERNEL_COPYRIGHT(_n, _s) __IDSTRING(__CONCAT(copyright,_n),_s)
97
98
#ifndef __lint__
99
#define        __link_set_make_entry(set, sym, type)                                \
100
        static void const * const                                        \
101
            __link_set_##set##_sym_##sym __used = &sym;                \
102
        __asm(".stabs \"___link_set_" #set "\", " #type ", 0, 0, _" #sym)
103
#else
104
#define        __link_set_make_entry(set, sym, type)                                \
105
        extern void const * const __link_set_##set##_sym_##sym
106
#endif /* __lint__ */
107
108
#define        __link_set_add_text(set, sym)        __link_set_make_entry(set, sym, 23)
109
#define        __link_set_add_rodata(set, sym)        __link_set_make_entry(set, sym, 23)
110
#define        __link_set_add_data(set, sym)        __link_set_make_entry(set, sym, 25)
111
#define        __link_set_add_bss(set, sym)        __link_set_make_entry(set, sym, 27)
112
113
#define        __link_set_decl(set, ptype)                                        \
114
extern struct {                                                                \
115
        int        __ls_length;                                                \
116
        ptype        *__ls_items[1];                                                \
117
} __link_set_##set
118
119
#define        __link_set_start(set)        (&(__link_set_##set).__ls_items[0])
120
#define        __link_set_end(set)                                                \
121
        (&(__link_set_##set).__ls_items[(__link_set_##set).__ls_length])
122
123
#define        __link_set_count(set)        ((__link_set_##set).__ls_length)
124
125
#endif /* !_SYS_CDEFS_AOUT_H_ */