30#ifndef _SYS_CDEFS_ELF_H_
31#define _SYS_CDEFS_ELF_H_
33#ifdef __LEADING_UNDERSCORE
34#define _C_LABEL(x) __CONCAT(_,x)
35#define _C_LABEL_STRING(x) "_"x
38#define _C_LABEL_STRING(x) x
42#define ___RENAME(x) __asm__(___STRING(_C_LABEL(x)))
44#ifdef __LEADING_UNDERSCORE
45#define ___RENAME(x) ____RENAME(_x)
46#define ____RENAME(x) __asm__(___STRING(x))
48#define ___RENAME(x) __asm__(___STRING(x))
52#define __indr_reference(sym,alias)
55#define __strong_alias(alias,sym) \
56 __asm__(".global " _C_LABEL_STRING(#alias) "\n" \
57 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
59#define __weak_alias(alias,sym) \
60 __asm__(".weak " _C_LABEL_STRING(#alias) "\n" \
61 _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));
62#define __weak_extern(sym) \
63 __asm__(".weak " _C_LABEL_STRING(#sym));
64#define __warn_references(sym,msg) \
65 __asm__(".section .gnu.warning." #sym "\n\t.ascii \"" msg "\"\n\t.text");
69#ifdef __LEADING_UNDERSCORE
70#define __weak_alias(alias,sym) ___weak_alias(_alias,_sym)
71#define ___weak_alias(alias,sym) \
72 __asm__(".weak alias\nalias = sym");
74#define __weak_alias(alias,sym) \
75 __asm__(".weak alias\nalias = sym");
77#ifdef __LEADING_UNDERSCORE
78#define __weak_extern(sym) ___weak_extern(_sym)
79#define ___weak_extern(sym) \
82#define __weak_extern(sym) \
85#define __warn_references(sym,msg) \
86 __asm__(".section .gnu.warning.sym\n\t.ascii msg ; .text");
91#define __SECTIONSTRING(_sec, _str) \
92 __asm__(".section " #_sec "\n\t.asciz \"" _str "\"\n\t.previous")
94#define __SECTIONSTRING(_sec, _str) \
95 __asm__(".section _sec\n\t.asciz _str\n\t.previous")
98#define __IDSTRING(_n,_s) __SECTIONSTRING(.ident,_s)
100#define __RCSID(_s) __IDSTRING(rcsid,_s)
104#define __COPYRIGHT(_s) __SECTIONSTRING(.copyright,_s)
106#define __COPYRIGHT(_s) \
107 static const char copyright[] \
108 __attribute__((__unused__,__section__(".copyright"))) = _s
111#define __KERNEL_RCSID(_n, _s) __RCSID(_s)
112#define __KERNEL_SCCSID(_n, _s)
114#define __KERNEL_COPYRIGHT(_n, _s) __COPYRIGHT(_s)
116#define __KERNEL_COPYRIGHT(_n, _s) __SECTIONSTRING(.copyright, _s)
120#define __link_set_make_entry(set, sym) \
121 static void const * const __link_set_##set##_sym_##sym \
122 __section("link_set_" #set) __used = &sym
123#define __link_set_make_entry2(set, sym, n) \
124 static void const * const __link_set_##set##_sym_##sym##_##n \
125 __section("link_set_" #set) __used = &sym[n]
127#define __link_set_make_entry(set, sym) \
128 extern void const * const __link_set_##set##_sym_##sym
129#define __link_set_make_entry2(set, sym, n) \
130 extern void const * const __link_set_##set##_sym_##sym##_##n
133#define __link_set_add_text(set, sym) __link_set_make_entry(set, sym)
134#define __link_set_add_rodata(set, sym) __link_set_make_entry(set, sym)
135#define __link_set_add_data(set, sym) __link_set_make_entry(set, sym)
136#define __link_set_add_bss(set, sym) __link_set_make_entry(set, sym)
137#define __link_set_add_text2(set, sym, n) __link_set_make_entry2(set, sym, n)
138#define __link_set_add_rodata2(set, sym, n) __link_set_make_entry2(set, sym, n)
139#define __link_set_add_data2(set, sym, n) __link_set_make_entry2(set, sym, n)
140#define __link_set_add_bss2(set, sym, n) __link_set_make_entry2(set, sym, n)
142#define __link_set_decl(set, ptype) \
143 extern ptype * const __start_link_set_##set[]; \
144 extern ptype * const __stop_link_set_##set[] \
146#define __link_set_start(set) (__start_link_set_##set)
147#define __link_set_end(set) (__stop_link_set_##set)
149#define __link_set_count(set) \
150 (__link_set_end(set) - __link_set_start(set))