diff options
author | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-15 12:23:55 +0000 |
---|---|---|
committer | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-15 12:23:55 +0000 |
commit | 0d87fcd2cd4825bd45150e83f9b34708946186f0 (patch) | |
tree | 1b2c780421da8cfa5c7c460e21fa7cc634af1f3b /gcc/config/rs6000/xcoff.h | |
parent | 958a71b8ff55307f590584359eea6da2bb1806db (diff) | |
download | ppe42-gcc-0d87fcd2cd4825bd45150e83f9b34708946186f0.tar.gz ppe42-gcc-0d87fcd2cd4825bd45150e83f9b34708946186f0.zip |
PR target/35483
Based on patches by Laurent Vivier.
* xcoffout.h (DBX_FINISH_STABS): Translate dollar sign to underscore.
* config/rs6000/rs6000-protos.h (rs6000_xcoff_strip_dollar): Declare.
* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Translate
dollar sign to underscore.
(ASM_OUTPUT_EXTERNAL): Same.
(ASM_OUTPUT_LABELREF): New.
* config/rs6000/rs6000.c (rs6000_xcoff_strip_dollar): New.
* config/rs6000/aix51.h (TARGET_USE_JCR_SECTION): Define.
* config/rs6000/aix52.h (TARGET_USE_JCR_SECTION): Define.
* config/rs6000/aix53.h (TARGET_USE_JCR_SECTION): Define.
* config/rs6000/aix61.h (TARGET_USE_JCR_SECTION): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141134 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000/xcoff.h')
-rw-r--r-- | gcc/config/rs6000/xcoff.h | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 3cf6e4b13ab..08e06b4a757 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -135,6 +135,7 @@ /* This macro produces the initial definition of a function name. On the RS/6000, we need to place an extra '.' in the function name and output the function descriptor. + Dollar signs are converted to underscores. The csect for the function will have already been created when text_section was selected. We do have to go back to that csect, however. @@ -143,36 +144,54 @@ are placeholders which no longer have any use. */ #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ -{ if (TREE_PUBLIC (DECL)) \ +{ char *buffer = (char *) alloca (strlen (NAME) + 1); \ + char *p; \ + int dollar_inside = 0; \ + strcpy (buffer, NAME); \ + p = strchr (buffer, '$'); \ + while (p) { \ + *p = '_'; \ + dollar_inside++; \ + p = strchr (p + 1, '$'); \ + } \ + if (TREE_PUBLIC (DECL)) \ { \ if (!RS6000_WEAK || !DECL_WEAK (decl)) \ { \ + if (dollar_inside) { \ + fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \ + fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \ + } \ fputs ("\t.globl .", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ putc ('\n', FILE); \ } \ } \ else \ { \ + if (dollar_inside) { \ + fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \ + fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \ + } \ fputs ("\t.lglobl .", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ putc ('\n', FILE); \ } \ fputs ("\t.csect ", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ fputs (":\n", FILE); \ fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ fputs (", TOC[tc0], 0\n", FILE); \ in_section = NULL; \ switch_to_section (function_section (DECL)); \ putc ('.', FILE); \ - RS6000_OUTPUT_BASENAME (FILE, NAME); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ fputs (":\n", FILE); \ if (write_symbols != NO_DEBUG) \ - xcoffout_declare_function (FILE, DECL, NAME); \ + xcoffout_declare_function (FILE, DECL, buffer); \ } /* Output a reference to SYM on FILE. */ @@ -180,11 +199,28 @@ #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \ rs6000_output_symbol_ref (FILE, SYM) -/* This says how to output an external. */ +/* This says how to output an external. + Dollar signs are converted to underscores. */ #undef ASM_OUTPUT_EXTERNAL #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ -{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \ +{ char *buffer = (char *) alloca (strlen (NAME) + 1); \ + char *p; \ + rtx _symref = XEXP (DECL_RTL (DECL), 0); \ + int dollar_inside = 0; \ + strcpy (buffer, NAME); \ + p = strchr (buffer, '$'); \ + while (p) { \ + *p = '_'; \ + dollar_inside++; \ + p = strchr (p + 1, '$'); \ + } \ + if (dollar_inside) { \ + fputs ("\t.extern .", FILE); \ + RS6000_OUTPUT_BASENAME (FILE, buffer); \ + putc ('\n', FILE); \ + fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \ + } \ if ((TREE_CODE (DECL) == VAR_DECL \ || TREE_CODE (DECL) == FUNCTION_DECL) \ && (NAME)[strlen (NAME) - 1] != ']') \ @@ -196,6 +232,12 @@ } \ } +/* This is how to output a reference to a user-level label named NAME. + `assemble_name' uses this. */ + +#define ASM_OUTPUT_LABELREF(FILE,NAME) \ + asm_fprintf ((FILE), "%U%s", rs6000_xcoff_strip_dollar (NAME)); + /* This is how to output an internal label prefix. rs6000.c uses this when generating traceback tables. */ |