diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libc-symbols.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h index dcc4712f7d..bf77fda8d6 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -29,6 +29,8 @@ * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. + * ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type, + or leave it undefined if there is no .type directive. * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out, and for symbol set and warning messages extensions in a.out and ELF. * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. @@ -244,6 +246,34 @@ link_warning (name, \ "warning: " #name " is not implemented and will always fail") + +/* Declare SYMBOL to be TYPE (`function' or `object') and of SIZE bytes, + when the assembler supports such declarations (such as in ELF). + This is only necessary when defining something in assembly, or playing + funny alias games where the size should be other than what the compiler + thinks it is. */ +#define declare_symbol(symbol, type, size) \ + declare_symbol_1 (symbol, type, size) +#ifdef ASM_TYPE_DIRECTIVE_PREFIX +# ifdef __ASSEMBLER__ +# define declare_symbol_1(symbol, type, size) \ + .type C_SYMBOL_NAME (symbol), \ + declare_symbol_1_paste (ASM_TYPE_DIRECTIVE_PREFIX, type), size +# define declare_symbol_1_paste(a, b) declare_symbol_1_paste_1 (a,b) +# define declare_symbol_1_paste_1(a,b) a##b +# else /* Not __ASSEMBLER__. */ +# define declare_symbol_1(symbol, type, size) \ + asm (".type " __SYMBOL_PREFIX #symbol \ + declare_symbol_1_stringify (ASM_TYPE_DIRECTIVE_PREFIX) #type \ + "\n\t.size " __SYMBOL_PREFIX #symbol ", " #size); +# define declare_symbol_1_stringify(x) declare_symbol_1_stringify_1 (x) +# define declare_symbol_1_stringify_1(x) #x +# endif /* __ASSEMBLER__ */ +#else +# define declare_symbol_1(symbol, type, size) /* Nothing. */ +#endif + + /* */ |