]> gcc.gnu.org Git - gcc.git/commitdiff
system.h (STRIP_NAME_ENCODING): Poison it.
authorRichard Henderson <rth@redhat.com>
Sun, 19 May 2002 07:55:48 +0000 (00:55 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sun, 19 May 2002 07:55:48 +0000 (00:55 -0700)
* system.h (STRIP_NAME_ENCODING): Poison it.
* output.h (STRIP_NAME_ENCODING): Remove.
(default_strip_name_encoding): Declare.
* target-def.h (TARGET_STRIP_NAME_ENCODING): New.
* target.h (strip_name_encoding): New.
* varasm.c (default_strip_name_encoding): New.

* dwarf2asm.c, varasm.c, config/darwin.c, config/darwin.h,
config/alpha/alpha.c, config/arm/pe.c, config/avr/avr.c,
config/cris/cris.c, config/i386/cygwin.h, config/i386/interix.c,
config/i386/winnt.c, config/m32r/m32r.h, config/mcore/mcore-elf.h,
config/mcore/mcore-pe.h, config/mcore/mcore.c, config/mcore/mcore.h,
config/mips/mips.c, config/mn10200/mn10200.h, config/mn10300/mn10300.h,
config/pa/pa.c, config/pa/pa.h, config/pa/som.h,
config/rs6000/rs6000.c, config/rs6000/sysv4.h, config/rs6000/xcoff.h,
config/v850/v850.h: Use the hook, not the macro.

* config/darwin-protos.h, config/darwin.c, config/darwin.h,
config/alpha/alpha.c, config/alpha/alpha.h, config/h8300/h8300.c,
config/h8300/h8300.h, config/i386/cygwin.h, config/i386/i386-interix.h,
config/i386/i386-protos.h, config/i386/win32.h, config/i386/winnt.c,
config/ia64/ia64.c, config/ia64/ia64.h, config/m32r/m32r.c,
config/m32r/m32r.h, config/mcore/mcore.c, config/mcore/mcore.h,
config/pa/pa.c, config/rs6000/rs6000.c, config/rs6000/sysv4.h,
config/rs6000/xcoff.h, config/sh/sh.c, config/sh/sh.h,
config/v850/v850.c, config/v850/v850.h:
Move STRIP_NAME_ENCODING to out-of-line function and add
TARGET_STRIP_NAME_ENCODING.

* config/arm/arm.c, config/arm/arm.h, config/mmix/mmix-protos.h,
config/mmix/mmix.c, config/mmix/mmix.h: Replace STRIP_NAME_ENCODING
with TARGET_STRIP_NAME_ENCODING referencing existing function;
make function static.

* xcoffout.c: Include target.h
* Makefile.in (xcoffout.o): Update.

* config/avr/avr.c (avr_encode_section_info): Correct prototype.
* config/avr/avr.h (STRIP_NAME_ENCODING): Remove.
* config/rs6000/rs6000.c (rs6000_xcoff_unique_section): Mark
reloc argument unused.
* config/sh/sh.c (TARGET_ENCODE_SECTION_INFO): New.

* doc/tm.texi (TARGET_STRIP_NAME_ENCODING): Update from previous
STRIP_NAME_ENCODING docs.

From-SVN: r53615

54 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/pe.c
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/cris/cris.c
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/i386/cygwin.h
gcc/config/i386/i386-interix.h
gcc/config/i386/i386-protos.h
gcc/config/i386/interix.c
gcc/config/i386/win32.h
gcc/config/i386/winnt.c
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/m32r/m32r.c
gcc/config/m32r/m32r.h
gcc/config/mcore/mcore-elf.h
gcc/config/mcore/mcore-pe.h
gcc/config/mcore/mcore.c
gcc/config/mcore/mcore.h
gcc/config/mips/mips.c
gcc/config/mmix/mmix-protos.h
gcc/config/mmix/mmix.c
gcc/config/mmix/mmix.h
gcc/config/mn10200/mn10200.h
gcc/config/mn10300/mn10300.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/som.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/stormy16/stormy16.h
gcc/config/v850/v850.c
gcc/config/v850/v850.h
gcc/doc/tm.texi
gcc/dwarf2asm.c
gcc/output.h
gcc/system.h
gcc/target-def.h
gcc/target.h
gcc/varasm.c
gcc/xcoffout.c

index a8f2230f003fc9e8f20f885009ac7b5e8f71e24b..7994a01ae5bfefdc449a522058a278a138197011 100644 (file)
@@ -1,3 +1,51 @@
+2002-05-19  Richard Henderson  <rth@redhat.com>
+
+       * system.h (STRIP_NAME_ENCODING): Poison it.
+       * output.h (STRIP_NAME_ENCODING): Remove.
+       (default_strip_name_encoding): Declare.
+       * target-def.h (TARGET_STRIP_NAME_ENCODING): New.
+       * target.h (strip_name_encoding): New.
+       * varasm.c (default_strip_name_encoding): New.
+
+       * dwarf2asm.c, varasm.c, config/darwin.c, config/darwin.h,
+       config/alpha/alpha.c, config/arm/pe.c, config/avr/avr.c,
+       config/cris/cris.c, config/i386/cygwin.h, config/i386/interix.c,
+       config/i386/winnt.c, config/m32r/m32r.h, config/mcore/mcore-elf.h,
+       config/mcore/mcore-pe.h, config/mcore/mcore.c, config/mcore/mcore.h,
+       config/mips/mips.c, config/mn10200/mn10200.h, config/mn10300/mn10300.h,
+       config/pa/pa.c, config/pa/pa.h, config/pa/som.h,
+       config/rs6000/rs6000.c, config/rs6000/sysv4.h, config/rs6000/xcoff.h,
+       config/v850/v850.h: Use the hook, not the macro.
+
+       * config/darwin-protos.h, config/darwin.c, config/darwin.h,
+       config/alpha/alpha.c, config/alpha/alpha.h, config/h8300/h8300.c,
+       config/h8300/h8300.h, config/i386/cygwin.h, config/i386/i386-interix.h,
+       config/i386/i386-protos.h, config/i386/win32.h, config/i386/winnt.c,
+       config/ia64/ia64.c, config/ia64/ia64.h, config/m32r/m32r.c,
+       config/m32r/m32r.h, config/mcore/mcore.c, config/mcore/mcore.h,
+       config/pa/pa.c, config/rs6000/rs6000.c, config/rs6000/sysv4.h, 
+       config/rs6000/xcoff.h, config/sh/sh.c, config/sh/sh.h,
+       config/v850/v850.c, config/v850/v850.h:
+       Move STRIP_NAME_ENCODING to out-of-line function and add
+       TARGET_STRIP_NAME_ENCODING.
+
+       * config/arm/arm.c, config/arm/arm.h, config/mmix/mmix-protos.h,
+       config/mmix/mmix.c, config/mmix/mmix.h: Replace STRIP_NAME_ENCODING
+       with TARGET_STRIP_NAME_ENCODING referencing existing function;
+       make function static.
+
+       * xcoffout.c: Include target.h
+       * Makefile.in (xcoffout.o): Update.
+
+       * config/avr/avr.c (avr_encode_section_info): Correct prototype.
+       * config/avr/avr.h (STRIP_NAME_ENCODING): Remove.
+       * config/rs6000/rs6000.c (rs6000_xcoff_unique_section): Mark
+       reloc argument unused.
+       * config/sh/sh.c (TARGET_ENCODE_SECTION_INFO): New.
+
+       * doc/tm.texi (TARGET_STRIP_NAME_ENCODING): Update from previous
+       STRIP_NAME_ENCODING docs.
+
 2002-05-19  Andreas Jaeger  <aj@suse.de>
 
        * gengenrtl.c: Add prototype for excluded_rtx.
index 7c3f961dbf53096b72c7ae9d994c3598579be7f6..1a49dfb89028dad83420acca42ab73523484fadb 100644 (file)
@@ -1440,7 +1440,7 @@ dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \
 vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
    output.h vmsdbg.h debug.h langhooks.h
 xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) xcoffout.h \
-   flags.h toplev.h output.h dbxout.h $(GGC_H)
+   flags.h toplev.h output.h dbxout.h $(GGC_H) $(TARGET_H)
 emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    function.h $(REGS_H) insn-config.h $(RECOG_H) real.h $(GGC_H) \
    $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h toplev.h \
index 837ec6d908833b0e2e55593fa773fdabbbbd1a8a..d0b41f713200cbfcbe09522b54b347db9575370c 100644 (file)
@@ -119,6 +119,8 @@ static bool alpha_in_small_data_p
   PARAMS ((tree));
 static void alpha_encode_section_info
   PARAMS ((tree, int));
+static const char *alpha_strip_name_encoding
+  PARAMS ((const char *));
 static int some_small_symbolic_operand_1
   PARAMS ((rtx *, void *));
 static int split_small_symbolic_operand_1
@@ -212,6 +214,8 @@ static void vms_asm_out_destructor PARAMS ((rtx, int));
 #define TARGET_IN_SMALL_DATA_P alpha_in_small_data_p
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO alpha_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING alpha_strip_name_encoding
 
 #if TARGET_ABI_UNICOSMK
 static void unicosmk_asm_named_section PARAMS ((const char *, unsigned int));
@@ -1708,6 +1712,19 @@ alpha_encode_section_info (decl, first)
     }
 }
 
+/* Undo the effects of the above.  */
+
+static const char *
+alpha_strip_name_encoding (str)
+     const char *str;
+{
+  if (str[0] == '@')
+    str += 2;
+  if (str[0] == '*')
+    str++;
+  return str;
+}
+
 /* legitimate_address_p recognizes an RTL expression that is a valid
    memory address for an instruction.  The MODE argument is the
    machine mode for the MEM expression that wants to use this address.
@@ -8599,7 +8616,7 @@ unicosmk_unique_section (decl, reloc)
     abort ();
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  STRIP_NAME_ENCODING (name, name);
+  name = alpha_strip_name_encoding (name);
   len = strlen (name);
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -8830,8 +8847,7 @@ unicosmk_ssib_name ()
   x = XEXP (x, 0);
   if (GET_CODE (x) != SYMBOL_REF)
     abort ();
-  fnname = XSTR (x, 0);
-  STRIP_NAME_ENCODING (fnname, fnname);
+  fnname = alpha_strip_name_encoding (XSTR (x, 0));
 
   len = strlen (fnname);
   if (len + SSIB_PREFIX_LEN > 255)
@@ -9006,7 +9022,7 @@ unicosmk_output_externs (file)
       /* We have to strip the encoding and possibly remove user_label_prefix 
         from the identifier in order to handle -fleading-underscore and
         explicit asm names correctly (cf. gcc.dg/asm-names-1.c).  */
-      STRIP_NAME_ENCODING (real_name, p->name);
+      real_name = alpha_strip_name_encoding (p->name);
       if (len && p->name[0] == '*'
          && !memcmp (real_name, user_label_prefix, len))
        real_name += len;
index 260e641805aa5bac5dd3e028a7a40675b1cfba2d..7c1a912f27d5eba6c72cd86cfd2aa4b4a8e929da 100644 (file)
@@ -1724,15 +1724,6 @@ do {                                                                          \
 
 #define DATA_SECTION_ASM_OP "\t.data"
 
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)   \
-do {                                           \
-  (VAR) = (SYMBOL_NAME);                       \
-  if ((VAR)[0] == '@')                         \
-    (VAR) += 2;                                        \
-  if ((VAR)[0] == '*')                         \
-    (VAR)++;                                   \
-} while (0)
-
 /* How to refer to registers in assembler output.
    This sequence is indexed by compiler's hard-register-number (see above).  */
 
index cbcd1a14dca25df7119aa8a4c168a177df6695d0..111884d234b63776f1dd04bb54e9fcfe039d6f6a 100644 (file)
@@ -180,6 +180,9 @@ static void  arm_encode_section_info        PARAMS ((tree, int));
 #define TARGET_ENCODE_SECTION_INFO  arm_encode_section_info
 #endif
 
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING arm_strip_name_encoding
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Obstack for minipool constant handling.  */
index c3946d64c565cfb673ca7ae9b454a630d7d1f162..e4ee55acfae3a62084245d03a739c2584fa841e2 100644 (file)
@@ -1848,12 +1848,6 @@ typedef struct
   case '*':  return 1;                         \
   SUBTARGET_NAME_ENCODING_LENGTHS              
 
-/* This has to be handled by a function because more than part of the
-   ARM backend uses function name prefixes to encode attributes.  */
-#undef  STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME)  \
-  (VAR) = arm_strip_name_encoding (SYMBOL_NAME)
-
 /* This is how to output a reference to a user-level label named NAME.
    `assemble_name' uses this.  */
 #undef  ASM_OUTPUT_LABELREF
index de745586dc2bfe2da3070a34d225e6148c00cdd3..c86e23124b615b5abc9166c3e7b1ff4415d6272d 100644 (file)
@@ -257,8 +257,7 @@ arm_pe_unique_section (decl, reloc)
   const char * prefix;
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  /* Strip off any encoding in fnname.  */
-  STRIP_NAME_ENCODING (name, name);
+  name = arm_strip_name_encoding (name);
 
   /* The object is put in, for example, section .text$foo.
      The linker will then ultimately place them in .text
index 262ed6323c47425ed9d426b0d55e03cda01815b7..ea2a19354d1f1ee8f59b919e6d3e8380cec69a11 100644 (file)
@@ -65,7 +65,7 @@ static bool   avr_assemble_integer PARAMS ((rtx, unsigned int, int));
 static void   avr_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void   avr_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void   avr_unique_section PARAMS ((tree, int));
-extern void   avr_encode_section_info PARAMS ((tree, int));
+static void   avr_encode_section_info PARAMS ((tree, int));
 
 /* Allocate registers from r25 to r8 for parameters for function calls */
 #define FIRST_CUM_REG 26
@@ -4517,9 +4517,9 @@ avr_unique_section (decl, reloc)
   int len;
   const char *name, *prefix;
   char *string;
+
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  /* Strip off any encoding in name.  */
-  STRIP_NAME_ENCODING (name, name);
+  name = (* targetm.strip_name_encoding) (name);
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
@@ -4770,7 +4770,7 @@ avr_encode_section_info (decl, first)
       DECL_SECTION_NAME (decl) = build_string (strlen (dsec), dsec);
       TREE_READONLY (decl) = 1;
     }
-}   
+}
 
 /* Outputs to the stdio stream FILE some
    appropriate text to go at the start of an assembler file.  */
index c227241ff7413a6d00b46a1f8e098bb134eac13b..ecbc1e5fda91271b200367b7fcc368b8c5e1c47b 100644 (file)
@@ -1742,12 +1742,6 @@ progmem_section (void)                                                         \
    This macro is irrelevant if there is no separate readonly data
    section.  */
 
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
-  (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' || (SYMBOL_NAME)[0] == '@');
-/* `STRIP_NAME_ENCODING (VAR, SYM_NAME)'
-   Decode SYM_NAME and store the real name part in VAR, sans the
-   characters that encode section info.  */
-
 #define ASM_FILE_START(STREAM) asm_file_start (STREAM)
 /* A C expression which outputs to the stdio stream STREAM some
    appropriate text to go at the start of an assembler file.
index e9a323257d803189a8c3b64bda5d7c5ae1975413..f54f39e74d41cbb01a5b2433278927771417a863 100644 (file)
@@ -2591,7 +2591,7 @@ cris_asm_output_mi_thunk (stream, thunkdecl, delta, funcdecl)
     {
       const char *name = XSTR (XEXP (DECL_RTL (funcdecl), 0), 0);
 
-      STRIP_NAME_ENCODING (name, name);
+      name = (* targetm.strip_name_encoding) (name);
       fprintf (stream, "add.d ");
       assemble_name (stream, name);
       fprintf (stream, "%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX);
@@ -2889,7 +2889,7 @@ restart:
          const char *origstr = XSTR (x, 0);
          const char *str;
 
-         STRIP_NAME_ENCODING (str, origstr);
+         str = (* targetm.strip_name_encoding) (origstr);
 
          if (is_plt)
            {
index c72b0dd1b3a9a7836dfbec6c72942d70f206d316..14077298629e1325fda36d09df865ed969312f85 100644 (file)
@@ -59,6 +59,7 @@ extern void machopic_define_name PARAMS ((const char*));
 extern int machopic_name_defined_p PARAMS ((const char*));
 extern int machopic_ident_defined_p PARAMS ((tree));
 extern void darwin_encode_section_info PARAMS ((tree, int));
+extern const char *darwin_strip_name_encoding PARAMS ((const char *));
 
 #endif /* TREE_CODE */
 
index e6fe4204c0644d5f9649e82aecec23a4767b88ae..3b9ee8c3cbc382e27db142a091378d9b06b7b7b7 100644 (file)
@@ -278,7 +278,7 @@ machopic_non_lazy_ptr_name (name)
        return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
     }
 
-  STRIP_NAME_ENCODING (name, name);
+  name = darwin_strip_name_encoding (name);
 
   /* Try again, but comparing names this time.  */
   for (temp = machopic_non_lazy_pointers;
@@ -288,7 +288,7 @@ machopic_non_lazy_ptr_name (name)
       if (TREE_VALUE (temp))
        {
          temp_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
-         STRIP_NAME_ENCODING (temp_name, temp_name);
+         temp_name = darwin_strip_name_encoding (temp_name);
          if (strcmp (name, temp_name) == 0)
            return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
        }
@@ -360,7 +360,7 @@ machopic_stub_name (name)
        return IDENTIFIER_POINTER (TREE_PURPOSE (temp));
     }
 
-  STRIP_NAME_ENCODING (name, name);
+  name = darwin_strip_name_encoding (name);
 
   {
     char *buffer;
@@ -414,7 +414,8 @@ machopic_validate_stub_or_non_lazy_ptr (name, validate_stub)
           TREE_USED (temp) = 1;
          if (TREE_CODE (TREE_VALUE (temp)) == IDENTIFIER_NODE)
            TREE_SYMBOL_REFERENCED (TREE_VALUE (temp)) = 1;
-         STRIP_NAME_ENCODING (real_name, IDENTIFIER_POINTER (TREE_VALUE (temp)));
+         real_name = IDENTIFIER_POINTER (TREE_VALUE (temp));
+         real_name = darwin_strip_name_encoding (real_name);
          id2 = maybe_get_identifier (real_name);
          if (id2)
            TREE_SYMBOL_REFERENCED (id2) = 1;
@@ -846,7 +847,7 @@ machopic_finish (asm_out_file)
       if (sym_name[0] == '!' && sym_name[1] == 'T')
        continue;
 
-      STRIP_NAME_ENCODING (sym_name, sym_name);
+      sym_name = darwin_strip_name_encoding (sym_name);
 
       sym = alloca (strlen (sym_name) + 2);
       if (sym_name[0] == '*' || sym_name[0] == '&')
@@ -1015,6 +1016,15 @@ darwin_encode_section_info (decl, first)
     update_stubs (XSTR (sym_ref, 0));
 }
 
+/* Undo the effects of the above.  */
+
+const char *
+darwin_strip_name_encoding (str)
+     const char *str;
+{
+  return str[0] == '!' ? str + 4 : str;
+}
+
 /* Scan the list of non-lazy pointers and update any recorded names whose
    stripped name matches the argument.  */
 
@@ -1025,7 +1035,7 @@ update_non_lazy_ptrs (name)
   const char *name1, *name2;
   tree temp;
 
-  STRIP_NAME_ENCODING (name1, name);
+  name1 = darwin_strip_name_encoding (name);
 
   for (temp = machopic_non_lazy_pointers;
        temp != NULL_TREE; 
@@ -1035,7 +1045,7 @@ update_non_lazy_ptrs (name)
 
       if (*sym_name == '!')
        {
-         STRIP_NAME_ENCODING (name2, sym_name);
+         name2 = darwin_strip_name_encoding (sym_name);
          if (strcmp (name1, name2) == 0)
            {
              IDENTIFIER_POINTER (TREE_VALUE (temp)) = name;
@@ -1089,7 +1099,7 @@ update_stubs (name)
   const char *name1, *name2;
   tree temp;
 
-  STRIP_NAME_ENCODING (name1, name);
+  name1 = darwin_strip_name_encoding (name);
 
   for (temp = machopic_stubs;
        temp != NULL_TREE; 
@@ -1099,7 +1109,7 @@ update_stubs (name)
 
       if (*sym_name == '!')
        {
-         STRIP_NAME_ENCODING (name2, sym_name);
+         name2 = darwin_strip_name_encoding (sym_name);
          if (strcmp (name1, name2) == 0)
            {
              IDENTIFIER_POINTER (TREE_VALUE (temp)) = name;
index 14ab0ff98b74c2d8e263c68b8db795febdf15c13..0de241467d3f472755c7fca1a95c0b64c1df87f7 100644 (file)
@@ -235,28 +235,28 @@ do { text_section ();                                                     \
    Make Objective-C internal symbols local.  */
 
 #undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE,NAME) \
-  do {                                                                 \
-       STRIP_NAME_ENCODING (NAME, NAME);  \
-       if (NAME[0] == '&' || NAME[0] == '*')                           \
-         {                                                             \
-           int len = strlen (NAME);                                    \
-          if (len > 6 && !strcmp ("$stub", NAME + len - 5))            \
-            machopic_validate_stub_or_non_lazy_ptr (NAME, 1);          \
-          else if (len > 7 && !strcmp ("$stub\"", NAME + len - 6))     \
-            machopic_validate_stub_or_non_lazy_ptr (NAME, 1);          \
-          else if (len > 14 && !strcmp ("$non_lazy_ptr", NAME + len - 13)) \
-            machopic_validate_stub_or_non_lazy_ptr (NAME, 0);          \
-          fputs (&NAME[1], FILE); \
-        } \
-       else if (NAME[0] == '+' || NAME[0] == '-')   \
-         fprintf (FILE, "\"%s\"", NAME); \
-       else if (!strncmp (NAME, "_OBJC_", 6))  \
-         fprintf (FILE, "L%s", NAME);   \
-       else if (!strncmp (NAME, ".objc_class_name_", 17))              \
-        fprintf (FILE, "%s", NAME);                                    \
-       else                                                            \
-         fprintf (FILE, "_%s", NAME);                                  \
+#define ASM_OUTPUT_LABELREF(FILE,NAME)                                      \
+  do {                                                                      \
+       const char *xname = darwin_strip_name_encoding (NAME);               \
+       if (xname[0] == '&' || xname[0] == '*')                              \
+         {                                                                  \
+           int len = strlen (xname);                                        \
+          if (len > 6 && !strcmp ("$stub", xname + len - 5))                \
+            machopic_validate_stub_or_non_lazy_ptr (xname, 1);              \
+          else if (len > 7 && !strcmp ("$stub\"", xname + len - 6))         \
+            machopic_validate_stub_or_non_lazy_ptr (xname, 1);              \
+          else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
+            machopic_validate_stub_or_non_lazy_ptr (xname, 0);              \
+          fputs (&xname[1], FILE);                                          \
+        }                                                                   \
+       else if (xname[0] == '+' || xname[0] == '-')                         \
+         fprintf (FILE, "\"%s\"", xname);                                   \
+       else if (!strncmp (xname, "_OBJC_", 6))                              \
+         fprintf (FILE, "L%s", xname);                                      \
+       else if (!strncmp (xname, ".objc_class_name_", 17))                  \
+        fprintf (FILE, "%s", xname);                                        \
+       else                                                                 \
+         fprintf (FILE, "_%s", xname);                                      \
   } while (0)
 
 #undef ALIGN_ASM_OP
@@ -553,9 +553,7 @@ enum machopic_addr_class {
 #define MACHOPIC_PURE          (flag_pic == 2)
 
 #define TARGET_ENCODE_SECTION_INFO  darwin_encode_section_info
-
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)  \
-  ((VAR) = ((SYMBOL_NAME[0] == '!') ? (SYMBOL_NAME) + 4 : (SYMBOL_NAME)))
+#define TARGET_STRIP_NAME_ENCODING  darwin_strip_name_encoding
 
 #define GEN_BINDER_NAME_FOR_STUB(BUF,STUB,STUB_LENGTH)         \
   do {                                                         \
@@ -591,12 +589,11 @@ enum machopic_addr_class {
 
 #define GEN_LAZY_PTR_NAME_FOR_SYMBOL(BUF,SYMBOL,SYMBOL_LENGTH) \
   do {                                                         \
-    const char *symbol_ = (SYMBOL);                            \
+    const char *symbol_ = darwin_strip_name_encoding (SYMBOL); \
     char *buffer_ = (BUF);                                     \
-    STRIP_NAME_ENCODING (symbol_, symbol_);  \
     if (symbol_[0] == '"')                                     \
       {                                                                \
-        strcpy (buffer_, "\"L");                                       \
+        strcpy (buffer_, "\"L");                               \
         strcpy (buffer_ + 2, symbol_ + 1);                     \
        strcpy (buffer_ + (SYMBOL_LENGTH), "$lazy_ptr\"");      \
       }                                                                \
index 64d4e85f237081ce19aa3f15a650612a5f57be7b..bb78d4bb34f99810ca4dd4cba985b1dfdb80dcdd 100644 (file)
@@ -66,6 +66,7 @@ static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
 #endif
 static void h8300_encode_label PARAMS ((tree));
 static void h8300_encode_section_info PARAMS ((tree, int));
+static const char *h8300_strip_name_encoding PARAMS ((const char *));
 
 /* CPU_TYPE, says what cpu we're compiling for.  */
 int cpu_type;
@@ -115,6 +116,8 @@ const char *h8_push_op, *h8_pop_op, *h8_mov_op;
 #define TARGET_ASM_FUNCTION_EPILOGUE h8300_output_function_epilogue
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO h8300_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING h8300_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -3477,6 +3480,15 @@ h8300_encode_section_info (decl, first)
     }
 }
 
+/* Undo the effects of the above.  */
+
+static const char *
+h8300_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (*str == '*' || *str == '@' || *str == '&');
+}
+
 const char *
 output_simode_bld (bild, operands)
      int bild;
index 1baa95901c0262bc6f7edb4e112df106da47b794..6a888a95ff9dc333692c244d7897de1256a17c60 100644 (file)
@@ -1096,13 +1096,6 @@ struct cum_arg
 
 #define TINY_DATA_NAME_P(NAME) (*(NAME) == '&')
 
-/* Store the user-specified part of SYMBOL_NAME in VAR.
-   This is sort of inverse to targetm.encode_section_info.  */
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME)          \
-  (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'     \
-                          || (SYMBOL_NAME)[0] == '@'   \
-                          || (SYMBOL_NAME)[0] == '&');
-
 /* How to refer to registers in assembler output.
    This sequence is indexed by compiler's hard-register-number (see above).  */
 
index 7098066adc1dc9c2f9715458babfc67bd1c4bff1..0caf3c340578efea07cd91e169a46795e94a8155 100644 (file)
@@ -255,45 +255,16 @@ do {                                                                      \
    section and we need to set DECL_SECTION_NAME so we do that here.
    Note that we can be called twice on the same decl.  */
 
-extern void i386_pe_encode_section_info PARAMS ((TREE, int));
-
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
-
-/* Utility used only in this file.  */
-#define I386_PE_STRIP_ENCODING(SYM_NAME) \
-  ((SYM_NAME) + ((SYM_NAME)[0] == '@' \
-                 ? ((SYM_NAME)[3] == '*' ? 4 : 3) : 0) \
-             + ((SYM_NAME)[0] == '*' ? 1 : 0))
-
-/* This macro gets just the user-specified name
-   out of the string in a SYMBOL_REF.  Discard
-   trailing @[NUM] encoded by targetm.encode_section_info.  */
-#undef  STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)                           \
-do {                                                                   \
-  const char *_p;                                                      \
-  const char *_name = I386_PE_STRIP_ENCODING (SYMBOL_NAME);            \
-  for (_p = _name; *_p && *_p != '@'; ++_p)                            \
-    ;                                                                  \
-  if (*_p == '@')                                                      \
-    {                                                                  \
-      int _len = _p - _name;                                           \
-      char *_new_name = (char *) alloca (_len + 1);                    \
-      strncpy (_new_name, _name, _len);                                        \
-      _new_name[_len] = '\0';                                          \
-      (VAR) = _new_name;                                               \
-    }                                                                  \
-  else                                                                 \
-    (VAR) = _name;                                                     \
-} while (0)
-      
+#undef  TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
 \f
 /* Output a reference to a label.  */
 #undef ASM_OUTPUT_LABELREF
 #define ASM_OUTPUT_LABELREF(STREAM, NAME)              \
   fprintf (STREAM, "%s%s", USER_LABEL_PREFIX,          \
-          I386_PE_STRIP_ENCODING (NAME))               \
+          i386_pe_strip_name_encoding (NAME))          \
 
 /* Output a common block.  */
 #undef ASM_OUTPUT_COMMON
index fb0a9a9d87cabb089dd6aa6b8c243aee52939c33..630a7b9b746108376c82470fb6559837428dfaae 100644 (file)
@@ -299,40 +299,13 @@ while (0)
 
 /* Define this macro if references to a symbol must be treated
    differently depending on something about the variable or
-   function named by the symbol (such as what section it is in).
-
-   Apply stddef, handle (as yet unimplemented) pic.
-
-   stddef renaming does NOT apply to Alpha.  */
-
-const char *gen_stdcall_suffix PARAMS ((tree));
-void i386_interix_encode_section_info PARAMS ((tree, int));
+   function named by the symbol (such as what section it is in).  */
 
 #undef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO i386_interix_encode_section_info
-
-/* This macro gets just the user-specified name
-   out of the string in a SYMBOL_REF.  Discard
-   trailing @[NUM] encoded by targetm.encode_section_info.  */
-#undef  STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)                           \
-do {                                                                   \
-  const char *_p;                                                      \
-  const char *_name = SYMBOL_NAME;                                     \
-  for (_p = _name; *_p && *_p != '@'; ++_p)                            \
-    ;                                                                  \
-  if (*_p == '@')                                                      \
-    {                                                                  \
-      int _len = _p - _name;                                           \
-      char *_new_name = (char *) alloca (_len + 1);                    \
-      strncpy (_new_name, _name, _len);                                        \
-      _new_name[_len] = '\0';                                          \
-      (VAR) = _new_name;                                               \
-    }                                                                  \
-  else                                                                 \
-    (VAR) = _name;                                                     \
-} while (0)
-      
+#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
+#undef  TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
+
 #if 0  
 /* Turn this back on when the linker is updated to handle grouped
    .data$ sections correctly. See corresponding note in i386/interix.c. 
index b3b168845792acf478b6e83995d33f654ee2b904..4222bba2ba6a5bc2053287859f3bb3df8134463d 100644 (file)
@@ -199,3 +199,8 @@ extern unsigned int i386_pe_section_type_flags PARAMS ((tree, const char *,
 extern void i386_pe_asm_named_section PARAMS ((const char *, unsigned int));
 extern void x86_output_mi_thunk PARAMS ((FILE *, int, tree));
 #endif
+
+/* In winnt.c  */
+extern void i386_pe_encode_section_info PARAMS ((tree, int));
+extern const char *i386_pe_strip_name_encoding PARAMS ((const char *));
+extern const char *i386_pe_strip_name_encoding_full PARAMS ((const char *));
index dc9c3d6e4220470488ba54c7e3911dd98ca6c80b..58a19ab5de6c53c8f0a45a9522d2202ca976b52d 100644 (file)
@@ -102,8 +102,7 @@ i386_pe_unique_section (decl, reloc)
   char *string,*prefix;
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  /* Strip off any encoding in fnname.  */
-  STRIP_NAME_ENCODING (name, name);
+  name = (* targetm.strip_name_encoding) (name);
 
   /* The object is put in, for example, section .text$foo.
      The linker will then ultimately place them in .text
index 03ed49577758e06654b352a8791ab5e9c6b916cf..a9a8b2db6b14181657ad9c15a91f61472f953cb8 100644 (file)
@@ -104,30 +104,8 @@ Boston, MA 02111-1307, USA.  */
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
-
-/* This macro gets just the user-specified name
-   out of the string in a SYMBOL_REF.  Discard
-   trailing @[NUM] encoded by targetm.encode_section_info. 
-   Do we need the stripping of leading '*'?  */
-#undef  STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)                           \
-do {                                                                   \
-  const char *_p;                                                      \
-  const char *const _name = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'));\
-  for (_p = _name; *_p && *_p != '@'; ++_p)                            \
-    ;                                                                  \
-  if (*_p == '@')                                                      \
-    {                                                                  \
-      int _len = _p - _name;                                           \
-      char *_new_name = (char *) alloca (_len + 1);                    \
-      strncpy (_new_name, _name, _len);                                        \
-      _new_name[_len] = '\0';                                          \
-      (VAR) = _new_name;                                               \
-    }                                                                  \
-  else                                                                 \
-    (VAR) = _name;                                                     \
-} while (0)
-      
+#undef  TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
 
 /* Emit code to check the stack when allocating more that 4000
    bytes in one go.  */
index d88e7dbce738f49656d0c28daae03cdafd01e78e..d6f0a7a81aa18bb86edec2caf6fe64ce32816b3d 100644 (file)
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "tm_p.h"
 #include "toplev.h"
 #include "hashtab.h"
+#include "ggc.h"
 
 /* i386/PE specific attribute support.
 
@@ -422,6 +423,35 @@ i386_pe_encode_section_info (decl, first)
     }
 }
 
+/* Strip only the leading encoding, leaving the stdcall suffix.  */
+
+const char *
+i386_pe_strip_name_encoding (str)
+     const char *str;
+{
+  if (*str == '@')
+    str += 3;
+  if (*str == '*')
+    str += 1;
+  return str;
+}
+
+/* Also strip the stdcall suffix.  */
+
+const char *
+i386_pe_strip_name_encoding_full (str)
+     const char *str;
+{
+  const char *p;
+  const char *name = i386_pe_strip_name_encoding (str);
+  p = strchr (name, '@');
+  if (p)
+    return ggc_alloc_string (name, p - name);
+
+  return name;
+}
+
 void
 i386_pe_unique_section (decl, reloc)
      tree decl;
@@ -432,8 +462,7 @@ i386_pe_unique_section (decl, reloc)
   char *string;
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  /* Strip off any encoding in fnname.  */
-  STRIP_NAME_ENCODING (name, name);
+  name = i386_pe_strip_name_encoding_full (name);
 
   /* The object is put in, for example, section .text$foo.
      The linker will then ultimately place them in .text
@@ -663,7 +692,7 @@ i386_pe_asm_file_end (file)
       for (q = export_head; q != NULL; q = q->next)
        {
          fprintf (file, "\t.ascii \" -export:%s%s\"\n",
-                  I386_PE_STRIP_ENCODING (q->name),
+                  i386_pe_strip_name_encoding (q->name),
                   (q->is_data) ? ",data" : "");
        }
     }
index f62f92a27350ea5c779a25b8056b04f92da2f978..2d01810a956b9ac73f803a3cb8f23921f5e86d66 100644 (file)
@@ -127,6 +127,7 @@ static void emit_all_insn_group_barriers PARAMS ((FILE *, rtx));
 static void emit_predicate_relation_info PARAMS ((void));
 static bool ia64_in_small_data_p PARAMS ((tree));
 static void ia64_encode_section_info PARAMS ((tree, int));
+static const char *ia64_strip_name_encoding PARAMS ((const char *));
 static void process_epilogue PARAMS ((void));
 static int process_set PARAMS ((FILE *, rtx));
 
@@ -211,6 +212,8 @@ static const struct attribute_spec ia64_attribute_table[] =
 #define TARGET_IN_SMALL_DATA_P  ia64_in_small_data_p
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO ia64_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING ia64_strip_name_encoding
 
 #undef TARGET_SCHED_ADJUST_COST
 #define TARGET_SCHED_ADJUST_COST ia64_adjust_cost
@@ -6981,6 +6984,17 @@ ia64_encode_section_info (decl, first)
   else if (symbol_str[0] == SDATA_NAME_FLAG_CHAR)
     XSTR (symbol, 0) = ggc_strdup (symbol_str + 1);
 }
+
+static const char *
+ia64_strip_name_encoding (str)
+     const char *str;
+{
+  if (str[0] == SDATA_NAME_FLAG_CHAR)
+    str++;
+  if (str[0] == '*')
+    str++;
+  return str;
+}
 \f
 /* Output assembly directives for prologue regions.  */
 
index eaa1a7d1c5970e064a046c930953d33789b5053c..0d3d362830d0e23e137b549add8f3716a5b593b6 100644 (file)
@@ -1777,18 +1777,6 @@ do {                                                                     \
 #define SDATA_NAME_FLAG_CHAR '@'
 
 #define IA64_DEFAULT_GVALUE 8
-
-/* Decode SYM_NAME and store the real name part in VAR, sans the characters
-   that encode section info.  */
-
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME)  \
-do {                                           \
-  (VAR) = (SYMBOL_NAME);                       \
-  if ((VAR)[0] == SDATA_NAME_FLAG_CHAR)                \
-    (VAR)++;                                   \
-  if ((VAR)[0] == '*')                         \
-    (VAR)++;                                   \
-} while (0)
 \f
 /* Position Independent Code.  */
 
index 6140d0ff10a32475f231b046bf18fc28d6f97c99..b7ebaf35f025adcf7148c8d9a009afebed2f40cb 100644 (file)
@@ -76,7 +76,7 @@ static int    m32r_issue_rate    PARAMS ((void));
 
 static void m32r_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
 static void m32r_encode_section_info PARAMS ((tree, int));
-
+static const char *m32r_strip_name_encoding PARAMS ((const char *));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
@@ -107,6 +107,8 @@ static void m32r_encode_section_info PARAMS ((tree, int));
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO m32r_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING m32r_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -486,6 +488,17 @@ m32r_encode_section_info (decl, first)
     }
 }
 
+/* Undo the effects of the above.  */
+
+static const char *
+m32r_strip_name_encoding (str)
+     const char *str;
+{
+  str += ENCODED_NAME_P (str);
+  str += *str == '*';
+  return str;
+}
+
 /* Do anything needed before RTL is emitted for each function.  */
 
 void
index 2d2b637e236fbb96ac2dc355883914fbbdb30ab8..d055deba20d1b99a61f678419a35dfb121a048ea 100644 (file)
@@ -1611,15 +1611,6 @@ sbss_section ()                                                          \
  /*|| SMALL_NAME_P (SYMBOL_NAME)*/ \
  || MEDIUM_NAME_P (SYMBOL_NAME) \
  || LARGE_NAME_P (SYMBOL_NAME))
-
-/* Decode SYM_NAME and store the real name part in VAR, sans
-   the characters that encode section info.  */
-/* Note that we have to handle symbols like "%*start".  */
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
-do {                                                   \
-  (VAR) = (SYMBOL_NAME) + ENCODED_NAME_P (SYMBOL_NAME);        \
-  (VAR) += *(VAR) == '*';                              \
-} while (0)
 \f
 /* PIC */
 
@@ -1707,14 +1698,8 @@ do {                                                     \
 /* This is how to output a reference to a user-level label named NAME.
    `assemble_name' uses this.  */
 #undef  ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME)        \
-  do                                           \
-    {                                          \
-      const char * real_name;                  \
-      STRIP_NAME_ENCODING (real_name, (NAME)); \
-      asm_fprintf (FILE, "%U%s", real_name);   \
-    }                                          \
-  while (0)           
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME))
 
 /* If -Os, don't force line number labels to begin at the beginning of
    the word; we still want the assembler to try to put things in parallel,
index 2cdbae01063762701ae5f34101b00beff4f7e6b4..ced4886231a2553c6266ff1713c524611da116ad 100644 (file)
@@ -67,7 +67,7 @@ exports_section ()                                            \
     {                                                  \
       exports_section ();                              \
       fprintf (STREAM, "\t.ascii \" -export:%s\"\n",   \
-              MCORE_STRIP_NAME_ENCODING (NAME));       \
+              (* targetm.strip_name_encoding) (NAME)); \
     }                                                  \
   while (0);
 
index 651f3384b27d20e138ee7af1446278e60bf843e4..6668574458da22fcf2cee410bed80338d39a5850 100644 (file)
@@ -69,7 +69,7 @@ drectve_section ()                                            \
     {                                                  \
       drectve_section ();                              \
       fprintf (STREAM, "\t.ascii \" -export:%s\"\n",   \
-              MCORE_STRIP_NAME_ENCODING (NAME));       \
+              (* targetm.strip_name_encoding) (NAME)); \
     }                                                  \
   while (0);
 
index 61fc5bddbffbfa00bfe432865496ecacb715237c..7276d813e2744b0e394736fbf050cc32a661a184 100644 (file)
@@ -139,6 +139,7 @@ static void   mcore_asm_named_section      PARAMS ((const char *,
 #endif
 static void       mcore_unique_section        PARAMS ((tree, int));
 static void mcore_encode_section_info          PARAMS ((tree, int));
+static const char *mcore_strip_name_encoding   PARAMS ((const char *));
 \f
 /* Initialize the GCC target structure.  */
 #ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -159,6 +160,8 @@ static void mcore_encode_section_info               PARAMS ((tree, int));
 #define TARGET_ASM_UNIQUE_SECTION mcore_unique_section
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO mcore_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING mcore_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -3467,6 +3470,15 @@ mcore_encode_section_info (decl, first)
     }
 }
 
+/* Undo the effects of the above.  */
+
+static const char *
+mcore_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (str[0] == '@' ? 3 : 0);
+}
+
 /* MCore specific attribute support.
    dllexport - for exporting a function/variable that will live in a dll
    dllimport - for importing a function/variable from a dll
@@ -3535,7 +3547,7 @@ mcore_unique_section (decl, reloc)
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
   
   /* Strip off any encoding in name.  */
-  STRIP_NAME_ENCODING (name, name);
+  name = (* targetm.strip_name_encoding) (name);
 
   /* The object is put in, for example, section .text$foo.
      The linker will then ultimately place them in .text
index da9d20c57a5229cd17495dec0c9f280af65ade2e..682039e3db65934ac41dd4a1248b294ef9740cad 100644 (file)
@@ -1119,8 +1119,8 @@ switch_to_section (section, decl)                         \
 /* Output a reference to a label.  */
 #undef  ASM_OUTPUT_LABELREF
 #define ASM_OUTPUT_LABELREF(STREAM, NAME)  \
-  fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, MCORE_STRIP_NAME_ENCODING (NAME))
-
+  fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \
+          (* targetm.strip_name_encoding) (NAME))
 
 /* This is how to output an assembler line
    that says to advance the location counter
@@ -1133,16 +1133,6 @@ switch_to_section (section, decl)                                \
 #define ASM_DECLARE_RESULT(FILE, RESULT)
 #endif
 
-/* Strip export encoding from a function name.  */
-#define MCORE_STRIP_NAME_ENCODING(SYM_NAME) \
-  ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0))
-
-/* Strip any text from SYM_NAME added by targetm.encode_section_info
-   and store the result in VAR.  */
-#undef  STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR, SYM_NAME) \
-  (VAR) = MCORE_STRIP_NAME_ENCODING (SYM_NAME)
-
 #define MULTIPLE_SYMBOL_SPACES 1
 
 #define SUPPORTS_ONE_ONLY 1
index 123028c759e6347aa2278cb09e8ea3699548079d..9bcca17dcd36e6892a6fdeb249535428193fe254 100644 (file)
@@ -10285,8 +10285,8 @@ mips_unique_section (decl, reloc)
   };
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  name = (* targetm.strip_name_encoding) (name);
   size = int_size_in_bytes (TREE_TYPE (decl));
-  STRIP_NAME_ENCODING (name, name);
 
   /* Determine the base section we are interested in:
      0=text, 1=rodata, 2=data, 3=sdata, [4=bss].  */
index baa0849480af4ead685ca0abe4d6d59fd384eb4a..51f91ee2b8933c0b210f3169299b012765fb22d6 100644 (file)
@@ -33,7 +33,6 @@ extern int mmix_register_move_cost
   PARAMS ((enum machine_mode, enum reg_class, enum reg_class));
 extern const char *mmix_text_section_asm_op PARAMS ((void));
 extern const char *mmix_data_section_asm_op PARAMS ((void));
-extern const char *mmix_strip_name_encoding PARAMS ((const char *));
 extern void mmix_asm_file_start PARAMS ((FILE *));
 extern void mmix_asm_file_end PARAMS ((FILE *));
 extern void mmix_asm_output_source_filename PARAMS ((FILE *, const char *));
index d798fa91031f582dcdf92d9e2469321b3489b8eb..74c5b72903043a32c5256488b9d082f7eb45e8db 100644 (file)
@@ -99,6 +99,7 @@ static void mmix_output_octa PARAMS ((FILE *, HOST_WIDEST_INT, int));
 static bool mmix_assemble_integer PARAMS ((rtx, unsigned int, int));
 static void mmix_init_machine_status PARAMS ((struct function *));
 static void mmix_encode_section_info PARAMS ((tree, int));
+static const char *mmix_strip_name_encoding PARAMS ((const char *));
 
 extern void mmix_target_asm_function_prologue
   PARAMS ((FILE *, HOST_WIDE_INT));
@@ -130,6 +131,8 @@ extern void mmix_target_asm_function_epilogue
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  mmix_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING  mmix_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -1768,9 +1771,7 @@ mmix_encode_section_info (decl, first)
     }
 }
 
-/* STRIP_NAME_ENCODING.  */
-
-const char *
+static const char *
 mmix_strip_name_encoding (name)
      const char *name;
 {
index 9eb968b74bff3b40259ba4ab0a03ff31b1e55c96..0f9d5b71698aa144758eba388be472fff9428d87 100644 (file)
@@ -907,9 +907,6 @@ typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS;
 
 #define READONLY_DATA_SECTION_ASM_OP   "\t.section\t.rodata"
 
-#define STRIP_NAME_ENCODING(VAR, SYM_NAME) \
- (VAR) = mmix_strip_name_encoding (SYM_NAME)
-
 /* Node: PIC */
 /* (empty) */
 
index 1356fd07c042317219250a74df029385e510f676..16f5f829d1fbe14e5cfe6a804726239c1ff6242d 100644 (file)
@@ -830,12 +830,8 @@ struct cum_arg { int nbytes; };
    `assemble_name' uses this.  */
 
 #undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME)                  \
-  do {                                            \
-  const char* real_name;                          \
-  STRIP_NAME_ENCODING (real_name, (NAME));        \
-  fprintf (FILE, "_%s", real_name);               \
-  } while (0)           
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  fprintf (FILE, "_%s", (*targetm.strip_name_encoding) (NAME))
 
 /* Store in OUTPUT a string (made with alloca) containing
    an assembler-name for a local static variable named NAME.
index 2c1dc7af05b79c31fe3818ea3171d57d5f8273de..ddebedd4db4366288c7ce1cef68670ce9a4b069f 100644 (file)
@@ -911,12 +911,8 @@ struct cum_arg {int nbytes; };
    `assemble_name' uses this.  */
 
 #undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME)                  \
-  do {                                            \
-  const char* real_name;                          \
-  STRIP_NAME_ENCODING (real_name, (NAME));        \
-  fprintf (FILE, "_%s", real_name);               \
-  } while (0)           
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  fprintf (FILE, "_%s", (*targetm.strip_name_encoding) (NAME))
 
 /* Store in OUTPUT a string (made with alloca) containing
    an assembler-name for a local static variable named NAME.
index d12c1be910a02d77791548e33e6869178a55f702..41e5dc05c78ff1e53d87ea7c66e8bbe69edf760f 100644 (file)
@@ -117,6 +117,7 @@ static int pa_issue_rate PARAMS ((void));
 static void pa_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT))
      ATTRIBUTE_UNUSED;
 static void pa_encode_section_info PARAMS ((tree, int));
+static const char *pa_strip_name_encoding PARAMS ((const char *));
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -188,6 +189,8 @@ int n_deferred_plabels = 0;
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO pa_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING pa_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -6285,7 +6288,7 @@ output_call (insn, call_dest, sibcall)
 
              /* Gross.  We have just implicitly taken the address of this
                 function, mark it as such.  */
-             STRIP_NAME_ENCODING (real_name, name);
+             real_name = (*targetm.strip_name_encoding) (name);
              TREE_SYMBOL_REFERENCED (get_identifier (real_name)) = 1;
            }
 
@@ -6460,6 +6463,15 @@ pa_encode_section_info (decl, first)
     }
 }
 
+/* This is sort of inverse to pa_encode_section_info.  */
+
+static const char *
+pa_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (*str == '*' || *str == '@');
+}
+
 int
 function_label_operand (op, mode)
      rtx op;
index 55e4311b1a316c2c154613fe6e0609b7629e5f15..8f432c2cc0ebf26486dd2f9b778df4d426a5546d 100644 (file)
@@ -864,79 +864,80 @@ struct hppa_args {int words, nargs_prototype, indirect; };
 extern struct rtx_def *hppa_compare_op0, *hppa_compare_op1;
 extern enum cmp_type hppa_branch_type;
 
-#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
-{ const char *target_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
-  static unsigned int current_thunk_number; \
-  char label[16]; \
-  char *lab; \
-  ASM_GENERATE_INTERNAL_LABEL (label, "LTHN", current_thunk_number); \
-  STRIP_NAME_ENCODING (lab, label); \
-  STRIP_NAME_ENCODING (target_name, target_name); \
-  /* FIXME: total_code_bytes is not handled correctly in files with \
-     mi thunks.  */ \
-  pa_output_function_prologue (FILE, 0); \
-  if (VAL_14_BITS_P (DELTA)) \
-    { \
-      if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
-       { \
-         fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab); \
-         fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab); \
-         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
-         fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n"); \
-         fprintf (FILE, "\tdepi 0,31,2,%%r22\n"); \
-         fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n"); \
-         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
+#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION)            \
+do {                                                                        \
+  const char *target_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0);        \
+  static unsigned int current_thunk_number;                                 \
+  char label[16];                                                           \
+  char *lab;                                                                \
+  ASM_GENERATE_INTERNAL_LABEL (label, "LTHN", current_thunk_number);        \
+  lab = (*targetm.strip_name_encoding) (label);                                     \
+  target_name = (*targetm.strip_name_encoding) (target_name);               \
+  /* FIXME: total_code_bytes is not handled correctly in files with         \
+     mi thunks.  */                                                         \
+  pa_output_function_prologue (FILE, 0);                                    \
+  if (VAL_14_BITS_P (DELTA))                                                \
+    {                                                                       \
+      if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)          \
+       {                                                                    \
+         fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab);                     \
+         fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab);                 \
+         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n");                    \
+         fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n");                       \
+         fprintf (FILE, "\tdepi 0,31,2,%%r22\n");                           \
+         fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n");                    \
+         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n");                    \
          fprintf (FILE, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n"); \
-         fprintf (FILE, "\tbe 0(%%sr0,%%r22)\n\tldo "); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, "(%%r26),%%r26\n"); \
-       } \
-      else \
-       { \
-         fprintf (FILE, "\tb %s\n\tldo ", target_name); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, "(%%r26),%%r26\n"); \
-       } \
-    } \
-  else \
-    { \
-      if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
-       { \
-         fprintf (FILE, "\taddil L%%"); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, ",%%r26\n\tldo R%%"); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, "(%%r1),%%r26\n"); \
-         fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab); \
-         fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab); \
-         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
-         fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n"); \
-         fprintf (FILE, "\tdepi 0,31,2,%%r22\n"); \
-         fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n"); \
-         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n"); \
+         fprintf (FILE, "\tbe 0(%%sr0,%%r22)\n\tldo ");                     \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, "(%%r26),%%r26\n");                                 \
+       }                                                                    \
+      else                                                                  \
+       {                                                                    \
+         fprintf (FILE, "\tb %s\n\tldo ", target_name);                     \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, "(%%r26),%%r26\n");                                 \
+       }                                                                    \
+    }                                                                       \
+  else                                                                      \
+    {                                                                       \
+      if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)          \
+       {                                                                    \
+         fprintf (FILE, "\taddil L%%");                                     \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, ",%%r26\n\tldo R%%");                               \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, "(%%r1),%%r26\n");                                  \
+         fprintf (FILE, "\taddil LT%%%s,%%r19\n", lab);                     \
+         fprintf (FILE, "\tldw RT%%%s(%%r1),%%r22\n", lab);                 \
+         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n");                    \
+         fprintf (FILE, "\tbb,>=,n %%r22,30,.+16\n");                       \
+         fprintf (FILE, "\tdepi 0,31,2,%%r22\n");                           \
+         fprintf (FILE, "\tldw 4(%%sr0,%%r22),%%r19\n");                    \
+         fprintf (FILE, "\tldw 0(%%sr0,%%r22),%%r22\n");                    \
          fprintf (FILE, "\tldsid (%%sr0,%%r22),%%r1\n\tmtsp %%r1,%%sr0\n"); \
-         fprintf (FILE, "\tbe,n 0(%%sr0,%%r22)\n"); \
-       } \
-      else \
-       { \
-         fprintf (FILE, "\taddil L%%"); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, ",%%r26\n\tb %s\n\tldo R%%", target_name); \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA); \
-         fprintf (FILE, "(%%r1),%%r26\n"); \
-       } \
-    } \
-  fprintf (FILE, "\t.EXIT\n\t.PROCEND\n"); \
-  if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic) \
-    { \
-      data_section (); \
-      fprintf (FILE, "\t.align 4\n"); \
-      ASM_OUTPUT_INTERNAL_LABEL (FILE, "LTHN", current_thunk_number); \
-      fprintf (FILE, "\t.word P%%%s\n", target_name); \
-      function_section (THUNK_FNDECL); \
-    } \
-  current_thunk_number++; \
-}
+         fprintf (FILE, "\tbe,n 0(%%sr0,%%r22)\n");                         \
+       }                                                                    \
+      else                                                                  \
+       {                                                                    \
+         fprintf (FILE, "\taddil L%%");                                     \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, ",%%r26\n\tb %s\n\tldo R%%", target_name);          \
+         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, DELTA);                    \
+         fprintf (FILE, "(%%r1),%%r26\n");                                  \
+       }                                                                    \
+    }                                                                       \
+  fprintf (FILE, "\t.EXIT\n\t.PROCEND\n");                                  \
+  if (! TARGET_64BIT && ! TARGET_PORTABLE_RUNTIME && flag_pic)              \
+    {                                                                       \
+      data_section ();                                                      \
+      fprintf (FILE, "\t.align 4\n");                                       \
+      ASM_OUTPUT_INTERNAL_LABEL (FILE, "LTHN", current_thunk_number);       \
+      fprintf (FILE, "\t.word P%%%s\n", target_name);                       \
+      function_section (THUNK_FNDECL);                                      \
+    }                                                                       \
+  current_thunk_number++;                                                   \
+} while (0)
 
 /* On HPPA, we emit profiling code as rtl via PROFILE_HOOK rather than
    as assembly via FUNCTION_PROFILER.  Just output a local label.
@@ -1522,13 +1523,6 @@ do {                                                                     \
 
 #define FUNCTION_NAME_P(NAME)  (*(NAME) == '@')
 
-/* Store the user-specified part of SYMBOL_NAME in VAR.
-   This is sort of inverse to targetm.encode_section_info.  */
-
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)   \
-  (VAR) = ((SYMBOL_NAME)                       \
-          + (*(SYMBOL_NAME) == '*' || *(SYMBOL_NAME) == '@'))
-
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */
 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? TImode : DImode)
index 7c17ff6b8103ca5aa3dc104f39a3f05ea71bc7e7..9f0a964f32d37a445501bfd035424fcb73b2dfe5 100644 (file)
@@ -131,8 +131,7 @@ do {                                                                \
    that the section name will have a "." prefix.  */
 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, NAME) \
   {                                                                    \
-    const char *name;                                                  \
-    STRIP_NAME_ENCODING (name, NAME);                                  \
+    const char *name = (*targetm.strip_name_encoding) (NAME);          \
     if (TARGET_GAS && in_section == in_text)                           \
       fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
     else if (TARGET_GAS)                                               \
@@ -335,7 +334,7 @@ readonly_data ()                                                    \
        if (!function_label_operand (RTL, VOIDmode))                    \
         hppa_encode_label (RTL);                                       \
                                                                        \
-       STRIP_NAME_ENCODING (name, XSTR ((RTL), 0));                    \
+       name = (*targetm.strip_name_encoding) (XSTR ((RTL), 0));                \
        id = maybe_get_identifier (name);                               \
        if (! id || ! TREE_SYMBOL_REFERENCED (id))                      \
         {                                                              \
index e6e8ef93a543f6f9a402b0c26c308d6b83b73960..1a65a772271bbb7722a1388120643da144976bc3 100644 (file)
@@ -169,6 +169,7 @@ static void rs6000_elf_unique_section PARAMS ((tree, int));
 static void rs6000_elf_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                   unsigned HOST_WIDE_INT));
 static void rs6000_elf_encode_section_info PARAMS ((tree, int));
+static const char *rs6000_elf_strip_name_encoding PARAMS ((const char *));
 #endif
 #ifdef OBJECT_FORMAT_COFF
 static void xcoff_asm_named_section PARAMS ((const char *, unsigned int));
@@ -177,6 +178,7 @@ static void rs6000_xcoff_select_section PARAMS ((tree, int,
 static void rs6000_xcoff_unique_section PARAMS ((tree, int));
 static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                     unsigned HOST_WIDE_INT));
+static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *));
 #endif
 static void rs6000_xcoff_encode_section_info PARAMS ((tree, int))
      ATTRIBUTE_UNUSED;
@@ -10385,7 +10387,7 @@ output_toc (file, x, labelno, mode)
   else
     abort ();
 
-  STRIP_NAME_ENCODING (real_name, name);
+  real_name = (*targetm.strip_name_encoding) (name);
   if (TARGET_MINIMAL_TOC)
     fputs (TARGET_32BIT ? "\t.long " : DOUBLE_INT_ASM_OP, file);
   else
@@ -10557,7 +10559,7 @@ output_profile_hook (labelno)
       rtx fun;
 
       ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
-      STRIP_NAME_ENCODING (label_name, ggc_strdup (buf));
+      label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf));
       fun = gen_rtx_SYMBOL_REF (Pmode, label_name);
 
       emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1,
@@ -11075,7 +11077,8 @@ rs6000_elf_unique_section (decl, reloc)
        }
     }
 
-  STRIP_NAME_ENCODING (name, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+  name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  name = (*targetm.strip_name_encoding) (name);
   prefix = prefixes[sec][DECL_ONE_ONLY (decl)];
   len    = strlen (name) + strlen (prefix);
   string = alloca (len + 1);
@@ -11167,6 +11170,15 @@ rs6000_elf_encode_section_info (decl, first)
     }
 }
 
+static const char *
+rs6000_elf_strip_name_encoding (str)
+     const char *str;
+{
+  while (*str == '*' || *str == '@')
+    str++;
+  return str;
+}
+
 #endif /* USING_ELFOS_H */
 
 \f
@@ -11432,7 +11444,7 @@ machopic_output_stub (file, symb, stub)
   static int label = 0;
 
   /* Lose our funky encoding stuff so it doesn't contaminate the stub.  */
-  STRIP_NAME_ENCODING (symb, symb);
+  symb = (*targetm.strip_name_encoding) (symb);
 
   label += 1;
 
@@ -11671,7 +11683,7 @@ rs6000_xcoff_select_section (exp, reloc, align)
 static void
 rs6000_xcoff_unique_section (decl, reloc)
      tree decl;
-     int reloc;
+     int reloc ATTRIBUTE_UNUSED;
 {
   const char *name;
   char *string;
@@ -11704,6 +11716,23 @@ rs6000_xcoff_select_rtx_section (mode, x, align)
   else
     read_only_private_data_section ();
 }
+
+/* Remove any trailing [DS] or the like from the symbol name.  */
+
+static const char *
+rs6000_xcoff_strip_name_encoding (name)
+     const char *name;
+{
+  size_t len;
+  if (*name == '*')
+    name++;
+  len = strlen (name);
+  if (name[len - 1] == ']')
+    return ggc_alloc_string (name, len - 4);
+  else
+    return name;
+}
+
 #endif /* OBJECT_FORMAT_COFF */
 
 /* Note that this is also used for ELF64.  */
index 0c601d05a4495b1a054c5e1d963d94974858b35c..8aee2e22a857313a342344bb5b503b1e478f54a5 100644 (file)
@@ -625,7 +625,7 @@ extern int rs6000_pic_labelno;
       {                                                                        \
        const char *desc_name, *orig_name;                              \
                                                                        \
-        STRIP_NAME_ENCODING (orig_name, NAME);                         \
+        orig_name = (*targetm.strip_name_encoding) (NAME);             \
         desc_name = orig_name;                                         \
        while (*desc_name == '.')                                       \
          desc_name++;                                                  \
@@ -776,25 +776,14 @@ extern int fixuplabelno;
 /* Historically we have also supported stabs debugging.  */
 #define        DBX_DEBUGGING_INFO
 
-#undef TARGET_ENCODE_SECTION_INFO
 #define        TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
+#define        TARGET_STRIP_NAME_ENCODING  rs6000_elf_strip_name_encoding
 
 /* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
 
 #define        RS6000_OUTPUT_BASENAME(FILE, NAME)      \
     assemble_name (FILE, NAME)
 
-/* This macro gets just the user-specified name
-   out of the string in a SYMBOL_REF.  Discard
-   a leading * or @.  */
-#define        STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)                            \
-do {                                                                   \
-  const char *_name = SYMBOL_NAME;                                     \
-  while (*_name == '*' || *_name == '@')                               \
-    _name++;                                                           \
-  (VAR) = _name;                                                       \
-} while (0)
-
 /* This is how to output a reference to a user-level label named NAME.
    `assemble_name' uses this.  */
 
index 211e1fc4c6fb2e9ecbc70508ab6870c165d9ef7b..90f27276b6ad593f49598b6d2c620202080f1322 100644 (file)
@@ -163,6 +163,7 @@ toc_section ()                                              \
 
 #define TARGET_ASM_SELECT_RTX_SECTION  rs6000_xcoff_select_rtx_section
 #define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info
+#define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
 
 /* FP save and restore routines.  */
 #define        SAVE_FP_PREFIX "._savef"
@@ -183,13 +184,8 @@ toc_section ()                                             \
 
 /* This outputs NAME to FILE up to the first null or '['.  */
 
-#define RS6000_OUTPUT_BASENAME(FILE, NAME)     \
-  {                                            \
-    const char *_p;                            \
-                                               \
-    STRIP_NAME_ENCODING (_p, (NAME));          \
-    assemble_name ((FILE), _p);                        \
-  }
+#define RS6000_OUTPUT_BASENAME(FILE, NAME) \
+  assemble_name ((FILE), (*targetm.strip_name_encoding) (NAME))
 
 /* This is how to output the definition of a user-level label named NAME,
    such as the label on a static function or variable NAME.  */
@@ -204,28 +200,6 @@ toc_section ()                                             \
   do { fputs ("\t.globl ", FILE);      \
        RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0)
 
-/* Remove any trailing [DS] or the like from the symbol name.  */
-
-#define STRIP_NAME_ENCODING(VAR,NAME)                  \
-  do                                                   \
-    {                                                  \
-      const char *_name = (NAME);                      \
-      size_t _len;                                     \
-      if (*_name == '*')                               \
-        _name++;                                       \
-      _len = strlen (_name);                           \
-      if (_name[_len - 1] != ']')                      \
-       (VAR) = _name;                                  \
-      else                                             \
-       {                                               \
-         char *_new_name = (char *) alloca (_len + 1); \
-         strcpy (_new_name, _name);                    \
-         _new_name[_len - 4] = '\0';                   \
-         (VAR) = _new_name;                            \
-       }                                               \
-    }                                                  \
-  while (0)
-
 /* Output at beginning of assembler file.
 
    Initialize the section names for the RS/6000 at this point.
index b84f6220a9e0645efe5d1ca95f0967b5a07f7fcc..0dafbc32d11a0089874ef83907769a584b8f043e 100644 (file)
@@ -204,6 +204,7 @@ static bool sh_cannot_modify_jumps_p PARAMS ((void));
 static bool sh_ms_bitfield_layout_p PARAMS ((tree));
 
 static void sh_encode_section_info PARAMS ((tree, int));
+static const char *sh_strip_name_encoding PARAMS ((const char *));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
@@ -242,6 +243,11 @@ static void sh_encode_section_info PARAMS ((tree, int));
 #undef TARGET_MS_BITFIELD_LAYOUT_P
 #define TARGET_MS_BITFIELD_LAYOUT_P sh_ms_bitfield_layout_p
 
+#undef TARGET_ENCODE_SECTION_INFO
+#define TARGET_ENCODE_SECTION_INFO sh_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING sh_strip_name_encoding
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Print the operand address in x to the stream.  */
@@ -6820,3 +6826,14 @@ sh_encode_section_info (decl, first)
   if (TARGET_SH5 && first && TREE_CODE (decl) != FUNCTION_DECL)
     XEXP (rtl, 0) = gen_datalabel_ref (symbol);
 }
+
+/* Undo the effects of the above.  */
+
+static const char *
+sh_strip_name_encoding (str)
+     const char *str;
+{
+  STRIP_DATALABEL_ENCODING (str, str);
+  str += *str == '*';
+  return str;
+}
index 084287424de396a3146332006a61c5c236d3d41b..c8e0c08cf2e5ef4e75e98a01ddd9304b4ad75f08 100644 (file)
@@ -2681,9 +2681,6 @@ while (0)
 #define STRIP_DATALABEL_ENCODING(VAR, SYM_NAME) \
   (VAR) = (SYM_NAME) + (DATALABEL_SYMNAME_P (SYM_NAME) \
                        ? strlen (SH_DATALABEL_ENCODING) : 0)
-#define STRIP_NAME_ENCODING(VAR, SYM_NAME) \
-  STRIP_DATALABEL_ENCODING((VAR), (SYM_NAME)), \
-  (VAR) += (*(VAR) == '*')
 
 /* We can't directly access anything that contains a symbol,
    nor can we indirect via the constant pool.  */
index 7ae92ee5413cf4fc54cffd04f97b6fb0c7e16929..7a6b166aec771527d49ba4ecd3551618667705cb 100644 (file)
@@ -2489,10 +2489,6 @@ do {                                                     \
 
    This macro is irrelevant if there is no separate readonly data section.  */
 #define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Decode SYM_NAME and store the real name part in VAR, sans the characters
-   that encode section info.  */
-/* #define STRIP_NAME_ENCODING(VAR, SYM_NAME) */
 \f
 /* Position Independent Code.  */
 
index df4d003176555c14f8563679e9b86a4b89ccae0d..e65dae596cbe8e299b6fa66ef9c89bfe19e656f1 100644 (file)
@@ -61,6 +61,7 @@ static void v850_insert_attributes   PARAMS ((tree, tree *));
 static void v850_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
 static void v850_encode_data_area    PARAMS ((tree));
 static void v850_encode_section_info PARAMS ((tree, int));
+static const char *v850_strip_name_encoding PARAMS ((const char *));
 
 /* True if the current function has anonymous arguments.  */
 int current_function_anonymous_args;
@@ -104,6 +105,8 @@ static int v850_interrupt_p = FALSE;
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO v850_encode_section_info
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING v850_strip_name_encoding
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -2218,6 +2221,13 @@ v850_encode_section_info (decl, first)
     v850_encode_data_area (decl);
 }
 
+static const char *
+v850_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (ENCODED_NAME_P (str) || *str == '*');
+}
+
 /* Return true if the given RTX is a register which can be restored
    by a function epilogue.  */
 int
index 54a1bec63243759b8c3874da2163fe80b3d154d1..bb753adbd7ae939ff437132fac555a332954bbc8 100644 (file)
@@ -1194,13 +1194,8 @@ zbss_section ()                                                          \
    `assemble_name' uses this.  */
 
 #undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF(FILE, NAME)           \
-  do {                                            \
-  const char* real_name;                          \
-  STRIP_NAME_ENCODING (real_name, (NAME));        \
-  asm_fprintf (FILE, "%U%s", real_name);          \
-  } while (0)
-
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME))
 
 /* Store in OUTPUT a string (made with alloca) containing
    an assembler-name for a local static variable named NAME.
@@ -1427,9 +1422,6 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K
    || TDA_NAME_P (SYMBOL_NAME)         \
    || SDA_NAME_P (SYMBOL_NAME))
 
-#define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \
-     (VAR) = (SYMBOL_NAME) + (ENCODED_NAME_P (SYMBOL_NAME) || *(SYMBOL_NAME) == '*')
-
 /* Define this if you have defined special-purpose predicates in the
    file `MACHINE.c'.  This macro is called within an initializer of an
    array of structures.  The first field in the structure is the name
index 69515b8033b72066f0de7e85ebc118932b2984a6..86971843b9d132ab3a0140fed1b033dec7977e42 100644 (file)
@@ -4781,8 +4781,8 @@ The best way to modify the name string is by adding text to the
 beginning, with suitable punctuation to prevent any ambiguity.  Allocate
 the new name in @code{saveable_obstack}.  You will have to modify
 @code{ASM_OUTPUT_LABELREF} to remove and decode the added text and
-output the name accordingly, and define @code{STRIP_NAME_ENCODING} to
-access the original name string.
+output the name accordingly, and define @code{TARGET_STRIP_NAME_ENCODING}
+to access the original name string.
 
 You can check the information stored here into the @code{symbol_ref} in
 the definitions of the macros @code{GO_IF_LEGITIMATE_ADDRESS} and
@@ -5765,12 +5765,6 @@ section, along with the assembler instructions.  Otherwise, the
 readonly data section is used.
 
 This macro is irrelevant if there is no separate readonly data section.
-
-@findex STRIP_NAME_ENCODING
-@item STRIP_NAME_ENCODING (@var{var}, @var{sym_name})
-Decode @var{sym_name} and store the real name part in @var{var}, sans
-the characters that encode section info.  Define this macro if
-@code{TARGET_ENCODE_SECTION_INFO} alters the symbol's name string.
 @end table
 
 @deftypefn {Target Hook} void TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align})
@@ -5838,6 +5832,12 @@ modified name string in the @code{symbol_ref} (if one bit is not
 enough information).
 @end deftypefn
 
+@deftypefn {Target Hook} const char *TARGET_STRIP_NAME_ENCODING (const char *name)
+Decode @var{name} and return the real name part, sans
+the characters that @code{TARGET_ENCODE_SECTION_INFO}
+may have added.
+@end deftypefn
+
 @node PIC
 @section Position Independent Code
 @cindex position independent code
index 53a02c7fcd5d42ca75f6f1f2ed02a3daa6a10f13..80be6513721d0f43c313de98dea1c10e449d725e 100644 (file)
@@ -739,7 +739,7 @@ dw2_force_const_mem (x)
   if (GET_CODE (x) != SYMBOL_REF)
     abort ();
 
-  STRIP_NAME_ENCODING (str, XSTR (x, 0));
+  str = (* targetm.strip_name_encoding) (XSTR (x, 0));
   node = splay_tree_lookup (indirect_pool, (splay_tree_key) str);
   if (node)
     decl = (tree) node->value;
index 82dc08341ff0516ec457c541b55b56b4ebd235ab..e274f43bc26b235c267988cdbe7bd8fcf5bf9511 100644 (file)
@@ -482,14 +482,6 @@ extern rtx this_is_asm_operands;
 /* User label prefix in effect for this compilation.  */
 extern const char *user_label_prefix;
 
-/* This macro gets just the user-specified name
-   out of the string in a SYMBOL_REF.  On most machines,
-   we discard the * if any and that's all.  */
-#ifndef STRIP_NAME_ENCODING
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
-  (VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
-#endif
-
 /* Default target function prologue and epilogue assembler output.  */
 extern void default_function_pro_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 
@@ -552,6 +544,8 @@ extern void default_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                unsigned HOST_WIDE_INT));
 extern void default_elf_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                    unsigned HOST_WIDE_INT));
+extern const char *default_strip_name_encoding PARAMS ((const char *));
+
 /* Emit data for vtable gc for GNU binutils.  */
 extern void assemble_vtable_entry PARAMS ((struct rtx_def *, HOST_WIDE_INT));
 extern void assemble_vtable_inherit PARAMS ((struct rtx_def *,
index d26515bc60fdfea51d346d6704f9c4c283ddd00a..465c47c285deee807c87ab1507ffc03ac15feaae 100644 (file)
@@ -596,7 +596,7 @@ typedef char _Bool;
        MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR       \
        ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE       \
        WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \
-       ENCODE_SECTION_INFO
+       ENCODE_SECTION_INFO STRIP_NAME_ENCODING
 
 /* And other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
index 557081652ac8aacb67e31443a45ce764204d26a7..40a3af0dcbda7c25e81299ccd9b6ab77a65f6dac 100644 (file)
@@ -205,6 +205,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_SECTION_TYPE_FLAGS default_section_type_flags
 #endif
 
+#ifndef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING default_strip_name_encoding
+#endif
+
 /* In hook.c.  */
 #define TARGET_CANNOT_MODIFY_JUMPS_P hook_void_bool_false
 #define TARGET_IN_SMALL_DATA_P hook_tree_bool_false
@@ -233,7 +237,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   TARGET_HAVE_CTORS_DTORS,                     \
   TARGET_CANNOT_MODIFY_JUMPS_P,                        \
   TARGET_IN_SMALL_DATA_P,                      \
-  TARGET_ENCODE_SECTION_INFO                   \
+  TARGET_ENCODE_SECTION_INFO,                  \
+  TARGET_STRIP_NAME_ENCODING                   \
 }
 
 #include "hooks.h"
index 97dd6d52bae0acabd71cea0dda0ec2c7b335f772..1864d4a88f9e68fdb0b1ca6a396a0fff1b2983f6 100644 (file)
@@ -247,6 +247,9 @@ struct gcc_target
   /* Do something target-specific to record properties of the DECL into
      the associated SYMBOL_REF.  */
   void (* encode_section_info) PARAMS ((tree, int));
+
+  /* Undo the effects of encode_section_info on the symbol string.  */
+  const char * (* strip_name_encoding) PARAMS ((const char *));
 };
 
 extern struct gcc_target targetm;
index eb57081525334c7316a6720400aac2d2f281312f..797b67689e53871789ddc775e8b29ca6ffd2eb47 100644 (file)
@@ -1207,7 +1207,7 @@ assemble_start_function (decl, fnname)
          const char *p;
          char *name;
 
-         STRIP_NAME_ENCODING (p, fnname);
+         p = (* targetm.strip_name_encoding) (fnname);
          name = permalloc (strlen (p) + 1);
          strcpy (name, p);
 
@@ -1527,7 +1527,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
       const char *p;
       char *xname;
 
-      STRIP_NAME_ENCODING (p, name);
+      p = (* targetm.strip_name_encoding) (name);
       xname = permalloc (strlen (p) + 1);
       strcpy (xname, p);
       first_global_object_name = xname;
@@ -1786,7 +1786,7 @@ assemble_name (file, name)
   const char *real_name;
   tree id;
 
-  STRIP_NAME_ENCODING (real_name, name);
+  real_name = (* targetm.strip_name_encoding) (name);
 
   id = maybe_get_identifier (real_name);
   if (id)
@@ -5477,7 +5477,7 @@ default_unique_section (decl, reloc)
   plen = strlen (prefix);
 
   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  STRIP_NAME_ENCODING (name, name);
+  name = (* targetm.strip_name_encoding) (name);
   nlen = strlen (name);
 
   string = alloca (nlen + plen + 1);
@@ -5535,3 +5535,13 @@ default_elf_select_rtx_section (mode, x, align)
 
   mergeable_constant_section (mode, align, 0);
 }
+
+/* By default, we do nothing for encode_section_info, so we need not
+   do anything but discard the '*' marker.  */
+
+const char *
+default_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (*str == '*');
+}
index 8396b7b334c56170a169c24b547e634a3b1fde55..e0265898a9ea6995715bcbe29bd85929c7dbda77 100644 (file)
@@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "toplev.h"
 #include "output.h"
 #include "ggc.h"
+#include "target.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 
This page took 0.20837 seconds and 5 git commands to generate.