diff options
Diffstat (limited to 'libc-symbols.h')
-rw-r--r-- | libc-symbols.h | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/libc-symbols.h b/libc-symbols.h index bb5f54e..f7231f9 100644 --- a/libc-symbols.h +++ b/libc-symbols.h @@ -27,14 +27,13 @@ Cambridge, MA 02139, USA. */ We include config.h which is generated by configure. It should define for us the following symbols: + * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'. + * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'. * 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. - This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld. - * HAVE_ELF if using ELF, which supports weak symbols. - This implies HAVE_WEAK_SYMBOLS; set by --with-elf. - - * HAVE_WEAK_SYMBOLS if weak symbols are available in the assembler and - linker being used. Set by --with-weak-symbols. + * HAVE_ELF if using ELF, which supports weak symbols using `.weak'. + * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'. + * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'. */ @@ -79,23 +78,14 @@ extern const char _libc_intl_domainname[]; /* */ -/* The symbols in all the user (non-_) macros are C symbols. Predefined - should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD. - HAVE_WEAK_SYMBOLS is implied by the other two. HAVE_GNU_LD without - HAVE_ELF implies a.out. */ +/* The symbols in all the user (non-_) macros are C symbols. + HAVE_GNU_LD without HAVE_ELF implies a.out. */ -#ifndef HAVE_WEAK_SYMBOLS -#if defined (HAVE_ELF) || defined (HAVE_GNU_LD) +#if defined (HAVE_ASM_WEAK_DIRECTIVE) || defined (HAVE_ASM_WEAKEXT_DIRECTIVE) #define HAVE_WEAK_SYMBOLS #endif -#endif #ifndef __SYMBOL_PREFIX -#ifdef HAVE_ELF -#define NO_UNDERSCORES -#else -#include <sysdep.h> /* Should define NO_UNDERSCORES. */ -#endif #ifdef NO_UNDERSCORES #define __SYMBOL_PREFIX #else @@ -143,8 +133,21 @@ extern const char _libc_intl_domainname[]; #ifdef HAVE_WEAK_SYMBOLS + #ifdef ASSEMBLER +#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE + +/* Define ALIAS as a weak alias for ORIGINAL. + If weak aliases are not available, this defines a strong alias. */ +#define weak_alias(original, alias) \ + .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) + +/* Declare SYMBOL to be weak. */ +#define weak_symbol(symbol) .weakext C_SYMBOL_NAME (symbol) + +#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + /* Define ALIAS as a weak alias for ORIGINAL. If weak aliases are not available, this defines a strong alias. */ #define weak_alias(original, alias) \ @@ -154,12 +157,21 @@ extern const char _libc_intl_domainname[]; /* Declare SYMBOL to be weak. */ #define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol) -#else +#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ + +#else /* ! ASSEMBLER */ + +#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE +#define weak_symbol(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol); +#define weak_alias(original, alias) \ + asm (".weakext " __SYMBOL_PREFIX #alias ", " __SYMBOL_PREFIX #original); +#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ #define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); #define weak_alias(original, alias) \ asm (".weak " __SYMBOL_PREFIX #alias "\n" \ __SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original); -#endif +#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */ +#endif /* ! ASSEMBLER */ #else #define weak_alias(original, alias) strong_alias(original, alias) #define weak_symbol(symbol) /* Do nothing. */ |