diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rwxr-xr-x | configure | 31 | ||||
-rw-r--r-- | libc-symbols.h | 20 |
3 files changed, 48 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index 604d1e7149..c544f0043a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Tue Apr 18 14:00:19 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> * configure.in (libc_cv_asm_global_directive): New check to define ASM_GLOBAL_DIRECTIVE. * config.h.in: Add #undef ASM_GLOBAL_DIRECTIVE. + * libc-symbols.h (strong_alias_asm, strong_alias): Use + ASM_GLOBAL_DIRECTIVE on the alias. * sysdeps/unix/make_errlist.c (main): Don't generate "#ifdef HAVE_WEAK_SYMBOLS" #defns. diff --git a/configure b/configure index 0a4e97d3c9..e440083651 100755 --- a/configure +++ b/configure @@ -1134,7 +1134,7 @@ if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then else libc_cv_asm_set_directive=no fi -rm -f contest* +rm -f conftest* fi echo "$ac_t""$libc_cv_asm_set_directive" 1>&4 @@ -1145,6 +1145,35 @@ EOF fi +echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&4 +if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&4 +else + libc_cv_asm_global_directive=UNKNOWN +for ac_globl in .globl .global; do + cat > conftest.s <<EOF +.text +${ac_globl} foo +foo: .long 0 +EOF + if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then + libc_cv_asm_global_directive=${ac_globl} + fi + rm -f conftest* + test $libc_cv_asm_global_directive != UNKNOWN && break +done +fi + +echo "$ac_t""$libc_cv_asm_global_directive" 1>&4 +if test $libc_cv_asm_global_directive = UNKNOWN; then + { echo "configure: error: cannot determine asm global directive" 1>&2; exit 1; } +else + cat >> confdefs.h <<EOF +#define ASM_GLOBAL_DIRECTIVE ${libc_cv_asm_global_directive} +EOF + +fi + # sysdeps configure fragments may set these with files to be linked below. libc_link_dests= diff --git a/libc-symbols.h b/libc-symbols.h index a173b4d66d..1782737c93 100644 --- a/libc-symbols.h +++ b/libc-symbols.h @@ -79,37 +79,49 @@ Cambridge, MA 02139, USA. */ #endif #endif + /* Define ALIAS as a strong alias for ORIGINAL. */ #ifdef HAVE_ASM_SET_DIRECTIVE #define strong_alias_asm(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \ .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) #ifdef ASSEMBLER #define strong_alias(original, alias) strong_alias_asm (original, alias) #else #define strong_alias(original, alias) \ - asm (".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original); + asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \ + ".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original); #endif #else #define strong_alias_asm(original, alias) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) #ifdef ASSEMBLER #define strong_alias(original, alias) strong_alias_asm (original, alias) #else #define strong_alias(original, alias) \ - asm (__SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original); + asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \ + __SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original); #endif #endif -/* Define ALIAS as a weak alias for ORIGINAL. - If weak aliases are not available, this defines a strong alias. */ +/* Helper macros used above. */ +#define __string_1(x) __string_0(x) +#define __string_0(x) #x + + #ifdef HAVE_WEAK_SYMBOLS #ifdef ASSEMBLER + +/* Define ALIAS as a weak alias for ORIGINAL. + If weak aliases are not available, this defines a strong alias. */ #define weak_alias(original, alias) \ .weak C_SYMBOL_NAME (alias); \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) /* Declare SYMBOL to be weak. */ #define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol) + #else #define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol); #define weak_alias(original, alias) \ |