From: H.J. Lu Date: Tue, 17 Jul 2001 12:55:19 +0000 (+0000) Subject: c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIA... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3aa8ab7bfa8e38b018aa6eccf474d5d49643c49e;p=gcc.git c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS are defined. * c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS are defined. * defaults.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible. * config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL): Moved ... * config/mips/iris5.h: ... here. (HANDLE_SYSV_PRAGMA): Defined as 1. * varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS. * doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak symbol. Co-Authored-By: Rainer Orth From-SVN: r44072 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48466608a65..ce3195a6586 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-07-17 H.J. Lu + Rainer Orth + + * c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and + ASM_OUTPUT_WEAK_ALIAS are defined. + * defaults.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible. + * config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL): + Moved ... + * config/mips/iris5.h: ... here. + (HANDLE_SYSV_PRAGMA): Defined as 1. + * varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS. + * doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak + symbol. + 2001-07-17 Joseph S. Myers * c-parse.in (all_prefix_attributes): New variable. diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h index d15c3e5d35a..89ee4a7ef55 100644 --- a/gcc/c-pragma.h +++ b/gcc/c-pragma.h @@ -1,5 +1,5 @@ /* Pragma related interfaces. - Copyright (C) 1995, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -22,9 +22,9 @@ Boston, MA 02111-1307, USA. */ #define GCC_C_PRAGMA_H #ifdef HANDLE_SYSV_PRAGMA -/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are +/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS are defined. */ -#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF) +#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_WEAK_ALIAS) #define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK #endif diff --git a/gcc/config/mips/iris5.h b/gcc/config/mips/iris5.h index 59d172c96e8..eab210f9d44 100644 --- a/gcc/config/mips/iris5.h +++ b/gcc/config/mips/iris5.h @@ -170,3 +170,26 @@ do { \ tree name_tree = get_identifier (NAME); \ TREE_ASM_WRITTEN (name_tree) = 1; \ } while (0) + +/* This is how we tell the assembler that a symbol is weak. */ + +#define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE) \ + do \ + { \ + ASM_GLOBALIZE_LABEL (FILE, NAME); \ + fputs ("\t.weakext\t", FILE); \ + assemble_name (FILE, NAME); \ + if (VALUE) \ + { \ + fputc (' ', FILE); \ + assemble_name (FILE, VALUE); \ + } \ + fputc ('\n', FILE); \ + } \ + while (0) + +#define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0) + +/* Handle #pragma weak and #pragma pack. */ +#undef HANDLE_SYSV_PRAGMA +#define HANDLE_SYSV_PRAGMA 1 diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index 6f45cbb385f..bec3414f14f 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -207,23 +207,6 @@ Boston, MA 02111-1307, USA. */ #define TYPE_ASM_OP "\t.type\t" #define SIZE_ASM_OP "\t.size\t" -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ - do { \ - ASM_GLOBALIZE_LABEL (FILE, NAME); \ - fputs ("\t.weakext\t", FILE); \ - assemble_name (FILE, NAME); \ - if (VALUE) \ - { \ - fputc (' ', FILE); \ - assemble_name (FILE, VALUE); \ - } \ - fputc ('\n', FILE); \ - } while (0) - -#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0) - /* Irix assembler does not support the init_priority C++ attribute. */ #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 0 diff --git a/gcc/defaults.h b/gcc/defaults.h index a1001b99259..ed5be8bcf6e 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -142,6 +142,18 @@ do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0) ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM) #endif +/* This is how we tell the assembler that a symbol is weak. */ +#if !defined (ASM_OUTPUT_WEAK_ALIAS) && defined (ASM_OUTPUT_DEF) +#define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \ + do \ + { \ + ASM_WEAKEN_LABEL (STREAM, NAME); \ + if (VALUE) \ + ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \ + } \ + while (0) +#endif + /* This determines whether or not we support weak symbols. */ #ifndef SUPPORTS_WEAK #ifdef ASM_WEAKEN_LABEL diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index adf9870789c..6fcc3ba8a47 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6423,7 +6423,8 @@ correct for most systems. @item ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value}) A C statement to output to the stdio stream @var{stream} assembler code which defines (equates) the weak symbol @var{name} to have the value -@var{value}. +@var{value}. If @var{value} is @code{NULL}, it defines @var{name} as +an undefined weak symbol. Define this macro if the target only supports weak aliases; define @code{ASM_OUTPUT_DEF} instead if possible. diff --git a/gcc/varasm.c b/gcc/varasm.c index 8d7000c9dd9..76f1c675792 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4773,11 +4773,7 @@ weak_finish () for (t = weak_decls; t; t = t->next) { if (t->name) - { - ASM_WEAKEN_LABEL (asm_out_file, t->name); - if (t->value) - ASM_OUTPUT_DEF (asm_out_file, t->name, t->value); - } + ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value); } } #endif