Patch to convert ASM_GLOBALIZE_LABEL to a target hook

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Aug 20 19:44:00 GMT 2002


 > From: Richard Henderson <rth@redhat.com>
 > 
 > On Tue, Aug 20, 2002 at 04:56:39PM -0400, Kaveh R. Ghazi wrote:
 > > I don't like hook_FILEptr_constcharptr_void. :-)
 > 
 > Works for me.  ;-)
 > r~

Ok I checked it in.  Here's the final patch for reference.
If you want me to tweek the ns32k stuff I'll do it separately.

		--Kaveh


2002-08-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* alpha.c (TARGET_ASM_GLOBALIZE_LABEL): Define for unicosmk.
	* alpha/elf.h (ASM_OUTPUT_EXTERNAL_LIBCALL,
	ASM_OUTPUT_ALIGNED_BSS): Use target hook.
	* alpha/osf.h (ASM_OUTPUT_WEAK_ALIAS): Likewise.
	* alpha/unicosmk.h (ASM_GLOBALIZE_LABEL): Delete.
	* arm/aof.h (ASM_GLOBALIZE_LABEL): Likewise.
	(GLOBAL_ASM_OP): Define.
	* arm.c (aof_globalize_label): New function.
	(TARGET_ASM_GLOBALIZE_LABEL): Define for AOF.
	* arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_BSS): Use target hook.
	* c4x.c (c4x_globalize_label): New function.
	(TARGET_ASM_GLOBALIZE_LABEL): Define for c4x.
	* c4x.h (ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP): Define.
	* cris/aout.h (ASM_OUTPUT_EXTERNAL_LIBCALL): Use target hook.
	* darwin-protos.h (darwin_globalize_label): Declare.
	* darwin.c (darwin_globalize_label): New function.
	* darwin.h (ASM_DECLARE_CLASS_REFERENCE): Use target hook.
	(ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP, TARGET_ASM_GLOBALIZE_LABEL): Define.
	* dsp16xx.c (asm_output_common): Use target hook.
	* elfos.h (ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise.
	* frv.h (ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP): Define.
	* i370.c (i370_globalize_label): New function.
	(TARGET_ASM_GLOBALIZE_LABEL): Define for i370.
	* i370.h (ASM_GLOBALIZE_LABEL): Delete.
	* i386.c (ix86_asm_file_end): Use target hook.
	* i386/sco5.h (ASM_GLOBALIZE_LABEL): Don't undef.
	(ASM_OUTPUT_EXTERNAL_LIBCALL): Use target hook.
	* ia64.c (ia64_asm_output_external): Likewise.
	* ia64/sysv4.h: Update comment.
	* m32r.h (ASM_OUTPUT_ALIGNED_BSS): Use target hook.
	* mips/elf.h (ASM_OUTPUT_ALIGNED_BSS): Likewise.
	* mips/iris5.h (ASM_OUTPUT_WEAK_ALIAS): Use target hook.
	* mips/linux.h (ASM_OUTPUT_ALIGNED_BSS): Likewise.
	* mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Use target hook.
	* mmix-protos.h (mmix_asm_globalize_label): Delete.
	* mmix.c (mmix_asm_globalize_label): Likewise.
	* mmix.h (ASM_GLOBALIZE_LABEL): Likewise.
	(GLOBAL_ASM_OP): Define.
	* ns32k.c (ns32k_globalize_label): New function.
	* ns32k.h (TARGET_ASM_GLOBALIZE_LABEL): Define for ns32k.
	(ASM_GLOBALIZE_LABEL): Delete.
	* pa/pa-linux.h (ASM_GLOBALIZE_LABEL): Don't undef.
	(TARGET_ASM_GLOBALIZE_LABEL): Undefine.
	* pa.c (pa_globalize_label): New function.
	* pa.h (ASM_GLOBALIZE_LABEL): Delete.
	(TARGET_ASM_GLOBALIZE_LABEL): Define for pa.
	* rs6000/darwin.h (ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP): Define.
	(TARGET_ASM_GLOBALIZE_LABEL): Undef.
	* rs6000/sysv4.h (ASM_OUTPUT_ALIGNED_BSS): Use target hook.
	* rs6000/xcoff.h (ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP): Define.
	* v850.c (v850_output_aligned_bss): Use target hook.
	* vax.c (vms_globalize_label): New function.
	(TARGET_ASM_GLOBALIZE_LABEL): Define for vms.
	* vax/vms.h (ASM_GLOBALIZE_LABEL): Delete.
	(GLOBAL_ASM_OP): Define.
	* defaults.h (ASM_GLOBALIZE_LABEL): Delete.
	* doc/tm.texi: Update docs.
	* dwarf2out.c (default_eh_frame_section, output_die_symbol): Use
	target hook.
	* final.c (output_alternate_entry_point): Likewise.
	* hooks.c (hook_FILEptr_constcharptr_void): New function.
	* hooks.h (hook_FILEptr_constcharptr_void): Declare.
	* output.h (assemble_global): Delete.
	(default_globalize_label): Declare.
	* system.h (ASM_GLOBALIZE_LABEL): Poison.
	* target-def.h (TARGET_ASM_GLOBALIZE_LABEL): Define.
	(TARGET_ASM_OUT): Add TARGET_ASM_GLOBALIZE_LABEL.
	* target.h (gcc_target): Add globalize_label member.
	* varasm.c (asm_output_bss, asm_output_aligned_bss,
	globalize_decl): Use target hook.
	(assemble_global): Delete.
	(default_globalize_label): New function.

	
diff -rup orig/egcc-CVS20020820/gcc/config/alpha/alpha.c egcc-CVS20020820/gcc/config/alpha/alpha.c
--- orig/egcc-CVS20020820/gcc/config/alpha/alpha.c	Thu Aug 15 07:00:26 2002
+++ egcc-CVS20020820/gcc/config/alpha/alpha.c	Tue Aug 20 19:45:45 2002
@@ -245,6 +245,8 @@ static void unicosmk_unique_section PARA
 # define TARGET_SECTION_TYPE_FLAGS unicosmk_section_type_flags
 # undef TARGET_ASM_UNIQUE_SECTION
 # define TARGET_ASM_UNIQUE_SECTION unicosmk_unique_section
+# undef TARGET_ASM_GLOBALIZE_LABEL
+# define TARGET_ASM_GLOBALIZE_LABEL hook_FILEptr_constcharptr_void
 #endif
 
 #undef TARGET_ASM_ALIGNED_HI_OP
diff -rup orig/egcc-CVS20020820/gcc/config/alpha/elf.h egcc-CVS20020820/gcc/config/alpha/elf.h
--- orig/egcc-CVS20020820/gcc/config/alpha/elf.h	Thu Jul 25 07:00:33 2002
+++ egcc-CVS20020820/gcc/config/alpha/elf.h	Tue Aug 20 19:45:45 2002
@@ -112,7 +112,7 @@ do {								\
 
 #undef  ASM_OUTPUT_EXTERNAL_LIBCALL
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)				\
-  ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
 
 /* This says how to output assembler code to declare an
    uninitialized external linkage data object.  Under SVR4,
@@ -156,7 +156,7 @@ do {									\
 #undef  ASM_OUTPUT_ALIGNED_BSS
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
 do {									\
-  ASM_GLOBALIZE_LABEL (FILE, NAME);					\
+  (*targetm.asm_out.globalize_label) (FILE, NAME);	       		\
   ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);			\
 } while (0)
 
diff -rup orig/egcc-CVS20020820/gcc/config/alpha/osf.h egcc-CVS20020820/gcc/config/alpha/osf.h
--- orig/egcc-CVS20020820/gcc/config/alpha/osf.h	Sun May 19 21:30:36 2002
+++ egcc-CVS20020820/gcc/config/alpha/osf.h	Tue Aug 20 19:45:45 2002
@@ -198,7 +198,7 @@ __enable_execute_stack (addr)						\
 #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE)	\
   do							\
     {							\
-      ASM_GLOBALIZE_LABEL (FILE, NAME);			\
+      (*targetm.asm_out.globalize_label) (FILE, NAME);  \
       fputs ("\t.weakext\t", FILE);			\
       assemble_name (FILE, NAME);			\
       if (VALUE)					\
diff -rup orig/egcc-CVS20020820/gcc/config/alpha/unicosmk.h egcc-CVS20020820/gcc/config/alpha/unicosmk.h
--- orig/egcc-CVS20020820/gcc/config/alpha/unicosmk.h	Mon Jul 15 22:57:22 2002
+++ egcc-CVS20020820/gcc/config/alpha/unicosmk.h	Tue Aug 20 19:45:45 2002
@@ -349,12 +349,6 @@ ssib_section ()			\
 
 #undef ASM_OUTPUT_SOURCE_FILENAME
 
-/* There is no directive for declaring a label as global. Instead, an 
-   additional colon must be appended when the label is defined.  */
-
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)
-
 /* This is how to output a label for a jump table.  Arguments are the same as
    for ASM_OUTPUT_INTERNAL_LABEL, except the insn for the jump table is
    passed.  */
diff -rup orig/egcc-CVS20020820/gcc/config/arm/aof.h egcc-CVS20020820/gcc/config/arm/aof.h
--- orig/egcc-CVS20020820/gcc/config/arm/aof.h	Sat May 18 22:21:06 2002
+++ egcc-CVS20020820/gcc/config/arm/aof.h	Tue Aug 20 19:45:45 2002
@@ -220,14 +220,8 @@ do					\
 
 extern int arm_main_function;
 
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME)		\
-do {							\
-  fprintf ((STREAM), "\tEXPORT\t");			\
-  assemble_name ((STREAM), (NAME));			\
-  fputc ('\n', (STREAM));				\
-  if ((NAME)[0] == 'm' && ! strcmp ((NAME), "main"))	\
-    arm_main_function = 1;				\
-} while (0)
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP "\tEXPORT\t"
 
 #define ASM_OUTPUT_LABEL(STREAM,NAME)	\
 do {					\
diff -rup orig/egcc-CVS20020820/gcc/config/arm/arm.c egcc-CVS20020820/gcc/config/arm/arm.c
--- orig/egcc-CVS20020820/gcc/config/arm/arm.c	Tue Aug 20 19:23:50 2002
+++ egcc-CVS20020820/gcc/config/arm/arm.c	Tue Aug 20 19:45:45 2002
@@ -123,6 +123,9 @@ static void	 arm_elf_asm_named_section	P
 #ifndef ARM_PE
 static void	 arm_encode_section_info	PARAMS ((tree, int));
 #endif
+#ifdef AOF_ASSEMBLER
+static void	 aof_globalize_label		PARAMS ((FILE *, const char *));
+#endif
 
 #undef Hint
 #undef Mmode
@@ -145,6 +148,8 @@ static void	 arm_encode_section_info	PAR
 #define TARGET_ASM_ALIGNED_HI_OP "\tDCW\t"
 #undef  TARGET_ASM_ALIGNED_SI_OP
 #define TARGET_ASM_ALIGNED_SI_OP "\tDCD\t"
+#undef TARGET_ASM_GLOBALIZE_LABEL
+#define TARGET_ASM_GLOBALIZE_LABEL aof_globalize_label
 #else
 #undef  TARGET_ASM_ALIGNED_SI_OP
 #define TARGET_ASM_ALIGNED_SI_OP NULL
@@ -10949,6 +10954,16 @@ aof_dump_imports (f)
       fputc ('\n', f);
       imports_list = imports_list->next;
     }
+}
+
+static void
+aof_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  default_globalize_label (stream, name);
+  if (! strcmp (name, "main"))
+    arm_main_function = 1;
 }
 #endif /* AOF_ASSEMBLER */
 
diff -rup orig/egcc-CVS20020820/gcc/config/arm/unknown-elf.h egcc-CVS20020820/gcc/config/arm/unknown-elf.h
--- orig/egcc-CVS20020820/gcc/config/arm/unknown-elf.h	Tue May 14 16:00:41 2002
+++ egcc-CVS20020820/gcc/config/arm/unknown-elf.h	Tue Aug 20 19:45:45 2002
@@ -61,7 +61,7 @@ Boston, MA 02111-1307, USA.  */
       else								\
 	bss_section ();							\
       									\
-      ASM_GLOBALIZE_LABEL (FILE, NAME);					\
+      (*targetm.asm_out.globalize_label) (FILE, NAME);			\
       									\
       ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));	\
 									\
diff -rup orig/egcc-CVS20020820/gcc/config/c4x/c4x.c egcc-CVS20020820/gcc/config/c4x/c4x.c
--- orig/egcc-CVS20020820/gcc/config/c4x/c4x.c	Tue Aug 20 19:23:50 2002
+++ egcc-CVS20020820/gcc/config/c4x/c4x.c	Tue Aug 20 19:45:45 2002
@@ -193,6 +193,7 @@ static void c4x_insert_attributes PARAMS
 static void c4x_asm_named_section PARAMS ((const char *, unsigned int));
 static int c4x_adjust_cost PARAMS ((rtx, rtx, rtx, int));
 static void c4x_encode_section_info PARAMS ((tree, int));
+static void c4x_globalize_label PARAMS ((FILE *, const char *));
 
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_BYTE_OP
@@ -220,6 +221,9 @@ static void c4x_encode_section_info PARA
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO c4x_encode_section_info
 
+#undef TARGET_ASM_GLOBALIZE_LABEL
+#define TARGET_ASM_GLOBALIZE_LABEL c4x_globalize_label
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Override command line options.
@@ -5045,3 +5049,11 @@ c4x_asm_named_section (name, flags)
   fprintf (asm_out_file, "\t.sect\t\"%s\"\n", name);
 }
 
+static void
+c4x_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  default_globalize_label (stream, name);
+  c4x_global_label (name);
+}
diff -rup orig/egcc-CVS20020820/gcc/config/c4x/c4x.h egcc-CVS20020820/gcc/config/c4x/c4x.h
--- orig/egcc-CVS20020820/gcc/config/c4x/c4x.h	Tue Aug 20 19:23:50 2002
+++ egcc-CVS20020820/gcc/config/c4x/c4x.h	Tue Aug 20 19:45:45 2002
@@ -1704,13 +1704,8 @@ fini_section ()							\
 
 #define NO_DOT_IN_LABEL		/* Only required for TI format.  */
 
-#define ASM_GLOBALIZE_LABEL(FILE, NAME) \
-  do {                                  \
-    fprintf (FILE, "\t.global\t");	\
-    assemble_name (FILE, NAME);		\
-    fputs ("\n", FILE); 	        \
-    c4x_global_label (NAME);		\
-  } while (0);
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP "\t.global\t"
 
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
 c4x_external_ref (NAME)
diff -rup orig/egcc-CVS20020820/gcc/config/cris/aout.h egcc-CVS20020820/gcc/config/cris/aout.h
--- orig/egcc-CVS20020820/gcc/config/cris/aout.h	Sun Jul 28 16:00:10 2002
+++ egcc-CVS20020820/gcc/config/cris/aout.h	Tue Aug 20 19:45:45 2002
@@ -277,7 +277,7 @@ Boston, MA 02111-1307, USA.  */
 #define SET_ASM_OP	"\t.set\t"
 
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)	\
-  ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
 
 #define ASM_WEAKEN_LABEL(FILE, NAME) 	\
   do					\
diff -rup orig/egcc-CVS20020820/gcc/config/darwin-protos.h egcc-CVS20020820/gcc/config/darwin-protos.h
--- orig/egcc-CVS20020820/gcc/config/darwin-protos.h	Tue Jul 16 22:53:55 2002
+++ egcc-CVS20020820/gcc/config/darwin-protos.h	Tue Aug 20 21:26:51 2002
@@ -114,3 +114,4 @@ extern void machopic_symbol_stub_section
 extern void machopic_picsymbol_stub_section PARAMS ((void));
 extern void darwin_exception_section PARAMS ((void));
 extern void darwin_eh_frame_section PARAMS ((void));
+extern void darwin_globalize_label PARAMS ((FILE *, const char *));
diff -rup orig/egcc-CVS20020820/gcc/config/darwin.c egcc-CVS20020820/gcc/config/darwin.c
--- orig/egcc-CVS20020820/gcc/config/darwin.c	Sun Aug 11 15:13:00 2002
+++ egcc-CVS20020820/gcc/config/darwin.c	Tue Aug 20 21:26:55 2002
@@ -1285,5 +1285,14 @@ machopic_asm_out_destructor (symbol, pri
     fprintf (asm_out_file, ".reference .destructors_used\n");
 }
 
+void
+darwin_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  if (!!strncmp (name, "_OBJC_", 6))
+    default_globalize_label (stream, name);
+}
+
 #include "gt-darwin.h"
 
diff -rup orig/egcc-CVS20020820/gcc/config/darwin.h egcc-CVS20020820/gcc/config/darwin.h
--- orig/egcc-CVS20020820/gcc/config/darwin.h	Wed Jul 31 22:41:18 2002
+++ egcc-CVS20020820/gcc/config/darwin.h	Tue Aug 20 19:45:45 2002
@@ -504,15 +504,13 @@ objc_section_init ()				\
 	   fprintf (FILE, "\t");					\
 	   assemble_name (FILE, NAME); 					\
 	   fprintf (FILE, "=0\n");					\
-	   assemble_global (NAME);					\
+	   (*targetm.asm_out.globalize_label) (FILE, NAME);		\
 	 }								\
        } while (0)
 
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
- do { const char *const _x = (NAME); if (!!strncmp (_x, "_OBJC_", 6)) { \
-  (fputs (".globl ", FILE), assemble_name (FILE, _x), fputs ("\n", FILE)); \
- }} while (0)
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP ".globl "
+#define TARGET_ASM_GLOBALIZE_LABEL darwin_globalize_label
 
 #undef ASM_GENERATE_INTERNAL_LABEL
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
diff -rup orig/egcc-CVS20020820/gcc/config/dsp16xx/dsp16xx.c egcc-CVS20020820/gcc/config/dsp16xx/dsp16xx.c
--- orig/egcc-CVS20020820/gcc/config/dsp16xx/dsp16xx.c	Sun Aug 11 15:22:05 2002
+++ egcc-CVS20020820/gcc/config/dsp16xx/dsp16xx.c	Tue Aug 20 19:45:45 2002
@@ -2198,7 +2198,7 @@ asm_output_common(file, name, size, roun
      int rounded;
 {
     bss_section ();
-    ASM_GLOBALIZE_LABEL (file, name);
+    (*targetm.asm_out.globalize_label) (file, name);
     assemble_name (file, name);
     fputs (":", file);
     if (rounded > 1)
diff -rup orig/egcc-CVS20020820/gcc/config/elfos.h egcc-CVS20020820/gcc/config/elfos.h
--- orig/egcc-CVS20020820/gcc/config/elfos.h	Sun Jul 28 16:00:09 2002
+++ egcc-CVS20020820/gcc/config/elfos.h	Tue Aug 20 19:45:45 2002
@@ -172,7 +172,7 @@ Boston, MA 02111-1307, USA.  */
    in each assembly file where they are referenced.  */
 
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)	\
-  ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
 
 /* This says how to output assembler code to declare an
    uninitialized external linkage data object.  Under SVR4,
diff -rup orig/egcc-CVS20020820/gcc/config/frv/frv.h egcc-CVS20020820/gcc/config/frv/frv.h
--- orig/egcc-CVS20020820/gcc/config/frv/frv.h	Sun Aug 11 15:22:05 2002
+++ egcc-CVS20020820/gcc/config/frv/frv.h	Tue Aug 20 19:45:45 2002
@@ -2997,17 +2997,8 @@ do {									\
   fputs (":\n", STREAM);						\
 } while (0)
 
-/* A C statement (sans semicolon) to output to the stdio stream STREAM some
-   commands that will make the label NAME global; that is, available for
-   reference from other files.  Use the expression `assemble_name (STREAM,
-   NAME)' to output the name itself; before and after that, output the
-   additional assembler syntax for making that name global, and a newline.  */
-#define ASM_GLOBALIZE_LABEL(STREAM, NAME)				\
-do {									\
-  fputs ("\t.globl ", STREAM);						\
-  assemble_name (STREAM, NAME);						\
-  fputs ("\n", STREAM);							\
-} while (0)
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP "\t.globl "
 
 /* A C statement (sans semicolon) to output to the stdio stream STREAM a
    reference in assembler syntax to a label named NAME.  This should add `_' to
diff -rup orig/egcc-CVS20020820/gcc/config/i370/i370.c egcc-CVS20020820/gcc/config/i370/i370.c
--- orig/egcc-CVS20020820/gcc/config/i370/i370.c	Sun May 19 07:01:02 2002
+++ egcc-CVS20020820/gcc/config/i370/i370.c	Tue Aug 20 21:47:57 2002
@@ -101,6 +101,7 @@ static label_node_t * mvs_get_label PARA
 static void i370_label_scan PARAMS ((void));
 #ifdef TARGET_HLASM
 static bool i370_hlasm_assemble_integer PARAMS ((rtx, unsigned int, int));
+static void i370_globalize_label PARAMS ((FILE *, const char *));
 #endif
 static void i370_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void i370_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
@@ -301,6 +302,8 @@ static const unsigned char ebcasc[256] =
 #define TARGET_ASM_ALIGNED_SI_OP NULL
 #undef TARGET_ASM_INTEGER
 #define TARGET_ASM_INTEGER i370_hlasm_assemble_integer
+#undef TARGET_ASM_GLOBALIZE_LABEL
+#define TARGET_ASM_GLOBALIZE_LABEL i370_globalize_label
 #endif
 
 #undef TARGET_ASM_FUNCTION_PROLOGUE
@@ -1416,6 +1419,19 @@ i370_output_function_prologue (f, l)
   /* find all labels in this routine */
   i370_label_scan ();
 }
+
+static void
+i370_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  char temp[MAX_MVS_LABEL_SIZE + 1];
+  if (mvs_check_alias (name, temp) == 2)
+    fprintf (stream, "%s\tALIAS\tC'%s'\n", temp, name);
+  fputs ("\tENTRY\t", stream);
+  assemble_name (stream, name);
+  putc ('\n', stream);
+}
 #endif /* TARGET_HLASM */
 
 
diff -rup orig/egcc-CVS20020820/gcc/config/i370/i370.h egcc-CVS20020820/gcc/config/i370/i370.h
--- orig/egcc-CVS20020820/gcc/config/i370/i370.h	Sun Aug 11 23:09:37 2002
+++ egcc-CVS20020820/gcc/config/i370/i370.h	Tue Aug 20 19:45:45 2002
@@ -1073,18 +1073,6 @@ enum reg_class
     }									\
 }
 
-#define ASM_GLOBALIZE_LABEL(FILE, NAME)					\
-{ 									\
-  char temp[MAX_MVS_LABEL_SIZE + 1];					\
-  if (mvs_check_alias (NAME, temp) == 2)				\
-    {									\
-      fprintf (FILE, "%s\tALIAS\tC'%s'\n", temp, NAME);			\
-    }									\
-  fputs ("\tENTRY\t", FILE);						\
-  assemble_name (FILE, NAME);						\
-  fputs ("\n", FILE);							\
-}
-
 /* MVS externals are limited to 8 characters, upper case only.
    The '_' is mapped to '@', except for MVS functions, then '#'.  */
 
diff -rup orig/egcc-CVS20020820/gcc/config/i386/i386.c egcc-CVS20020820/gcc/config/i386/i386.c
--- orig/egcc-CVS20020820/gcc/config/i386/i386.c	Mon Aug 12 07:00:28 2002
+++ egcc-CVS20020820/gcc/config/i386/i386.c	Tue Aug 20 19:45:45 2002
@@ -3931,7 +3931,7 @@ ix86_asm_file_end (file)
 	  (*targetm.asm_out.unique_section) (decl, 0);
 	  named_section (decl, NULL, 0);
 
-	  ASM_GLOBALIZE_LABEL (file, name);
+	  (*targetm.asm_out.globalize_label) (file, name);
 	  fputs ("\t.hidden\t", file);
 	  assemble_name (file, name);
 	  fputc ('\n', file);
diff -rup orig/egcc-CVS20020820/gcc/config/i386/sco5.h egcc-CVS20020820/gcc/config/i386/sco5.h
--- orig/egcc-CVS20020820/gcc/config/i386/sco5.h	Tue Jul 30 22:10:51 2002
+++ egcc-CVS20020820/gcc/config/i386/sco5.h	Tue Aug 20 19:45:45 2002
@@ -350,11 +350,9 @@ do {									\
 #define ASM_OUTPUT_IDENT(FILE, NAME) \
   fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME);
 
-#undef ASM_GLOBALIZE_LABEL
-
 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)				\
-  if (TARGET_ELF) ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+  if (TARGET_ELF) (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
 
 #undef ASM_OUTPUT_INTERNAL_LABEL
 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)			\
diff -rup orig/egcc-CVS20020820/gcc/config/ia64/ia64.c egcc-CVS20020820/gcc/config/ia64/ia64.c
--- orig/egcc-CVS20020820/gcc/config/ia64/ia64.c	Thu Jul 25 07:00:35 2002
+++ egcc-CVS20020820/gcc/config/ia64/ia64.c	Tue Aug 20 19:45:45 2002
@@ -4060,7 +4060,7 @@ ia64_asm_output_external (file, decl, na
   save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl));
   if (TREE_CODE (decl) == FUNCTION_DECL)
     ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
-  ASM_GLOBALIZE_LABEL (file, name);
+  (*targetm.asm_out.globalize_label) (file, name);
   TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) = save_referenced;
 }
 
diff -rup orig/egcc-CVS20020820/gcc/config/ia64/sysv4.h egcc-CVS20020820/gcc/config/ia64/sysv4.h
--- orig/egcc-CVS20020820/gcc/config/ia64/sysv4.h	Sat May 25 16:00:51 2002
+++ egcc-CVS20020820/gcc/config/ia64/sysv4.h	Tue Aug 20 19:45:45 2002
@@ -33,8 +33,8 @@
    the Intel simulator.  So we must explicitly put variables in .bss
    instead.  This matters only if we care about the Intel assembler.  */
 
-/* This is asm_output_aligned_bss from varasm.c without the ASM_GLOBALIZE_LABEL
-   call at the beginning.  */
+/* This is asm_output_aligned_bss from varasm.c without the
+   (*targetm.asm_out.globalize_label) call at the beginning.  */
 
 /* This is for final.c, because it is used by ASM_DECLARE_OBJECT_NAME.  */
 extern int size_directive_output;
diff -rup orig/egcc-CVS20020820/gcc/config/m32r/m32r.h egcc-CVS20020820/gcc/config/m32r/m32r.h
--- orig/egcc-CVS20020820/gcc/config/m32r/m32r.h	Tue Jul 30 22:10:51 2002
+++ egcc-CVS20020820/gcc/config/m32r/m32r.h	Tue Aug 20 19:45:45 2002
@@ -1852,7 +1852,7 @@ extern char m32r_punct_chars[256];
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)	\
   do								\
     {								\
-      ASM_GLOBALIZE_LABEL (FILE, NAME);				\
+      (*targetm.asm_out.globalize_label) (FILE, NAME);		\
       ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);	\
     }								\
   while (0)
diff -rup orig/egcc-CVS20020820/gcc/config/mips/elf.h egcc-CVS20020820/gcc/config/mips/elf.h
--- orig/egcc-CVS20020820/gcc/config/mips/elf.h	Wed Jul 31 07:00:29 2002
+++ egcc-CVS20020820/gcc/config/mips/elf.h	Tue Aug 20 19:45:45 2002
@@ -106,7 +106,7 @@ do {						\
 #ifndef ASM_OUTPUT_ALIGNED_BSS
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
 do {									\
-  ASM_GLOBALIZE_LABEL (FILE, NAME);					\
+  (*targetm.asm_out.globalize_label) (FILE, NAME);			\
   if (SIZE > 0 && SIZE <= mips_section_threshold)			\
     sbss_section ();							\
   else									\
diff -rup orig/egcc-CVS20020820/gcc/config/mips/iris5.h egcc-CVS20020820/gcc/config/mips/iris5.h
--- orig/egcc-CVS20020820/gcc/config/mips/iris5.h	Tue Jun 11 07:01:11 2002
+++ egcc-CVS20020820/gcc/config/mips/iris5.h	Tue Aug 20 19:45:45 2002
@@ -190,7 +190,7 @@ do {							\
 #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE)	\
   do							\
     {							\
-      ASM_GLOBALIZE_LABEL (FILE, NAME);			\
+      (*targetm.asm_out.globalize_label) (FILE, NAME);  \
       fputs ("\t.weakext\t", FILE);			\
       assemble_name (FILE, NAME);			\
       if (VALUE)					\
diff -rup orig/egcc-CVS20020820/gcc/config/mips/linux.h egcc-CVS20020820/gcc/config/mips/linux.h
--- orig/egcc-CVS20020820/gcc/config/mips/linux.h	Fri Aug  2 16:00:12 2002
+++ egcc-CVS20020820/gcc/config/mips/linux.h	Tue Aug 20 19:45:45 2002
@@ -45,7 +45,7 @@ Boston, MA 02111-1307, USA.  */
    `varasm.c' when defining this macro.  */
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)	\
 do {								\
-  ASM_GLOBALIZE_LABEL (FILE, NAME);				\
+  (*targetm.asm_out.globalize_label) (FILE, NAME);		\
   if (SIZE > 0 && SIZE <= mips_section_threshold)		\
     sbss_section ();						\
   else								\
diff -rup orig/egcc-CVS20020820/gcc/config/mips/mips.h egcc-CVS20020820/gcc/config/mips/mips.h
--- orig/egcc-CVS20020820/gcc/config/mips/mips.h	Tue Aug 20 19:22:02 2002
+++ egcc-CVS20020820/gcc/config/mips/mips.h	Tue Aug 20 19:45:45 2002
@@ -4335,7 +4335,7 @@ while (0)
 	    || DECL_INITIAL (DECL) == error_mark_node))			\
       {									\
 	if (TREE_PUBLIC (DECL) && DECL_NAME (DECL))			\
-	  ASM_GLOBALIZE_LABEL (STREAM, NAME);				\
+	  (*targetm.asm_out.globalize_label) (STREAM, NAME);		\
 	    								\
 	readonly_data_section ();					\
 	ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));	\
diff -rup orig/egcc-CVS20020820/gcc/config/mmix/mmix-protos.h egcc-CVS20020820/gcc/config/mmix/mmix-protos.h
--- orig/egcc-CVS20020820/gcc/config/mmix/mmix-protos.h	Sun Aug 11 15:22:06 2002
+++ egcc-CVS20020820/gcc/config/mmix/mmix-protos.h	Tue Aug 20 19:45:45 2002
@@ -40,7 +40,6 @@ extern void mmix_output_quoted_string PA
 extern void mmix_asm_output_source_line  PARAMS ((FILE *, int));
 extern void mmix_asm_output_ascii PARAMS ((FILE *, const char *, int));
 extern void mmix_asm_output_label PARAMS ((FILE *, const char *));
-extern void mmix_asm_globalize_label PARAMS ((FILE *, const char *));
 extern void mmix_asm_weaken_label PARAMS ((FILE *, const char *));
 extern void mmix_asm_output_labelref PARAMS ((FILE *, const char *));
 extern void mmix_asm_output_internal_label
diff -rup orig/egcc-CVS20020820/gcc/config/mmix/mmix.c egcc-CVS20020820/gcc/config/mmix/mmix.c
--- orig/egcc-CVS20020820/gcc/config/mmix/mmix.c	Tue Aug 20 19:23:51 2002
+++ egcc-CVS20020820/gcc/config/mmix/mmix.c	Tue Aug 20 19:45:45 2002
@@ -1520,18 +1520,6 @@ mmix_asm_declare_register_global (stream
      here.  */
 }
 
-/* ASM_GLOBALIZE_LABEL.  */
-
-void
-mmix_asm_globalize_label (stream, name)
-     FILE * stream ATTRIBUTE_UNUSED;
-     const char * name ATTRIBUTE_UNUSED;
-{
-  asm_fprintf (stream, "\t.global ");
-  assemble_name (stream, name);
-  putc ('\n', stream);
-}
-
 /* ASM_WEAKEN_LABEL.  */
 
 void
diff -rup orig/egcc-CVS20020820/gcc/config/mmix/mmix.h egcc-CVS20020820/gcc/config/mmix/mmix.h
--- orig/egcc-CVS20020820/gcc/config/mmix/mmix.h	Mon Aug 12 22:59:15 2002
+++ egcc-CVS20020820/gcc/config/mmix/mmix.h	Tue Aug 20 19:45:45 2002
@@ -980,8 +980,7 @@ typedef struct { int regs; int lib; } CU
 #define ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) \
  mmix_asm_declare_register_global (STREAM, DECL, REGNO, NAME)
 
-#define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
- mmix_asm_globalize_label (STREAM, NAME)
+#define GLOBAL_ASM_OP "\t.global "
 
 #define ASM_WEAKEN_LABEL(STREAM, NAME) \
  mmix_asm_weaken_label (STREAM, NAME)
diff -rup orig/egcc-CVS20020820/gcc/config/ns32k/ns32k.c egcc-CVS20020820/gcc/config/ns32k/ns32k.c
--- orig/egcc-CVS20020820/gcc/config/ns32k/ns32k.c	Sun May 19 07:01:15 2002
+++ egcc-CVS20020820/gcc/config/ns32k/ns32k.c	Tue Aug 20 19:45:45 2002
@@ -70,6 +70,9 @@ const struct attribute_spec ns32k_attrib
 static void ns32k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void ns32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void ns32k_encode_section_info PARAMS ((tree, int));
+#ifdef COLLECT
+static void ns32k_globalize_label PARAMS ((FILE *, const char *));
+#endif
 
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
@@ -1573,3 +1576,13 @@ ns32k_encode_section_info (decl, first)
 	   || ! TREE_PUBLIC (decl));
     }
 }
+
+#ifdef COLLECT
+static void
+ns32k_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  fprintf (stream, "\t.globl\t%s\n", name);
+}
+#endif
diff -rup orig/egcc-CVS20020820/gcc/config/ns32k/ns32k.h egcc-CVS20020820/gcc/config/ns32k/ns32k.h
--- orig/egcc-CVS20020820/gcc/config/ns32k/ns32k.h	Thu Aug  1 20:46:20 2002
+++ egcc-CVS20020820/gcc/config/ns32k/ns32k.h	Tue Aug 20 19:45:45 2002
@@ -1319,12 +1319,11 @@ __transfer_from_trampoline ()		\
 /* This is how to output a command to make the user-level label named NAME
    defined for reference from other files.  */
 
-#ifndef COLLECT
+#ifdef COLLECT
+#define TARGET_ASM_GLOBALIZE_LABEL ns32k_globalize_label
+#else
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP ".globl "
-#else
-#define ASM_GLOBALIZE_LABEL(STREAM,NAME)				\
-  fprintf ((STREAM), "\t.globl\t%s\n", (NAME));
 #endif
 
 /* This is how to output an internal numbered label where
diff -rup orig/egcc-CVS20020820/gcc/config/pa/pa-linux.h egcc-CVS20020820/gcc/config/pa/pa-linux.h
--- orig/egcc-CVS20020820/gcc/config/pa/pa-linux.h	Wed Jul 31 22:41:22 2002
+++ egcc-CVS20020820/gcc/config/pa/pa-linux.h	Tue Aug 20 19:45:45 2002
@@ -169,7 +169,7 @@ Boston, MA 02111-1307, USA.  */
    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
 
 /* Use the default.  */
-#undef ASM_GLOBALIZE_LABEL
+#undef TARGET_ASM_GLOBALIZE_LABEL
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP ".globl "
 
diff -rup orig/egcc-CVS20020820/gcc/config/pa/pa.c egcc-CVS20020820/gcc/config/pa/pa.c
--- orig/egcc-CVS20020820/gcc/config/pa/pa.c	Wed Aug  7 21:57:24 2002
+++ egcc-CVS20020820/gcc/config/pa/pa.c	Tue Aug 20 21:21:05 2002
@@ -116,6 +116,7 @@ static void pa_select_section PARAMS ((t
      ATTRIBUTE_UNUSED;
 static void pa_encode_section_info PARAMS ((tree, int));
 static const char *pa_strip_name_encoding PARAMS ((const char *));
+static void pa_globalize_label PARAMS ((FILE *, const char *));
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -7701,4 +7702,18 @@ pa_select_section (exp, reloc, align)
     data_section ();
 }
 
+static void
+pa_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  /* We only handle DATA objects here, functions are globalized in
+     ASM_DECLARE_FUNCTION_NAME.  */
+  if (! FUNCTION_NAME_P (name))
+  {
+    fputs ("\t.EXPORT ", stream);
+    assemble_name (stream, name);
+    fputs (",DATA\n", stream);
+  }
+}
 #include "gt-pa.h"
diff -rup orig/egcc-CVS20020820/gcc/config/pa/pa.h egcc-CVS20020820/gcc/config/pa/pa.h
--- orig/egcc-CVS20020820/gcc/config/pa/pa.h	Thu Jul 18 16:00:38 2002
+++ egcc-CVS20020820/gcc/config/pa/pa.h	Tue Aug 20 19:45:45 2002
@@ -1679,17 +1679,7 @@ do { 									\
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
   sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
 
-#define ASM_GLOBALIZE_LABEL(FILE, NAME)					\
-  do {									\
-    /* We only handle DATA objects here, functions are globalized in	\
-       ASM_DECLARE_FUNCTION_NAME.  */					\
-    if (! FUNCTION_NAME_P (NAME))					\
-      {									\
-	fputs ("\t.EXPORT ", FILE);					\
-	assemble_name (FILE, NAME);					\
-	fputs (",DATA\n", FILE);					\
-      }									\
-  } while (0)
+#define TARGET_ASM_GLOBALIZE_LABEL pa_globalize_label
 
 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
   output_ascii ((FILE), (P), (SIZE))
diff -rup orig/egcc-CVS20020820/gcc/config/rs6000/darwin.h egcc-CVS20020820/gcc/config/rs6000/darwin.h
--- orig/egcc-CVS20020820/gcc/config/rs6000/darwin.h	Thu Aug  8 16:03:54 2002
+++ egcc-CVS20020820/gcc/config/rs6000/darwin.h	Tue Aug 20 19:45:45 2002
@@ -103,13 +103,10 @@ Boston, MA 02111-1307, USA.  */
 #define RS6000_OUTPUT_BASENAME(FILE, NAME)	\
     assemble_name (FILE, NAME);
 
-/* This is how to output a command to make the user-level label named NAME
-   defined for reference from other files.  */
-
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
-  do { fputs ("\t.globl ", FILE);	\
-       RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0)
+/* Globalizing directive for a label.  */
+#undef GLOBAL_ASM_OP
+#define GLOBAL_ASM_OP "\t.globl "
+#undef TARGET_ASM_GLOBALIZE_LABEL
 
 /* This is how to output an internal label prefix.  rs6000.c uses this
    when generating traceback tables.  */
diff -rup orig/egcc-CVS20020820/gcc/config/rs6000/sysv4.h egcc-CVS20020820/gcc/config/rs6000/sysv4.h
--- orig/egcc-CVS20020820/gcc/config/rs6000/sysv4.h	Thu Aug  8 16:03:56 2002
+++ egcc-CVS20020820/gcc/config/rs6000/sysv4.h	Tue Aug 20 19:45:45 2002
@@ -716,7 +716,7 @@ do {									\
 /* Describe how to emit uninitialized external linkage items.  */
 #define	ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)		\
 do {									\
-  ASM_GLOBALIZE_LABEL (FILE, NAME);					\
+  (*targetm.asm_out.globalize_label) (FILE, NAME);			\
   ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);			\
 } while (0)
 
diff -rup orig/egcc-CVS20020820/gcc/config/rs6000/xcoff.h egcc-CVS20020820/gcc/config/rs6000/xcoff.h
--- orig/egcc-CVS20020820/gcc/config/rs6000/xcoff.h	Mon Aug  5 07:00:21 2002
+++ egcc-CVS20020820/gcc/config/rs6000/xcoff.h	Tue Aug 20 19:45:45 2002
@@ -196,9 +196,8 @@ toc_section ()						\
 /* This is how to output a command to make the user-level label named NAME
    defined for reference from other files.  */
 
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)	\
-  do { fputs ("\t.globl ", FILE);	\
-       RS6000_OUTPUT_BASENAME (FILE, NAME); putc ('\n', FILE);} while (0)
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP "\t.globl "
 
 /* Output at beginning of assembler file.
 
diff -rup orig/egcc-CVS20020820/gcc/config/v850/v850.c egcc-CVS20020820/gcc/config/v850/v850.c
--- orig/egcc-CVS20020820/gcc/config/v850/v850.c	Sun Aug 11 15:22:06 2002
+++ egcc-CVS20020820/gcc/config/v850/v850.c	Tue Aug 20 19:45:45 2002
@@ -2632,7 +2632,7 @@ v850_output_aligned_bss (file, decl, nam
      int size;
      int align;
 {
-  ASM_GLOBALIZE_LABEL (file, name);
+  (*targetm.asm_out.globalize_label) (file, name);
   
   switch (v850_get_data_area (decl))
     {
diff -rup orig/egcc-CVS20020820/gcc/config/vax/vax.c egcc-CVS20020820/gcc/config/vax/vax.c
--- orig/egcc-CVS20020820/gcc/config/vax/vax.c	Mon Aug  5 07:00:22 2002
+++ egcc-CVS20020820/gcc/config/vax/vax.c	Tue Aug 20 19:45:45 2002
@@ -45,6 +45,7 @@ static void vms_asm_out_constructor PARA
 static void vms_asm_out_destructor PARAMS ((rtx, int));
 static void vms_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
 static void vms_encode_section_info PARAMS ((tree, int));
+static void vms_globalize_label PARAMS ((FILE *, const char *));
 #endif
 
 /* Initialize the GCC target structure.  */
@@ -59,6 +60,8 @@ static void vms_encode_section_info PARA
 #define TARGET_ASM_SELECT_SECTION vms_select_section
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO vms_encode_section_info
+#undef TARGET_ASM_GLOBALIZE_LABEL
+#define TARGET_ASM_GLOBALIZE_LABEL vms_globalize_label
 #endif
 
 struct gcc_target targetm = TARGET_INITIALIZER;
@@ -924,6 +927,17 @@ vms_encode_section_info (decl, first)
 {
   if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
     SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+}
+
+/* This is how to output a command to make the user-level label named NAME
+   defined for reference from other files.  */
+static void
+vms_globalize_label (stream, name)
+     FILE *stream;
+     const char *name;
+{
+  default_globalize_label (stream, name);
+  vms_check_external (NULL_TREE, name, 0);
 }
 #endif /* VMS_TARGET */
 
diff -rup orig/egcc-CVS20020820/gcc/config/vax/vms.h egcc-CVS20020820/gcc/config/vax/vms.h
--- orig/egcc-CVS20020820/gcc/config/vax/vms.h	Tue Jun 11 23:54:54 2002
+++ egcc-CVS20020820/gcc/config/vax/vms.h	Tue Aug 20 19:45:45 2002
@@ -90,16 +90,8 @@ Boston, MA 02111-1307, USA.  */
 /* This macro definition sets up a default value for `main' to return.  */
 #define DEFAULT_MAIN_RETURN  c_expand_return (integer_one_node)
 
-/* This is how to output a command to make the user-level label named NAME
-   defined for reference from other files.  */
-
-#undef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)		\
-  do { fputs (".globl ", FILE);			\
-       assemble_name (FILE, NAME);		\
-       fputs ("\n", FILE);			\
-       vms_check_external (NULL_TREE, NAME, 0); \
-     } while (0)
+/* Globalizing directive for a label.  */
+#define GLOBAL_ASM_OP ".globl "
 
 /* Under VMS we write the actual size of the storage to be allocated even
    though the symbol is external.  Although it is possible to give external
diff -rup orig/egcc-CVS20020820/gcc/defaults.h egcc-CVS20020820/gcc/defaults.h
--- orig/egcc-CVS20020820/gcc/defaults.h	Wed Aug 14 07:00:28 2002
+++ egcc-CVS20020820/gcc/defaults.h	Tue Aug 20 19:45:45 2002
@@ -154,19 +154,6 @@ do { fputs (integer_asm_op (POINTER_SIZE
 #define ASM_OUTPUT_LABELREF(FILE,NAME)  asm_fprintf ((FILE), "%U%s", (NAME))
 #endif
 
-/* A C statement (sans semicolon) to output to the stdio stream FILE
-   some commands that will make the label NAME global; that is,
-   available for reference from other files.  */
-
-#if !defined(ASM_GLOBALIZE_LABEL) && defined(GLOBAL_ASM_OP)
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)		\
-  do {						\
-      fputs (GLOBAL_ASM_OP, (FILE));		\
-      assemble_name ((FILE), (NAME));		\
-      fputc ('\n', (FILE));			\
-  } while (0)
-#endif
-
 /* Allow target to print debug info labels specially.  This is useful for
    VLIW targets, since debug info labels should go into the middle of
    instruction bundles instead of breaking them.  */
diff -rup orig/egcc-CVS20020820/gcc/doc/tm.texi egcc-CVS20020820/gcc/doc/tm.texi
--- orig/egcc-CVS20020820/gcc/doc/tm.texi	Wed Aug 14 07:00:37 2002
+++ egcc-CVS20020820/gcc/doc/tm.texi	Tue Aug 20 19:45:45 2002
@@ -6582,17 +6582,13 @@ nothing.
 You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or
 @code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro.
 
-@findex ASM_GLOBALIZE_LABEL
-@item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
-A C statement (sans semicolon) to output to the stdio stream
+@deftypefn {Target Hook} void TARGET_ASM_GLOBALIZE_LABEL (FILE *@var{stream}, const char *@var{name})
+This target hook is a function to output to the stdio stream
 @var{stream} some commands that will make the label @var{name} global;
-that is, available for reference from other files.  Use the expression
-@code{assemble_name (@var{stream}, @var{name})} to output the name
-itself; before and after that, output the additional assembler syntax
-for making that name global, and a newline.
+that is, available for reference from other files.
 
-If you define @code{GLOBAL_ASM_OP}, a default definition is provided
-which is correct for most systems.
+The default implementation relies on a proper definition of
+@code{GLOBAL_ASM_OP}.
 
 @findex ASM_WEAKEN_LABEL
 @item ASM_WEAKEN_LABEL (@var{stream}, @var{name})
diff -rup orig/egcc-CVS20020820/gcc/dwarf2out.c egcc-CVS20020820/gcc/dwarf2out.c
--- orig/egcc-CVS20020820/gcc/dwarf2out.c	Thu Aug 15 16:00:11 2002
+++ egcc-CVS20020820/gcc/dwarf2out.c	Tue Aug 20 19:45:46 2002
@@ -122,7 +122,7 @@ default_eh_frame_section ()
 
   data_section ();
   ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
-  ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+  (*targetm.asm_out.globalize_label) (asm_out_file, IDENTIFIER_POINTER (label));
   ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
 #endif
 }
@@ -6122,7 +6122,7 @@ output_die_symbol (die)
     /* We make these global, not weak; if the target doesn't support
        .linkonce, it doesn't support combining the sections, so debugging
        will break.  */
-    ASM_GLOBALIZE_LABEL (asm_out_file, sym);
+    (*targetm.asm_out.globalize_label) (asm_out_file, sym);
 
   ASM_OUTPUT_LABEL (asm_out_file, sym);
 }
diff -rup orig/egcc-CVS20020820/gcc/final.c egcc-CVS20020820/gcc/final.c
--- orig/egcc-CVS20020820/gcc/final.c	Thu Aug 15 16:00:12 2002
+++ egcc-CVS20020820/gcc/final.c	Tue Aug 20 19:45:46 2002
@@ -1965,7 +1965,7 @@ output_alternate_entry_point (file, insn
       ASM_WEAKEN_LABEL (file, name);
 #endif
     case LABEL_GLOBAL_ENTRY:
-      ASM_GLOBALIZE_LABEL (file, name);
+      (*targetm.asm_out.globalize_label) (file, name);
     case LABEL_STATIC_ENTRY:
 #ifdef ASM_OUTPUT_TYPE_DIRECTIVE
       ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function");
diff -rup orig/egcc-CVS20020820/gcc/hooks.c egcc-CVS20020820/gcc/hooks.c
--- orig/egcc-CVS20020820/gcc/hooks.c	Wed May 22 07:01:27 2002
+++ egcc-CVS20020820/gcc/hooks.c	Tue Aug 20 19:45:46 2002
@@ -54,3 +54,11 @@ hook_tree_int_void (a, b)
      int b ATTRIBUTE_UNUSED;
 {
 }
+
+/* Generic hook that takes (FILE *, const char *) and does nothing.  */
+void
+hook_FILEptr_constcharptr_void (a, b)
+     FILE *a ATTRIBUTE_UNUSED;
+     const char *b ATTRIBUTE_UNUSED;
+{
+}
diff -rup orig/egcc-CVS20020820/gcc/hooks.h egcc-CVS20020820/gcc/hooks.h
--- orig/egcc-CVS20020820/gcc/hooks.h	Wed May 22 07:01:27 2002
+++ egcc-CVS20020820/gcc/hooks.h	Tue Aug 20 19:45:46 2002
@@ -26,5 +26,6 @@ bool hook_void_bool_false PARAMS ((void)
 bool hook_tree_bool_false PARAMS ((tree));
 void hook_tree_int_void PARAMS ((tree, int));
 void hook_void_void PARAMS ((void));
+void hook_FILEptr_constcharptr_void PARAMS ((FILE *, const char *));
 
 #endif
diff -rup orig/egcc-CVS20020820/gcc/output.h egcc-CVS20020820/gcc/output.h
--- orig/egcc-CVS20020820/gcc/output.h	Thu Aug  1 20:46:12 2002
+++ egcc-CVS20020820/gcc/output.h	Tue Aug 20 19:45:46 2002
@@ -306,9 +306,6 @@ extern void assemble_string		PARAMS ((co
 extern void assemble_external_libcall	PARAMS ((rtx));
 #endif
 
-/* Declare the label NAME global.  */
-extern void assemble_global		PARAMS ((const char *));
-
 /* Assemble a label named NAME.  */
 extern void assemble_label		PARAMS ((const char *));
 extern void assemble_eh_label		PARAMS ((const char *));
@@ -540,6 +537,7 @@ extern void default_elf_select_rtx_secti
 						    unsigned HOST_WIDE_INT));
 extern const char *default_strip_name_encoding PARAMS ((const char *));
 extern bool default_binds_local_p PARAMS ((tree));
+extern void default_globalize_label PARAMS ((FILE *, const char *));
 
 /* Emit data for vtable gc for GNU binutils.  */
 extern void assemble_vtable_entry PARAMS ((struct rtx_def *, HOST_WIDE_INT));
diff -rup orig/egcc-CVS20020820/gcc/system.h egcc-CVS20020820/gcc/system.h
--- orig/egcc-CVS20020820/gcc/system.h	Tue Jul 23 20:46:11 2002
+++ egcc-CVS20020820/gcc/system.h	Tue Aug 20 19:45:46 2002
@@ -604,7 +604,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 STRIP_NAME_ENCODING
+	ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL
 
 /* 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
diff -rup orig/egcc-CVS20020820/gcc/target-def.h egcc-CVS20020820/gcc/target-def.h
--- orig/egcc-CVS20020820/gcc/target-def.h	Tue May 21 22:44:26 2002
+++ egcc-CVS20020820/gcc/target-def.h	Tue Aug 20 19:45:46 2002
@@ -54,6 +54,10 @@ Foundation, 59 Temple Place - Suite 330,
 
 #define TARGET_ASM_INTEGER default_assemble_integer
 
+#ifndef TARGET_ASM_GLOBALIZE_LABEL
+#define TARGET_ASM_GLOBALIZE_LABEL default_globalize_label
+#endif
+
 #define TARGET_ASM_FUNCTION_PROLOGUE default_function_pro_epilogue
 #define TARGET_ASM_FUNCTION_EPILOGUE default_function_pro_epilogue
 #define TARGET_ASM_FUNCTION_END_PROLOGUE no_asm_to_stream
@@ -140,6 +144,7 @@ Foundation, 59 Temple Place - Suite 330,
 			TARGET_ASM_ALIGNED_INT_OP,		\
 			TARGET_ASM_UNALIGNED_INT_OP,		\
 			TARGET_ASM_INTEGER,			\
+			TARGET_ASM_GLOBALIZE_LABEL,		\
 			TARGET_ASM_FUNCTION_PROLOGUE,		\
 			TARGET_ASM_FUNCTION_END_PROLOGUE,	\
 			TARGET_ASM_FUNCTION_BEGIN_EPILOGUE,	\
diff -rup orig/egcc-CVS20020820/gcc/target.h egcc-CVS20020820/gcc/target.h
--- orig/egcc-CVS20020820/gcc/target.h	Fri May 31 21:43:49 2002
+++ egcc-CVS20020820/gcc/target.h	Tue Aug 20 19:45:46 2002
@@ -69,6 +69,9 @@ struct gcc_target
        and UNALIGNED_OP are NULL.  */
     bool (* integer) PARAMS ((rtx x, unsigned int size, int aligned_p));
 
+    /* Output code that will globalize a label.  */
+    void (* globalize_label) PARAMS ((FILE *, const char *));
+
     /* Output the assembler code for entry to a function.  */
     void (* function_prologue) PARAMS ((FILE *, HOST_WIDE_INT));
 
diff -rup orig/egcc-CVS20020820/gcc/varasm.c egcc-CVS20020820/gcc/varasm.c
--- orig/egcc-CVS20020820/gcc/varasm.c	Tue Aug 13 23:13:14 2002
+++ egcc-CVS20020820/gcc/varasm.c	Tue Aug 20 19:45:46 2002
@@ -506,7 +506,7 @@ asm_output_bss (file, decl, name, size, 
      const char *name;
      int size ATTRIBUTE_UNUSED, rounded;
 {
-  ASM_GLOBALIZE_LABEL (file, name);
+  (*targetm.asm_out.globalize_label) (file, name);
   bss_section ();
 #ifdef ASM_DECLARE_OBJECT_NAME
   last_assemble_variable_decl = decl;
@@ -534,7 +534,7 @@ asm_output_aligned_bss (file, decl, name
      const char *name;
      int size, align;
 {
-  ASM_GLOBALIZE_LABEL (file, name);
+  (*targetm.asm_out.globalize_label) (file, name);
   bss_section ();
   ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
 #ifdef ASM_DECLARE_OBJECT_NAME
@@ -1754,15 +1754,6 @@ assemble_external_libcall (fun)
 #endif
 }
 
-/* Declare the label NAME global.  */
-
-void
-assemble_global (name)
-     const char *name ATTRIBUTE_UNUSED;
-{
-  ASM_GLOBALIZE_LABEL (asm_out_file, name);
-}
-
 /* Assemble a label named NAME.  */
 
 void
@@ -4548,7 +4539,7 @@ globalize_decl (decl)
     }
 #endif
 
-  ASM_GLOBALIZE_LABEL (asm_out_file, name);
+  (*targetm.asm_out.globalize_label) (asm_out_file, name);
 }
 
 /* Emit an assembler directive to make the symbol for DECL an alias to
@@ -5249,4 +5240,19 @@ default_binds_local_p (exp)
   return local_p;
 }
 
+/* Default function to output code that will globalize a label.  A
+   target must define GLOBAL_ASM_OP or provide it's own function to
+   globalize a label.  */
+#ifdef GLOBAL_ASM_OP
+void
+default_globalize_label (stream, name)
+     FILE * stream;
+     const char *name;
+{
+  fputs (GLOBAL_ASM_OP, stream);
+  assemble_name (stream, name);
+  putc ('\n', stream);
+}
+#endif /* GLOBAL_ASM_OP */
+  
 #include "gt-varasm.h"



More information about the Gcc-patches mailing list