From ebd97b96f754b3a2e6d68ce4218b6c3b26edc5de Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Sat, 15 Dec 2001 02:16:37 +0000 Subject: [PATCH] rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle DECL_WEAK for function descriptors. * config/rs6000/rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle DECL_WEAK for function descriptors. * config/rs6000/xcoff.h (HANDLE_PRAGMA_WEAK): Define if assembler weak support present. (ASM_WEAKEN_LABEL): Same. From-SVN: r48027 --- gcc/ChangeLog | 8 ++++++++ gcc/config/rs6000/rs6000.h | 22 ++++++++++++++++++---- gcc/config/rs6000/xcoff.h | 21 +++++++++++++++++---- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7dbcf88fe9e..cfa921d1c28 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-12-14 David Edelsohn + + * config/rs6000/rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle + DECL_WEAK for function descriptors. + * config/rs6000/xcoff.h (HANDLE_PRAGMA_WEAK): Define if assembler + weak support present. + (ASM_WEAKEN_LABEL): Same. + 2001-12-14 Kazu Hirata * config/h8300/h8300.md (anonymous pattern): Add a missing diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 627766ab55b..b809d6b0baa 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2469,8 +2469,13 @@ extern int toc_initialized; } \ } -/* This implementes the `alias' attribute. */ +#ifdef HAVE_GAS_WEAK +#define RS6000_WEAK 1 +#else +#define RS6000_WEAK 0 +#endif +/* This implementes the `alias' attribute. */ #define ASM_OUTPUT_DEF_FROM_DECLS(FILE,decl,target) \ do { \ const char * alias = XSTR (XEXP (DECL_RTL (decl), 0), 0); \ @@ -2480,9 +2485,18 @@ do { \ { \ if (TREE_PUBLIC (decl)) \ { \ - fputs ("\t.globl .", FILE); \ - assemble_name (FILE, alias); \ - putc ('\n', FILE); \ + if (RS6000_WEAK && DECL_WEAK (decl)) \ + { \ + fputs ("\t.weak .", FILE); \ + assemble_name (FILE, alias); \ + putc ('\n', FILE); \ + } \ + else \ + { \ + fputs ("\t.globl .", FILE); \ + assemble_name (FILE, alias); \ + putc ('\n', FILE); \ + } \ } \ else \ { \ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index d5a6ff082a6..890ec4aee30 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -438,9 +438,6 @@ toc_section () \ fprintf ((FILE), ",%d\n", (SIZE)); \ } while (0) -/* Used by definition of ASM_OUTPUT_DOUBLE_INT */ -#define DOUBLE_INT_ASM_OP "\t.llong " - /* This says how to output an assembler line to define a local common symbol. Alignment cannot be specified, but we can try to maintain @@ -454,9 +451,25 @@ toc_section () \ xcoff_bss_section_name); \ } while (0) +/* Output a weak symbol, if weak support present. */ +#ifdef HAVE_GAS_WEAK +#define HANDLE_PRAGMA_WEAK 1 + +#define ASM_WEAKEN_LABEL(FILE, NAME) \ + do \ + { \ + fputs ("\t.weak ", (FILE)); \ + assemble_name ((FILE), (NAME)); \ + fputc ('\n', (FILE)); \ + } \ + while (0) +#endif /* HAVE_GAS_WEAK */ + /* This is how we tell the assembler that two symbols have the same value. */ +#define SET_ASM_OP "\t.set " -#define SET_ASM_OP "\t.set\t" +/* Used by definition of ASM_OUTPUT_DOUBLE_INT */ +#define DOUBLE_INT_ASM_OP "\t.llong " /* These are various definitions for DWARF output. They could just use '.long' or '.word', but that aligns to a 4-byte boundary which -- 2.30.2