RFC: target-hook-ize ASM_FILE_START

Zack Weinberg zack@codesourcery.com
Sun Jun 15 01:09:00 GMT 2003


This is decidedly nontrivial and I'd appreciate port maintainers
checking over their chunk of it.  Problems are especially likely in
the ARM, PA, and RS/6000 back ends.  There are definitely behavior
changes in here; I *think* all of them amount to bugfixes.  Please
note I have not tested this at all.  I expect modifications will be
necessary, so I'm not going to bother writing a change log for this
edition.

zw

===================================================================
Index: doc/tm.texi
--- doc/tm.texi	14 Jun 2003 21:47:45 -0000	1.232
+++ doc/tm.texi	15 Jun 2003 00:43:48 -0000
@@ -6174,19 +6174,38 @@ instructions do.
 @cindex output of assembler code
 
 @c prevent bad page break with this line
-This describes the overall framework of an assembler file.
+This describes the overall framework of an assembly file.
 
-@table @code
-@findex ASM_FILE_START
-@item ASM_FILE_START (@var{stream})
-A C expression which outputs to the stdio stream @var{stream}
-some appropriate text to go at the start of an assembler file.
+@deftypefn {Target Hook} void TARGET_ASM_FILE_START ()
+@findex default_file_start
+Output to @code{asm_out_file} any text which the assembler expects to
+find at the beginning of a file.  The default behavior is controlled
+by two flags, documented below.  Unless your target's assembler is
+quite unusual, if you override the default, you should call
+@code{default_file_start} at some point in your target hook.  This
+lets other target files rely on these variables.
+@end deftypefun
 
-Normally this macro is defined to output a line containing
-@samp{#NO_APP}, which is a comment that has no effect on most
-assemblers but tells the GNU assembler that it can save time by not
-checking for certain assembler constructs.
-@end table
+@deftypevar {Target Hook} bool TARGET_ASM_FILE_START_APP_OFF
+If this flag is true, the text of the macro @code{ASM_APP_OFF} will be
+printed as the very first line in the assembly file, unless
+@option{-fverbose-asm} is in effect.  (If that macro has been defined
+to the empty string, this variable has no effect.)  With the normal
+definition of @code{ASM_APP_OFF}, the effect is to notify the GNU
+assembler that it need not bother stripping comments or extra
+whitespace from its input.  This allows it to work a bit faster.
+
+The default is false.  You should not set it to true unless you have
+verified that your port does not generate any extra whitespace or
+comments that will confuse GAS.
+@end deftypevar
+
+@deftypevar {Target Hook} bool TARGET_ASM_FILE_START_FILE_DIRECTIVE
+If this flag is true, @code{output_file_directive} will be called
+for the primary source file, immediately after printing
+@code{ASM_APP_OFF} (if that is enabled).  Most ELF assemblers expect
+this to be done.  The default is false.
+@end deftypevar
 
 @deftypefn {Target Hook} void TARGET_ASM_FILE_END ()
 Output to @code{asm_out_file} any text which the assembler expects
===================================================================
Index: output.h
--- output.h	7 Jun 2003 17:11:37 -0000	1.127
+++ output.h	15 Jun 2003 00:42:58 -0000
@@ -519,6 +519,7 @@ extern bool default_binds_local_p PARAMS
 extern bool default_binds_local_p_1 PARAMS ((tree, int));
 extern void default_globalize_label PARAMS ((FILE *, const char *));
 extern void default_internal_label PARAMS ((FILE *, const char *, unsigned long));
+extern void default_file_start PARAMS ((void));
 extern void file_end_indicate_exec_stack PARAMS ((void));
 extern bool default_valid_pointer_mode PARAMS ((enum machine_mode));
 
===================================================================
Index: target-def.h
--- target-def.h	7 Jun 2003 17:11:37 -0000	1.50
+++ target-def.h	15 Jun 2003 00:42:59 -0000
@@ -150,10 +150,22 @@ Foundation, 59 Temple Place - Suite 330,
 #define TARGET_ASM_EH_FRAME_SECTION default_eh_frame_section
 #endif
 
+#ifndef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START default_file_start
+#endif
+
 #ifndef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END hook_void_void
 #endif
 
+#ifndef TARGET_ASM_FILE_START_APP_OFF
+#define TARGET_ASM_FILE_START_APP_OFF false
+#endif
+
+#ifndef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
+#endif
+
 #define TARGET_ASM_ALIGNED_INT_OP				\
 		       {TARGET_ASM_ALIGNED_HI_OP,		\
 			TARGET_ASM_ALIGNED_SI_OP,		\
@@ -189,6 +201,7 @@ Foundation, 59 Temple Place - Suite 330,
 			TARGET_ASM_DESTRUCTOR,                  \
                         TARGET_ASM_OUTPUT_MI_THUNK,             \
                         TARGET_ASM_CAN_OUTPUT_MI_THUNK,         \
+                        TARGET_ASM_FILE_START,                  \
                         TARGET_ASM_FILE_END}
 
 /* Scheduler hooks.  All of these default to null pointers, which
@@ -325,7 +338,9 @@ Foundation, 59 Temple Place - Suite 330,
   TARGET_HAVE_CTORS_DTORS,			\
   TARGET_HAVE_TLS,				\
   TARGET_HAVE_SRODATA_SECTION,			\
-  TARGET_TERMINATE_DW2_EH_FRAME_INFO		\
+  TARGET_TERMINATE_DW2_EH_FRAME_INFO,		\
+  TARGET_ASM_FILE_START_APP_OFF,		\
+  TARGET_ASM_FILE_START_FILE_DIRECTIVE,		\
 }
 
 #include "hooks.h"
===================================================================
Index: target.h
--- target.h	7 Jun 2003 17:11:37 -0000	1.57
+++ target.h	15 Jun 2003 00:42:59 -0000
@@ -143,7 +143,12 @@ struct gcc_target
 				          HOST_WIDE_INT vcall_offset,
 				          tree function_decl));
 
-    /* Output any boilerplate text needed at the end of a translation unit.  */
+    /* Output any boilerplate text needed at the beginning of a
+       translation unit.  */
+    void (*file_start) PARAMS ((void));
+
+    /* Output any boilerplate text needed at the end of a
+       translation unit.  */
     void (*file_end) PARAMS ((void));
   } asm_out;
 
@@ -365,6 +370,14 @@ struct gcc_target
 
   /* True if EH frame info sections should be zero-terminated.  */
   bool terminate_dw2_eh_frame_info;
+
+  /* True if #NO_APP should be emitted at the beginning of
+     assembly output.  */
+  bool file_start_app_off;
+
+  /* True if output_file_directive should be called for main_input_filename
+     at the beginning of assembly output.  */
+  bool file_start_file_directive;
 };
 
 extern struct gcc_target targetm;
===================================================================
Index: toplev.c
--- toplev.c	14 Jun 2003 12:26:31 -0000	1.770
+++ toplev.c	15 Jun 2003 00:43:01 -0000
@@ -5037,9 +5037,7 @@ init_asm_output (const char *name)
 
   if (!flag_syntax_only)
     {
-#ifdef ASM_FILE_START
-      ASM_FILE_START (asm_out_file);
-#endif
+      targetm.asm_out.file_start ();
 
 #ifdef ASM_COMMENT_START
       if (flag_verbose_asm)
===================================================================
Index: varasm.c
--- varasm.c	9 Jun 2003 02:20:32 -0000	1.360
+++ varasm.c	15 Jun 2003 00:43:01 -0000
@@ -5363,6 +5363,18 @@ default_internal_label (stream, prefix, 
   ASM_OUTPUT_LABEL (stream, buf);
 }
 
+/* This is the default behavior at the beginning of a file.  It's
+   controlled by two other target-hook toggles.  */
+void
+default_file_start ()
+{
+  if (targetm.file_start_app_off && !flag_verbose_asm)
+    fputs (ASM_APP_OFF, asm_out_file);
+
+  if (targetm.file_start_file_directive)
+    output_file_directive (asm_out_file, main_input_filename);
+}
+
 /* This is a generic routine suitable for use as TARGET_ASM_FILE_END
    which emits a special section directive used to indicate whether or
    not this object file needs an executable stack.  This is primarily
===================================================================
Index: config/darwin.h
--- config/darwin.h	7 Jun 2003 17:11:38 -0000	1.54
+++ config/darwin.h	15 Jun 2003 00:43:02 -0000
@@ -326,9 +326,8 @@ do { text_section ();							\
 
 /* Don't output a .file directive.  That is only used by the assembler for
    error reporting.  */
-
-#undef	ASM_FILE_START
-#define ASM_FILE_START(FILE)
+#undef	ASM_FILE_START_FILE_DIRECTIVE
+#define ASM_FILE_START_FILE_DIRECTIVE false
 
 #undef  TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END darwin_file_end
===================================================================
Index: config/elfos.h
--- config/elfos.h	18 May 2003 09:46:08 -0000	1.60
+++ config/elfos.h	15 Jun 2003 00:43:02 -0000
@@ -96,16 +96,9 @@ Boston, MA 02111-1307, USA.  */
 #undef  SET_ASM_OP
 #define SET_ASM_OP	"\t.set\t"
 
-/* This is how to begin an assembly language file.  Most svr4 assemblers want
-   at least a .file directive to come first, and some want to see a .version
-   directive come right after that.  Here we just establish a default
-   which generates only the .file directive.  If you need a .version
-   directive for any specific target, you should override this definition
-   in the target-specific file which includes this one.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)                            \
-  output_file_directive ((FILE), main_input_filename)
+/* Most svr4 assemblers want a .file directive at the beginning of
+   their input file.  */
+#define ASM_FILE_START_FILE_DIRECTIVE true
 
 /* This is how to allocate empty space in some section.  The .zero
    pseudo-op is used for this on most svr4 assemblers.  */
===================================================================
Index: config/svr3.h
--- config/svr3.h	14 Jun 2003 00:09:25 -0000	1.21
+++ config/svr3.h	15 Jun 2003 00:43:02 -0000
@@ -41,13 +41,8 @@ Boston, MA 02111-1307, USA.
 
 /* Assembler, linker, library, and startfile spec's.  */
 
-/* Output at beginning of assembler file.  */
 /* The .file command should always begin the output.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)					\
-  do { output_file_directive ((FILE), main_input_filename);	\
-     } while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 /* This says how to output an assembler line
    to define a global common symbol.  */
===================================================================
Index: config/alpha/alpha-protos.h
--- config/alpha/alpha-protos.h	7 Jun 2003 17:11:41 -0000	1.46
+++ config/alpha/alpha-protos.h	15 Jun 2003 00:43:02 -0000
@@ -30,7 +30,6 @@ extern HOST_WIDE_INT alpha_initial_elimi
 							       unsigned int));
 extern int alpha_pv_save_size PARAMS ((void));
 extern int alpha_using_fp PARAMS ((void));
-extern void alpha_write_verstamp PARAMS ((FILE *));
 extern void alpha_expand_prologue PARAMS ((void));
 extern void alpha_expand_epilogue PARAMS ((void));
 extern void alpha_output_filename PARAMS ((FILE *, const char *));
@@ -179,6 +178,5 @@ extern void unicosmk_add_extern PARAMS (
 extern void unicosmk_output_align PARAMS ((FILE *, int));
 extern char * unicosmk_text_section PARAMS ((void));
 extern char * unicosmk_data_section PARAMS ((void));
-extern void unicosmk_asm_file_start PARAMS ((FILE *));
 extern void unicosmk_output_common PARAMS ((FILE *, const char *, int, int));
 #endif /* TARGET_ABI_UNICOSMK */
===================================================================
Index: config/alpha/alpha.c
--- config/alpha/alpha.c	10 Jun 2003 20:55:02 -0000	1.311
+++ config/alpha/alpha.c	15 Jun 2003 00:43:04 -0000
@@ -270,7 +270,10 @@ static void unicosmk_gen_dsib PARAMS ((u
 static void unicosmk_output_ssib PARAMS ((FILE *, const char *));
 static int unicosmk_need_dex PARAMS ((rtx));
 #if TARGET_ABI_UNICOSMK
+static void unicosmk_file_start PARAMS ((void));
 static void unicosmk_file_end PARAMS ((void));
+#else
+static void alpha_file_start PARAMS ((void));
 #endif
 
 /* Get the number of args of a function in one of two ways.  */
@@ -7180,21 +7183,6 @@ alpha_does_function_need_gp ()
   return 0;
 }
 
-/* Write a version stamp.  Don't write anything if we are running as a
-   cross-compiler.  Otherwise, use the versions in /usr/include/stamp.h.  */
-
-#ifdef HAVE_STAMP_H
-#include <stamp.h>
-#endif
-
-void
-alpha_write_verstamp (file)
-     FILE *file ATTRIBUTE_UNUSED;
-{
-#ifdef MS_STAMP
-  fprintf (file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP);
-#endif
-}
 
 /* Helper function to set RTX_FRAME_RELATED_P on instructions, including
    sequences.  */
@@ -9125,6 +9113,36 @@ alpha_reorg ()
     }
 }
 
+#if !TARGET_ABI_UNICOSMK
+
+#ifdef HAVE_STAMP_H
+#include <stamp.h>
+#endif
+
+static void
+alpha_file_start ()
+{
+  default_file_start ();
+#ifdef MS_STAMP
+  fprintf (file, "\t.verstamp %d %d\n", MS_STAMP, LS_STAMP);
+#endif
+
+  fputs ("\t.set noreorder\n", asm_out_file);
+  fputs ("\t.set volatile\n", asm_out_file);
+  if (!TARGET_ABI_OPEN_VMS)
+    fputs ("\t.set noat\n", asm_out_file);
+  if (TARGET_EXPLICIT_RELOCS)
+    fputs ("\t.set nomacro\n", asm_out_file);
+  if (TARGET_SUPPORT_ARCH | TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX)
+    fprintf (asm_out_file,
+	     "\t.arch %s\n",
+	     TARGET_CPU_EV6 ? "ev6"	   
+	     : (TARGET_CPU_EV5
+		? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5")
+		: "ev4"));
+}
+#endif
+
 #ifdef OBJECT_FORMAT_ELF
 
 /* Switch to the section to which we should output X.  The only thing
@@ -9613,15 +9631,14 @@ unicosmk_output_module_name (file)
 
 /* Output text that to appear at the beginning of an assembler file.  */
 
-void 
-unicosmk_asm_file_start (file)
-      FILE *file;
+static void 
+unicosmk_file_start ()
 {
   int i;
 
-  fputs ("\t.ident\t", file);
-  unicosmk_output_module_name (file);
-  fputs ("\n\n", file);
+  fputs ("\t.ident\t", asm_out_file);
+  unicosmk_output_module_name (asm_out_file);
+  fputs ("\n\n", asm_out_file);
 
   /* The Unicos/Mk assembler uses different register names. Instead of trying
      to support them, we simply use micro definitions.  */
@@ -9632,12 +9649,12 @@ unicosmk_asm_file_start (file)
      register.  */
 
   for (i = 0; i < 32; ++i)
-    fprintf (file, "$%d <- r%d\n", i, i);
+    fprintf (asm_out_file, "$%d <- r%d\n", i, i);
 
   for (i = 0; i < 32; ++i)
-    fprintf (file, "$f%d <- f%d\n", i, i);
+    fprintf (asm_out_file, "$f%d <- f%d\n", i, i);
 
-  putc ('\n', file);
+  putc ('\n', asm_out_file);
 
   /* The .align directive fill unused space with zeroes which does not work
      in code sections. We define the macro 'gcc@code@align' which uses nops
@@ -9645,24 +9662,24 @@ unicosmk_asm_file_start (file)
      biggest possible alignment since . refers to the current offset from
      the beginning of the section.  */
 
-  fputs ("\t.macro gcc@code@align n\n", file);
-  fputs ("gcc@n@bytes = 1 << n\n", file);
-  fputs ("gcc@here = . % gcc@n@bytes\n", file);
-  fputs ("\t.if ne, gcc@here, 0\n", file);
-  fputs ("\t.repeat (gcc@n@bytes - gcc@here) / 4\n", file);
-  fputs ("\tbis r31,r31,r31\n", file);
-  fputs ("\t.endr\n", file);
-  fputs ("\t.endif\n", file);
-  fputs ("\t.endm gcc@code@align\n\n", file);
+  fputs ("\t.macro gcc@code@align n\n", asm_out_file);
+  fputs ("gcc@n@bytes = 1 << n\n", asm_out_file);
+  fputs ("gcc@here = . % gcc@n@bytes\n", asm_out_file);
+  fputs ("\t.if ne, gcc@here, 0\n", asm_out_file);
+  fputs ("\t.repeat (gcc@n@bytes - gcc@here) / 4\n", asm_out_file);
+  fputs ("\tbis r31,r31,r31\n", asm_out_file);
+  fputs ("\t.endr\n", asm_out_file);
+  fputs ("\t.endif\n", asm_out_file);
+  fputs ("\t.endm gcc@code@align\n\n", asm_out_file);
 
   /* Output extern declarations which should always be visible.  */
-  unicosmk_output_default_externs (file);
+  unicosmk_output_default_externs (asm_out_file);
 
   /* Open a dummy section. We always need to be inside a section for the
      section-switching code to work correctly.
      ??? This should be a module id or something like that. I still have to
      figure out what the rules for those are.  */
-  fputs ("\n\t.psect\t$SG00000,data\n", file);
+  fputs ("\n\t.psect\t$SG00000,data\n", asm_out_file);
 }
 
 /* Output text to appear at the end of an assembler file. This includes all
===================================================================
Index: config/alpha/alpha.h
--- config/alpha/alpha.h	14 Jun 2003 21:47:39 -0000	1.200
+++ config/alpha/alpha.h	15 Jun 2003 00:43:04 -0000
@@ -1488,6 +1488,9 @@ do {									     \
 
 /* Control the assembler format that we output.  */
 
+#define TARGET_ASM_FILE_START alpha_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 #define ASM_APP_ON (TARGET_EXPLICIT_RELOCS ? "\t.set\tmacro\n" : "")
===================================================================
Index: config/alpha/elf.h
--- config/alpha/elf.h	4 Jun 2003 17:33:47 -0000	1.69
+++ config/alpha/elf.h	15 Jun 2003 00:43:04 -0000
@@ -49,26 +49,7 @@ Boston, MA 02111-1307, USA.    */
 #undef  ASM_SPEC
 #define ASM_SPEC  "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}"
 
-/* Output at beginning of assembler file.  */
-#undef  ASM_FILE_START
-#define ASM_FILE_START(FILE)					\
-do {								\
-  if (write_symbols == DBX_DEBUG)				\
-    {								\
-      alpha_write_verstamp (FILE);				\
-      output_file_directive (FILE, main_input_filename);	\
-    }								\
-  fprintf (FILE, "\t.set noat\n");				\
-  fprintf (FILE, "\t.set noreorder\n");				\
-  if (TARGET_EXPLICIT_RELOCS)					\
-    fprintf (FILE, "\t.set nomacro\n");				\
-  if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX)	\
-    {								\
-      fprintf (FILE, "\t.arch %s\n",				\
-               (TARGET_CPU_EV6 ? "ev6"				\
-                : TARGET_MAX ? "pca56" : "ev56"));		\
-    }								\
-} while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 #undef  IDENT_ASM_OP
 #define IDENT_ASM_OP "\t.ident\t"
===================================================================
Index: config/alpha/openbsd.h
--- config/alpha/openbsd.h	13 Jun 2003 14:39:40 -0000	1.7
+++ config/alpha/openbsd.h	15 Jun 2003 00:43:04 -0000
@@ -88,29 +88,6 @@ Boston, MA 02111-1307, USA.  */
 #define DWARF2_UNWIND_INFO 0
 #endif
 
-/* Assembler format: file framework.  */
-
-/* Taken from alpha/osf.h. This used to be common to all alpha
-   configurations, but elf has departed from it.
-   Check alpha/alpha.h, alpha/osf.h for it when egcs is upgraded.  */
-#ifndef ASM_FILE_START
-#define ASM_FILE_START(FILE)					\
-{								\
-  alpha_write_verstamp (FILE);					\
-  fprintf (FILE, "\t.set noreorder\n");				\
-  fprintf (FILE, "\t.set volatile\n");                          \
-  fprintf (FILE, "\t.set noat\n");				\
-  if (TARGET_SUPPORT_ARCH)					\
-    fprintf (FILE, "\t.arch %s\n",				\
-             TARGET_CPU_EV6 ? "ev6"				\
-	     : (TARGET_CPU_EV5					\
-		? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \
-		: "ev4"));					\
-								\
-  ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);	\
-}
-#endif
-
 /* Assembler format: label output.  */
 
 #define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE)	\
===================================================================
Index: config/alpha/osf.h
--- config/alpha/osf.h	17 Mar 2003 14:33:50 -0000	1.31
+++ config/alpha/osf.h	15 Jun 2003 00:43:05 -0000
@@ -84,22 +84,6 @@ Boston, MA 02111-1307, USA.  */
 
 #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
 
-#define ASM_FILE_START(FILE)					\
-{								\
-  alpha_write_verstamp (FILE);					\
-  fprintf (FILE, "\t.set noreorder\n");				\
-  fprintf (FILE, "\t.set volatile\n");                          \
-  fprintf (FILE, "\t.set noat\n");				\
-  if (TARGET_SUPPORT_ARCH)					\
-    fprintf (FILE, "\t.arch %s\n",				\
-             TARGET_CPU_EV6 ? "ev6"				\
-	     : (TARGET_CPU_EV5					\
-		? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \
-		: "ev4"));					\
-								\
-  ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);	\
-}
-
 /* Tru64 UNIX V5.1 requires a special as flag.  Empty by default.  */
 
 #define ASM_OLDAS_SPEC ""
===================================================================
Index: config/alpha/unicosmk.h
--- config/alpha/unicosmk.h	7 Jun 2003 17:11:41 -0000	1.19
+++ config/alpha/unicosmk.h	15 Jun 2003 00:43:05 -0000
@@ -337,8 +337,7 @@ ssib_section ()			\
 
 /* This outputs text to go at the start of an assembler file.  */
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)	unicosmk_asm_file_start (FILE)
+#define TARGET_ASM_FILE_START	unicosmk_file_start
 
 /* This outputs text to go at the end of an assembler file.  */
 
===================================================================
Index: config/alpha/vms.h
--- config/alpha/vms.h	4 Jun 2003 17:33:48 -0000	1.71
+++ config/alpha/vms.h	15 Jun 2003 00:43:05 -0000
@@ -242,21 +242,6 @@ typedef struct {int num_args; enum avms_
 #undef STACK_CHECK_BUILTIN
 #define STACK_CHECK_BUILTIN 0
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)					\
-{								\
-  alpha_write_verstamp (FILE);					\
-  fprintf (FILE, "\t.set noreorder\n");				\
-  fprintf (FILE, "\t.set volatile\n");				\
-  if (TARGET_BWX | TARGET_MAX | TARGET_FIX | TARGET_CIX)	\
-    {								\
-      fprintf (FILE, "\t.arch %s\n",				\
-               (TARGET_CPU_EV6 ? "ev6"				\
-                : TARGET_MAX ? "pca56" : "ev56"));		\
-    }								\
-  ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);	\
-}
-
 #define LINK_SECTION_ASM_OP "\t.link"
 #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
 #define LITERALS_SECTION_ASM_OP "\t.literals"
===================================================================
Index: config/arc/arc-protos.h
--- config/arc/arc-protos.h	28 Jan 2003 18:08:49 -0000	1.6
+++ config/arc/arc-protos.h	15 Jun 2003 00:43:05 -0000
@@ -66,7 +66,6 @@ extern void arc_setup_incoming_varargs P
 
 
 extern void arc_init PARAMS ((void));
-extern void arc_asm_file_start PARAMS ((FILE *));
 extern unsigned int arc_compute_frame_size PARAMS ((int));
 extern void arc_save_restore PARAMS ((FILE *, const char *, unsigned int,
 				      unsigned int, const char *));
===================================================================
Index: config/arc/arc.c
--- config/arc/arc.c	16 May 2003 22:46:41 -0000	1.41
+++ config/arc/arc.c	15 Jun 2003 00:43:05 -0000
@@ -94,6 +94,7 @@ static tree arc_handle_interrupt_attribu
 static bool arc_assemble_integer PARAMS ((rtx, unsigned int, int));
 static void arc_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void arc_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void arc_file_start PARAMS ((void));
 static void arc_internal_label PARAMS ((FILE *, const char *, unsigned long));
 static bool arc_rtx_costs PARAMS ((rtx, int, int, int *));
 static int arc_address_cost PARAMS ((rtx));
@@ -110,6 +111,8 @@ static int arc_address_cost PARAMS ((rtx
 #define TARGET_ASM_FUNCTION_PROLOGUE arc_output_function_prologue
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE arc_output_function_epilogue
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START arc_file_start
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE arc_attribute_table
 #undef TARGET_ASM_INTERNAL_LABEL
@@ -1657,11 +1660,11 @@ arc_initialize_trampoline (tramp, fnaddr
 /* Set the cpu type and print out other fancy things,
    at the top of the file.  */
 
-void
-arc_asm_file_start (file)
-     FILE *file;
+static void
+arc_file_start ()
 {
-  fprintf (file, "\t.cpu %s\n", arc_cpu_string);
+  default_file_start ();
+  fprintf (asm_out_file, "\t.cpu %s\n", arc_cpu_string);
 }
 
 /* Print operand X (an rtx) in assembler syntax to file FILE.
===================================================================
Index: config/arc/arc.h
--- config/arc/arc.h	14 Jun 2003 21:47:39 -0000	1.65
+++ config/arc/arc.h	15 Jun 2003 00:43:06 -0000
@@ -1110,10 +1110,6 @@ extern const char *arc_text_section, *ar
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) arc_asm_file_start (FILE)
-
 /* A C string constant describing how to begin a comment in the target
    assembler language.  The compiler assumes that the comment will
    end at the end of the line.  */
===================================================================
Index: config/arm/aof.h
--- config/arm/aof.h	7 Jun 2003 17:11:41 -0000	1.26
+++ config/arm/aof.h	15 Jun 2003 00:43:06 -0000
@@ -128,41 +128,6 @@ do {					\
 #define ARM_OS_NAME "(generic)"
 #endif
 
-/* For the AOF linker, we need to reference __main to force the standard
-   library to get linked in. */
-
-#define ASM_FILE_START(STREAM)					\
-{								\
-  fprintf ((STREAM), "%s Generated by gcc %s for ARM/%s\n", 	\
-	   ASM_COMMENT_START, version_string, ARM_OS_NAME);	\
-  fprintf ((STREAM), "__r0\tRN\t0\n");				\
-  fprintf ((STREAM), "__a1\tRN\t0\n");				\
-  fprintf ((STREAM), "__a2\tRN\t1\n");				\
-  fprintf ((STREAM), "__a3\tRN\t2\n");				\
-  fprintf ((STREAM), "__a4\tRN\t3\n");				\
-  fprintf ((STREAM), "__v1\tRN\t4\n");				\
-  fprintf ((STREAM), "__v2\tRN\t5\n");				\
-  fprintf ((STREAM), "__v3\tRN\t6\n");				\
-  fprintf ((STREAM), "__v4\tRN\t7\n");				\
-  fprintf ((STREAM), "__v5\tRN\t8\n");				\
-  fprintf ((STREAM), "__v6\tRN\t9\n");				\
-  fprintf ((STREAM), "__sl\tRN\t10\n");				\
-  fprintf ((STREAM), "__fp\tRN\t11\n");				\
-  fprintf ((STREAM), "__ip\tRN\t12\n");				\
-  fprintf ((STREAM), "__sp\tRN\t13\n");				\
-  fprintf ((STREAM), "__lr\tRN\t14\n");				\
-  fprintf ((STREAM), "__pc\tRN\t15\n");				\
-  fprintf ((STREAM), "__f0\tFN\t0\n");				\
-  fprintf ((STREAM), "__f1\tFN\t1\n");				\
-  fprintf ((STREAM), "__f2\tFN\t2\n");				\
-  fprintf ((STREAM), "__f3\tFN\t3\n");				\
-  fprintf ((STREAM), "__f4\tFN\t4\n");				\
-  fprintf ((STREAM), "__f5\tFN\t5\n");				\
-  fprintf ((STREAM), "__f6\tFN\t6\n");				\
-  fprintf ((STREAM), "__f7\tFN\t7\n");				\
-  text_section ();						\
-}
-
 /* Some systems use __main in a way incompatible with its use in gcc, in these
    cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
    give the same symbol without quotes for an alternative entry point.  You
===================================================================
Index: config/arm/aout.h
--- config/arm/aout.h	4 Jun 2003 21:18:47 -0000	1.32
+++ config/arm/aout.h	15 Jun 2003 00:43:06 -0000
@@ -24,20 +24,6 @@
 #define ARM_OS_NAME "(generic)"
 #endif
 
-/* The text to go at the start of the assembler file.  */
-#ifndef ASM_FILE_START
-#define ASM_FILE_START(STREAM)		    \
-{					    \
-  asm_fprintf (STREAM,"%Rrfp\t.req\t%Rr9\n"); \
-  asm_fprintf (STREAM,"%Rsl\t.req\t%Rr10\n"); \
-  asm_fprintf (STREAM,"%Rfp\t.req\t%Rr11\n"); \
-  asm_fprintf (STREAM,"%Rip\t.req\t%Rr12\n"); \
-  asm_fprintf (STREAM,"%Rsp\t.req\t%Rr13\n"); \
-  asm_fprintf (STREAM,"%Rlr\t.req\t%Rr14\n"); \
-  asm_fprintf (STREAM,"%Rpc\t.req\t%Rr15\n"); \
-}
-#endif
-
 #ifndef ASM_APP_ON
 #define ASM_APP_ON  		""
 #endif
@@ -65,7 +51,6 @@
 #define LOCAL_LABEL_PREFIX 	""
 #endif
 
-
 /* The assembler's names for the registers.  */
 #ifndef REGISTER_NAMES
 #define REGISTER_NAMES  			   \
@@ -93,8 +78,8 @@
   {"v4", 7},					\
   {"v5", 8},					\
   {"v6", 9},					\
-  {"rfp", 9}, /* Gcc used to call it this */	\
   {"sb", 9},					\
+  {"rfp", 9}, /* Gcc used to call it this */	\
   {"v7", 10},					\
   {"r10", 10},	/* sl */			\
   {"r11", 11},	/* fp */			\
===================================================================
Index: config/arm/arm.c
--- config/arm/arm.c	14 Jun 2003 14:16:39 -0000	1.281
+++ config/arm/arm.c	15 Jun 2003 00:43:08 -0000
@@ -145,6 +145,7 @@ static void arm_encode_section_info (tre
 static void aof_globalize_label (FILE *, const char *);
 static void aof_dump_imports (FILE *);
 static void aof_dump_pic_table (FILE *);
+static void aof_file_start (void);
 static void aof_file_end (void);
 #endif
 
@@ -167,6 +168,8 @@ static void aof_file_end (void);
 #define TARGET_ASM_ALIGNED_SI_OP "\tDCD\t"
 #undef TARGET_ASM_GLOBALIZE_LABEL
 #define TARGET_ASM_GLOBALIZE_LABEL aof_globalize_label
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START aof_file_start
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END aof_file_end
 #else
@@ -11638,6 +11641,37 @@ aof_globalize_label (FILE *stream, const
   default_globalize_label (stream, name);
   if (! strcmp (name, "main"))
     arm_main_function = 1;
+}
+
+static void
+aof_file_start ()
+{
+  fputs ("__r0\tRN\t0\n", asm_out_file);
+  fputs ("__a1\tRN\t0\n", asm_out_file);
+  fputs ("__a2\tRN\t1\n", asm_out_file);
+  fputs ("__a3\tRN\t2\n", asm_out_file);
+  fputs ("__a4\tRN\t3\n", asm_out_file);
+  fputs ("__v1\tRN\t4\n", asm_out_file);
+  fputs ("__v2\tRN\t5\n", asm_out_file);
+  fputs ("__v3\tRN\t6\n", asm_out_file);
+  fputs ("__v4\tRN\t7\n", asm_out_file);
+  fputs ("__v5\tRN\t8\n", asm_out_file);
+  fputs ("__v6\tRN\t9\n", asm_out_file);
+  fputs ("__sl\tRN\t10\n", asm_out_file);
+  fputs ("__fp\tRN\t11\n", asm_out_file);
+  fputs ("__ip\tRN\t12\n", asm_out_file);
+  fputs ("__sp\tRN\t13\n", asm_out_file);
+  fputs ("__lr\tRN\t14\n", asm_out_file);
+  fputs ("__pc\tRN\t15\n", asm_out_file);
+  fputs ("__f0\tFN\t0\n", asm_out_file);
+  fputs ("__f1\tFN\t1\n", asm_out_file);
+  fputs ("__f2\tFN\t2\n", asm_out_file);
+  fputs ("__f3\tFN\t3\n", asm_out_file);
+  fputs ("__f4\tFN\t4\n", asm_out_file);
+  fputs ("__f5\tFN\t5\n", asm_out_file);
+  fputs ("__f6\tFN\t6\n", asm_out_file);
+  fputs ("__f7\tFN\t7\n", asm_out_file);
+  text_section ();
 }
 
 static void
===================================================================
Index: config/arm/coff.h
--- config/arm/coff.h	10 Feb 2003 16:33:09 -0000	1.30
+++ config/arm/coff.h	15 Jun 2003 00:43:08 -0000
@@ -45,21 +45,7 @@
 
 #include "dbxcoff.h"
 
-/* A C statement to output assembler commands which will identify the
-   object file as having been compiled with GCC (or another GNU
-   compiler).  */
-
-/* This outputs a lot of .req's to define alias for various registers.
-   Let's try to avoid this.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(STREAM)					\
-  do								\
-    {								\
-      fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n",	\
-	       ASM_COMMENT_START, version_string);		\
-      fprintf (STREAM, ASM_APP_OFF);				\
-    }								\
-  while (0)
+#define TARGET_ASM_FILE_START_APP_OFF true
 
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_section
===================================================================
Index: config/arm/elf.h
--- config/arm/elf.h	28 Apr 2003 08:28:21 -0000	1.43
+++ config/arm/elf.h	15 Jun 2003 00:43:08 -0000
@@ -114,20 +114,8 @@
   { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
 #endif
 
-
-/* This outputs a lot of .req's to define alias for various registers.
-   Let's try to avoid this.  */
-#ifndef ASM_FILE_START
-#define ASM_FILE_START(STREAM)					\
-  do								\
-    {								\
-      fprintf (STREAM, "%s Generated by gcc %s for ARM/elf\n",	\
-	       ASM_COMMENT_START, version_string);		\
-      output_file_directive (STREAM, main_input_filename);	\
-      fprintf (STREAM, ASM_APP_OFF);				\
-    }								\
-  while (0)
-#endif
+#define TARGET_ASM_FILE_START_APP_OFF true
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 #undef  TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION  arm_elf_asm_named_section
===================================================================
Index: config/arm/pe.h
--- config/arm/pe.h	10 Jun 2003 14:45:44 -0000	1.21
+++ config/arm/pe.h	15 Jun 2003 00:43:08 -0000
@@ -104,17 +104,7 @@
 #undef  TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION  default_pe_asm_named_section
 
-/* This outputs a lot of .req's to define alias for various registers.
-   Let's try to avoid this.  */
-#undef  ASM_FILE_START
-#define ASM_FILE_START(STREAM)					\
-  do								\
-    {								\
-      asm_fprintf (STREAM, "%@ Generated by gcc %s for ARM/pe\n",\
-	   version_string);					\
-      output_file_directive ((STREAM), main_input_filename);	\
-    }								\
-  while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 /* Output a reference to a label.  */
 #undef  ASM_OUTPUT_LABELREF
===================================================================
Index: config/avr/avr-protos.h
--- config/avr/avr-protos.h	7 Jun 2003 17:11:42 -0000	1.27
+++ config/avr/avr-protos.h	15 Jun 2003 00:43:09 -0000
@@ -22,7 +22,6 @@
 
 
 extern int    function_arg_regno_p              PARAMS ((int r));
-extern void   asm_file_start                    PARAMS ((FILE *file));
 extern void   avr_init_once                     PARAMS ((void));
 extern void   avr_override_options              PARAMS ((void));
 extern void   avr_optimization_options		PARAMS ((int level, int size));
===================================================================
Index: config/avr/avr.c
--- config/avr/avr.c	7 Jun 2003 17:11:42 -0000	1.94
+++ config/avr/avr.c	15 Jun 2003 00:43:09 -0000
@@ -63,6 +63,7 @@ static tree   avr_handle_progmem_attribu
 static tree   avr_handle_fndecl_attribute PARAMS ((tree *, tree, tree, int, bool *));
 const struct attribute_spec avr_attribute_table[];
 static bool   avr_assemble_integer PARAMS ((rtx, unsigned int, int));
+static void   avr_file_start PARAMS ((void));
 static void   avr_file_end PARAMS ((void));
 static void   avr_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void   avr_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
@@ -219,6 +220,9 @@ int avr_case_values_threshold = 30000;
 #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
 #undef TARGET_ASM_INTEGER
 #define TARGET_ASM_INTEGER avr_assemble_integer
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START avr_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END avr_file_end
 
@@ -4888,17 +4892,17 @@ avr_section_type_flags (decl, name, relo
   return flags;
 }
 
-/* Outputs to the stdio stream FILE some
-   appropriate text to go at the start of an assembler file.  */
+/* Outputs some appropriate text to go at the start of an assembler
+   file.  */
 
-void
-asm_file_start (file)
-     FILE *file;
+static void
+avr_file_start ()
 {
   if (avr_asm_only_p)
     error ("MCU `%s' supported for assembler only", avr_mcu_name);
 
-  output_file_directive (file, main_input_filename);
+  default_file_start ();
+
   fprintf (file, "\t.arch %s\n", avr_mcu_name);
   fputs ("__SREG__ = 0x3f\n"
 	 "__SP_H__ = 0x3e\n"
===================================================================
Index: config/avr/avr.h
--- config/avr/avr.h	7 Jun 2003 17:11:42 -0000	1.84
+++ config/avr/avr.h	15 Jun 2003 00:43:10 -0000
@@ -1687,18 +1687,6 @@ progmem_section ()							      \
    This macro is irrelevant if there is no separate readonly data
    section.  */
 
-#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.
-
-   Normally this macro is defined to output a line containing
-   `#NO_APP', which is a comment that has no effect on most
-   assemblers but tells the GNU assembler that it can save time by not
-   checking for certain assembler constructs.
-
-   On systems that use SDB, it is necessary to output certain
-   commands; see `attasm.h'.  */
-
 #define ASM_COMMENT_START " ; "
 /* A C string constant describing how to begin a comment in the target
    assembler language.  The compiler assumes that the comment will
===================================================================
Index: config/c4x/c4x.c
--- config/c4x/c4x.c	7 Jun 2003 17:11:43 -0000	1.127
+++ config/c4x/c4x.c	15 Jun 2003 00:43:11 -0000
@@ -186,6 +186,7 @@ static int c4x_valid_operands PARAMS ((e
 				       enum machine_mode, int));
 static int c4x_arn_reg_operand PARAMS ((rtx, enum machine_mode, unsigned int));
 static int c4x_arn_mem_operand PARAMS ((rtx, enum machine_mode, unsigned int));
+static void c4x_file_start PARAMS ((void));
 static void c4x_file_end PARAMS ((void));
 static void c4x_check_attribute PARAMS ((const char *, tree, tree, tree *));
 static int c4x_r11_set_p PARAMS ((rtx));
@@ -208,6 +209,9 @@ static int c4x_address_cost PARAMS ((rtx
 #define TARGET_ASM_ALIGNED_HI_OP NULL
 #undef TARGET_ASM_ALIGNED_SI_OP
 #define TARGET_ASM_ALIGNED_SI_OP NULL
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START c4x_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END c4x_file_end
 
@@ -4562,6 +4566,26 @@ c4x_external_ref (name)
   p->next = extern_head;
   p->name = name;
   extern_head = p;
+}
+
+/* We need to have a data section we can identify so that we can set
+   the DP register back to a data pointer in the small memory model.
+   This is only required for ISRs if we are paranoid that someone
+   may have quietly changed this register on the sly.  */
+static void
+c4x_file_start ()
+{
+  int dspversion = 0;
+  if (TARGET_C30) dspversion = 30;
+  if (TARGET_C31) dspversion = 31;
+  if (TARGET_C32) dspversion = 32;
+  if (TARGET_C33) dspversion = 33;
+  if (TARGET_C40) dspversion = 40;
+  if (TARGET_C44) dspversion = 44;
+
+  default_file_start ();
+  fprintf (asm_out_file, "\t.version\t%d\n", dspversion);
+  fputs ("\n\t.data\ndata_sec:\n", asm_out_file);
 }
 
 
===================================================================
Index: config/c4x/c4x.h
--- config/c4x/c4x.h	7 Jun 2003 17:11:43 -0000	1.131
+++ config/c4x/c4x.h	15 Jun 2003 00:43:12 -0000
@@ -1548,35 +1548,6 @@ fini_section ()							\
 
 
 /* Overall Framework of an Assembler File.  */
-/* We need to have a data section we can identify so that we can set
-   the DP register back to a data pointer in the small memory model.
-   This is only required for ISRs if we are paranoid that someone
-   may have quietly changed this register on the sly.  */
-
-#define ASM_FILE_START(FILE)					\
-{								\
-    int dspversion = 0;						\
-    if (TARGET_C30) dspversion = 30;				\
-    if (TARGET_C31) dspversion = 31;				\
-    if (TARGET_C32) dspversion = 32;				\
-    if (TARGET_C33) dspversion = 33;                            \
-    if (TARGET_C40) dspversion = 40;				\
-    if (TARGET_C44) dspversion = 44;				\
-    fprintf (FILE, "\t.version\t%d\n", dspversion);		\
-    fprintf (FILE, "\t.file\t");				\
-    if (TARGET_TI)						\
-      {								\
-        const char *p;						\
-        const char *after_dir = main_input_filename;		\
-	for (p = main_input_filename; *p; p++)			\
-	  if (*p == '/')					\
-	    after_dir = p + 1;					\
-	output_quoted_string (FILE, after_dir);			\
-      }								\
-    else							\
-      output_quoted_string (FILE, main_input_filename);		\
-    fputs ("\n\t.data\ndata_sec:\n", FILE);			\
-}
 
 #define ASM_COMMENT_START ";"
 
===================================================================
Index: config/cris/cris.c
--- config/cris/cris.c	16 May 2003 18:57:40 -0000	1.40
+++ config/cris/cris.c	15 Jun 2003 00:43:12 -0000
@@ -105,6 +105,8 @@ static void cris_operand_lossage PARAMS 
 static void cris_asm_output_mi_thunk
   PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
 
+static void cris_file_start PARAMS ((void));
+
 static bool cris_rtx_costs PARAMS ((rtx, int, int, int *));
 static int cris_address_cost PARAMS ((rtx));
 
@@ -162,6 +164,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START cris_file_start
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS cris_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -2759,6 +2764,24 @@ cris_asm_output_mi_thunk (stream, thunkd
       assemble_name (stream, XSTR (XEXP (DECL_RTL (funcdecl), 0), 0));
       fprintf (stream, "\n");
     }
+}
+
+/* Boilerplate emitted at start of file.  
+
+   NO_APP *only at file start* means faster assembly.  It also means
+   comments are not allowed.  In some cases comments will be output
+   for debugging purposes.  Make sure they are allowed then.
+
+   We want a .file directive only if TARGET_ELF.  */
+static void
+cris_file_start ()
+{
+  /* These expressions can vary at run time, so we cannot put
+     them into TARGET_INITIALIZER.  */
+  targetm.file_start_app_off = !(TARGET_PDEBUG || flag_print_asm_name);
+  targetm.file_start_file_directive = TARGET_ELF;
+
+  default_file_start ();
 }
 
 /* The EXPAND_BUILTIN_VA_ARG worker.  This is modified from the
===================================================================
Index: config/cris/cris.h
--- config/cris/cris.h	14 Jun 2003 21:47:40 -0000	1.54
+++ config/cris/cris.h	15 Jun 2003 00:43:14 -0000
@@ -1392,24 +1392,6 @@ call_ ## FUNC (void)						\
 
 /* Node: File Framework */
 
-/* NO_APP *only at file start* means faster assembly.
-   It also means comments are not allowed.
-   In some cases comments will be output for debugging purposes.
-   Make sure they are allowed then.  */
-/* Override previous definitions (elfos.h).  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(STREAM)					\
-  do								\
-    {								\
-      if (TARGET_PDEBUG || flag_print_asm_name)			\
-	fprintf ((STREAM), "#APP\n");				\
-      else							\
-	fprintf ((STREAM), "#NO_APP\n");			\
-      if (TARGET_ELF)						\
-	output_file_directive ((STREAM), main_input_filename);	\
-    }								\
-  while (0)
-
 /* We don't want an .ident for gcc.  To avoid that but still support
    #ident, we override ASM_OUTPUT_IDENT and, since the gcc .ident is its
    only use besides ASM_OUTPUT_IDENT, undef IDENT_ASM_OP from elfos.h.  */
===================================================================
Index: config/dsp16xx/dsp16xx-protos.h
--- config/dsp16xx/dsp16xx-protos.h	13 Mar 2003 04:13:13 -0000	1.9
+++ config/dsp16xx/dsp16xx-protos.h	15 Jun 2003 00:43:14 -0000
@@ -77,9 +77,6 @@ extern int initial_frame_pointer_offset 
 extern void asm_output_common PARAMS ((FILE *, const char *, int, int));
 extern void asm_output_local PARAMS ((FILE *, const char *, int, int));
 extern void asm_output_float PARAMS ((FILE *, double));
-extern void dsp16xx_file_start PARAMS ((void));
-extern void coff_dsp16xx_file_start PARAMS ((FILE *));
-extern void luxworks_dsp16xx_file_start PARAMS ((FILE *));
 extern bool dsp16xx_compare_gen;
 extern int hard_regno_mode_ok PARAMS ((int, enum machine_mode));
 extern enum reg_class dsp16xx_reg_class_from_letter PARAMS ((int));
===================================================================
Index: config/dsp16xx/dsp16xx.c
--- config/dsp16xx/dsp16xx.c	16 May 2003 20:57:03 -0000	1.36
+++ config/dsp16xx/dsp16xx.c	15 Jun 2003 00:43:14 -0000
@@ -151,6 +151,7 @@ static const char *const lshift_right_as
 static int reg_save_size PARAMS ((void));
 static void dsp16xx_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void dsp16xx_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void dsp16xx_file_start PARAMS ((void));
 static bool dsp16xx_rtx_costs PARAMS ((rtx, int, int, int *));
 static int dsp16xx_address_cost PARAMS ((rtx));
 
@@ -168,6 +169,9 @@ static int dsp16xx_address_cost PARAMS (
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE dsp16xx_output_function_epilogue
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START dsp16xx_file_start
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS dsp16xx_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -2373,49 +2377,10 @@ dsp16xx_function_arg_advance (cum, mode,
     }
 }
 
-void
-coff_dsp16xx_file_start (file)
-     FILE *file;
-{
-  fprintf (file, "#include <%s.h>\n", save_chip_name);
-}
-
-void
-luxworks_dsp16xx_file_start (file)
-     FILE *file;
+static void
+dsp16xx_file_start ()
 {
-  char *temp_filename;
-  int len, err_code;
-
-
-  fprintf (file, "\t.debug ");
-  err_code = (TARGET_DEBUG) ? fprintf (file, "yes, ") : fprintf (file, "no, ");
-  err_code = (TARGET_SAVE_TEMPS) ? fprintf (file, "asm, ") : fprintf (file, "temp, ");
-  len = strlen (main_input_filename);
-  temp_filename = (char *) xmalloc (len + 2);
-  strcpy (temp_filename, main_input_filename);
-#ifdef __CYGWIN32__
-    p = temp_filename;
-    while (*p != '\0') {
-    if (*p == '\\')
-        *p = '/';
-         p++;
-         }
-#endif
-    fprintf (file, "\"%s\"\n", temp_filename);
-
-  fprintf (file, "#include <%s.h>\n", save_chip_name);
-
-   /*
-    * Add dummy sections, so that they always exist in the 
-    * object code. These have been created so that the number and
-    * type of sections remain consistent with and without -g option. Note
-    * that the .data, .text, .const and .bss are always created when -g
-    * is provided as an option.  */
-   fprintf (file, "\t.rsect \".text\" , nodelete\n");
-   fprintf (file, "\t.rsect \".data\" , nodelete\n");
-   fprintf (file, "\t.rsect \".const\" , nodelete\n");
-   fprintf (file, "\t.rsect \".bss\" , nodelete\n");
+  fprintf (asm_out_file, "#include <%s.h>\n", save_chip_name);
 }
 
 rtx
===================================================================
Index: config/dsp16xx/dsp16xx.h
--- config/dsp16xx/dsp16xx.h	7 Jun 2003 11:46:11 -0000	1.61
+++ config/dsp16xx/dsp16xx.h	15 Jun 2003 00:43:14 -0000
@@ -1487,9 +1487,6 @@ extern struct dsp16xx_frame_info current
 
 /* THE OVERALL FRAMEWORK OF AN ASSEMBLER FILE */
 
-/* Output at beginning of assembler file.  */
-#define ASM_FILE_START(FILE) coff_dsp16xx_file_start (FILE) 
-
 /* A C string constant describing how to begin a comment in the target
    assembler language.  */
 #define ASM_COMMENT_START ""
===================================================================
Index: config/h8300/elf.h
--- config/h8300/elf.h	30 May 2003 19:26:10 -0000	1.10
+++ config/h8300/elf.h	15 Jun 2003 00:43:14 -0000
@@ -31,12 +31,6 @@
 			%{pg:gcrti.o%s}%{!pg:crti.o%s} \
 			crtbegin.o%s"
 
-/* Output at beginning/end of assembler file.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)                            \
-  (output_file_directive ((FILE), main_input_filename), \
-   asm_file_start (FILE))
-
 #undef USER_LABEL_PREFIX
 #define USER_LABEL_PREFIX "_"
 
===================================================================
Index: config/h8300/h8300-protos.h
--- config/h8300/h8300-protos.h	7 Jun 2003 17:11:43 -0000	1.56
+++ config/h8300/h8300-protos.h	15 Jun 2003 00:43:14 -0000
@@ -94,7 +94,6 @@ extern int h8300_can_use_return_insn_p P
 extern void h8300_expand_prologue PARAMS ((void));
 extern void h8300_expand_epilogue PARAMS ((void));
 extern int h8300_current_function_interrupt_function_p PARAMS ((void));
-extern void asm_file_start PARAMS ((FILE *));
 extern int h8300_initial_elimination_offset PARAMS ((int, int));
 
 struct cpp_reader;
===================================================================
Index: config/h8300/h8300.c
--- config/h8300/h8300.c	11 Jun 2003 11:58:39 -0000	1.234
+++ config/h8300/h8300.c	15 Jun 2003 00:43:14 -0000
@@ -63,6 +63,7 @@ static tree h8300_handle_eightbit_data_a
 static tree h8300_handle_tiny_data_attribute PARAMS ((tree *, tree, tree, int, bool *));
 static void h8300_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void h8300_insert_attributes PARAMS ((tree, tree *));
+static void h8300_file_start PARAMS ((void));
 static void h8300_file_end PARAMS ((void));
 #ifndef OBJECT_FORMAT_ELF
 static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
@@ -114,6 +115,10 @@ const char *h8_push_op, *h8_pop_op, *h8_
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE h8300_output_function_epilogue
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START h8300_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END h8300_file_end
 
@@ -692,30 +697,15 @@ h8300_current_function_interrupt_functio
 
 /* Output assembly code for the start of the file.  */
 
-void
-asm_file_start (file)
-     FILE *file;
+static void
+h8300_file_start ()
 {
-  fprintf (file, ";\tGCC For the Hitachi H8/300\n");
-  fprintf (file, ";\tBy Hitachi America Ltd and Cygnus Support\n");
+  default_file_start ();
 
-  if (optimize_size)
-    fprintf (file, "; -Os\n");
-  else if (optimize)
-    fprintf (file, "; -O%d\n", optimize);
   if (TARGET_H8300H)
-    if (TARGET_NORMAL_MODE)
-      fprintf (file, "\n\t.h8300hn\n");
-    else
-      fprintf (file, "\n\t.h8300h\n");
+    fputs (TARGET_NORMAL_MODE ? "\t.h8300hn\n" : "\t.h8300h\n", asm_out_file);
   else if (TARGET_H8300S)
-    if (TARGET_NORMAL_MODE)
-      fprintf (file, "\n\t.h8300sn\n");
-    else
-      fprintf (file, "\n\t.h8300s\n");
-  else
-    fprintf (file, "\n\n");
-  output_file_directive (file, main_input_filename);
+    fputs (TARGET_NORMAL_MODE ? "\t.h8300sn\n" : "\t.h8300s\n", asm_out_file);
 }
 
 /* Output assembly language code for the end of file.  */
===================================================================
Index: config/h8300/h8300.h
--- config/h8300/h8300.h	11 Jun 2003 12:05:04 -0000	1.146
+++ config/h8300/h8300.h	15 Jun 2003 00:43:15 -0000
@@ -1030,10 +1030,6 @@ struct cum_arg
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning/end of assembler file.  */
-
-#define ASM_FILE_START(FILE) asm_file_start (FILE)
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/i370/i370.c
--- config/i370/i370.c	7 Jun 2003 17:11:43 -0000	1.36
+++ config/i370/i370.c	15 Jun 2003 00:43:15 -0000
@@ -107,6 +107,7 @@ static void i370_globalize_label PARAMS 
 #endif
 static void i370_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void i370_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void i370_file_start PARAMS ((void));
 static void i370_file_end PARAMS ((void));
 
 #ifdef LONGEXTERNAL
@@ -320,6 +321,8 @@ static const unsigned char ebcasc[256] =
 #define TARGET_ASM_FUNCTION_PROLOGUE i370_output_function_prologue
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE i370_output_function_epilogue
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START i370_file_start
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END i370_file_end
 #undef TARGET_ASM_INTERNAL_LABEL
@@ -1600,6 +1603,12 @@ i370_output_function_epilogue (file, l)
   mvs_free_label_list();
   for (i = function_base_page; i < mvs_page_num; i++)
     fprintf (file, "\tDC\tA(PG%d)\n", i);
+}
+
+static void
+i370_file_start ()
+{
+  fputs ("\tRMODE\tANY\n\tCSECT\n", asm_out_file);
 }
 
 static void
===================================================================
Index: config/i370/i370.h
--- config/i370/i370.h	14 Jun 2003 21:47:40 -0000	1.63
+++ config/i370/i370.h	15 Jun 2003 00:43:16 -0000
@@ -1029,10 +1029,6 @@ enum reg_class
   "0",  "2",  "4",  "6"							\
 }
 
-#define ASM_FILE_START(FILE)						\
-{ fputs ("\tRMODE\tANY\n", FILE);					\
-  fputs ("\tCSECT\n", FILE); }
-
 #define ASM_COMMENT_START "*"
 #define ASM_APP_OFF ""
 #define ASM_APP_ON ""
===================================================================
Index: config/i386/att.h
--- config/i386/att.h	14 Jun 2003 00:09:29 -0000	1.18
+++ config/i386/att.h	15 Jun 2003 00:43:16 -0000
@@ -45,14 +45,7 @@ do								\
 } while (0)
 
 /* Output at beginning of assembler file.  */
-/* The .file command should always begin the output.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)						\
-  do {									\
-	output_file_directive (FILE, main_input_filename);		\
-	if (ix86_asm_dialect == ASM_INTEL)				\
-	  fputs ("\t.intel_syntax\n", FILE);				\
-  } while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 /* This is how to output an assembler line
    that says to advance the location counter
===================================================================
Index: config/i386/gas.h
--- config/i386/gas.h	13 Jun 2003 23:18:50 -0000	1.20
+++ config/i386/gas.h	15 Jun 2003 00:43:16 -0000
@@ -121,12 +121,4 @@ Boston, MA 02111-1307, USA.  */
 /* Print opcodes the way that GAS expects them.  */
 #define GAS_MNEMONICS 1
 
-/* Output at beginning of assembler file.  */
-/* The .file command should always begin the output.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)						\
-  do {									\
-        output_file_directive (FILE, main_input_filename);		\
-	if (ix86_asm_dialect == ASM_INTEL)				\
-	  fputs ("\t.intel_syntax\n", FILE);				\
-  } while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
===================================================================
Index: config/i386/i386-interix.h
--- config/i386/i386-interix.h	26 Dec 2002 18:45:02 -0000	1.40
+++ config/i386/i386-interix.h	15 Jun 2003 00:43:16 -0000
@@ -92,16 +92,8 @@ Boston, MA 02111-1307, USA.  */
 /* The global __fltused is necessary to cause the printf/scanf routines
    for outputting/inputting floating point numbers to be loaded.  Since this
    is kind of hard to detect, we just do it all the time.  */
-
-#ifdef ASM_FILE_START
-#undef ASM_FILE_START
-#endif
-#define ASM_FILE_START(FILE) \
-  do {  fprintf (FILE, "\t.file\t");                            \
-        output_quoted_string (FILE, dump_base_name);            \
-        fprintf (FILE, "\n");                                   \
-        fprintf (FILE, ".global\t__fltused\n");                 \
-  } while (0)
+#undef X86_FILE_START_FLTUSED
+#define X86_FILE_START_FLTUSED 1
 
 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
    ASM_OUTPUT_LIMITED_STRING macros.  Each byte in the table
===================================================================
Index: config/i386/i386.c
--- config/i386/i386.c	13 Jun 2003 00:45:11 -0000	1.575
+++ config/i386/i386.c	15 Jun 2003 00:43:19 -0000
@@ -829,6 +829,7 @@ static void x86_output_mi_thunk PARAMS (
 					 HOST_WIDE_INT, tree));
 static bool x86_can_output_mi_thunk PARAMS ((tree, HOST_WIDE_INT,
 					     HOST_WIDE_INT, tree));
+static void x86_file_start PARAMS ((void));
 static void ix86_reorg PARAMS ((void));
 bool ix86_expand_carry_flag_compare PARAMS ((enum rtx_code, rtx, rtx, rtx*));
 
@@ -1006,6 +1007,9 @@ static void init_ext_80387_constants PAR
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK x86_can_output_mi_thunk
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START x86_file_start
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ix86_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -15530,6 +15534,18 @@ x86_output_mi_thunk (file, thunk, delta,
 	  output_asm_insn ("jmp\t{*}%1", xops);
 	}
     }
+}
+
+static void
+x86_file_start ()
+{
+  default_file_start ();
+  if (X86_FILE_START_VERSION_DIRECTIVE)
+    fputs ("\t.version\t\"01.01\"\n", asm_out_file);
+  if (X86_FILE_START_FLTUSED)
+    fputs ("\t.global\t__fltused\n", asm_out_file);
+  if (ix86_asm_dialect == ASM_INTEL)
+    fputs ("\t.intel_syntax\n", asm_out_file);
 }
 
 int
===================================================================
Index: config/i386/i386.h
--- config/i386/i386.h	14 Jun 2003 21:47:41 -0000	1.344
+++ config/i386/i386.h	15 Jun 2003 00:43:20 -0000
@@ -3229,6 +3229,10 @@ struct machine_function GTY(())
 #define ix86_save_varrargs_registers (cfun->machine->save_varrargs_registers)
 #define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching)
 
+/* Control behavior of x86_file_start.  */
+#define X86_FILE_START_VERSION_DIRECTIVE false
+#define X86_FILE_START_FLTUSED false
+
 /*
 Local variables:
 version-control: t
===================================================================
Index: config/i386/linux.h
--- config/i386/linux.h	7 Jun 2003 17:11:45 -0000	1.47
+++ config/i386/linux.h	15 Jun 2003 00:43:20 -0000
@@ -25,13 +25,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Output at beginning of assembler file.  */
 /* The .file command should always begin the output.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)						\
-  do {									\
-	output_file_directive (FILE, main_input_filename);		\
-	if (ix86_asm_dialect == ASM_INTEL)				\
-	  fputs ("\t.intel_syntax\n", FILE);				\
-  } while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
 
===================================================================
Index: config/i386/sco5.h
--- config/i386/sco5.h	14 Jun 2003 00:09:30 -0000	1.78
+++ config/i386/sco5.h	15 Jun 2003 00:43:20 -0000
@@ -44,12 +44,9 @@ Boston, MA 02111-1307, USA.  */
 #define CTORS_SECTION_ASM_OP		"\t.section\t.ctors, \"aw\""
 #define DTORS_SECTION_ASM_OP		"\t.section\t.dtors, \"aw\""
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)						\
-do {									\
-  output_file_directive((FILE),main_input_filename);			\
-  fprintf ((FILE), "\t.version\t\"01.01\"\n");				\
-} while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+#undef X86_FILE_START_VERSION_DIRECTIVE
+#define X86_FILE_START_VERSION_DIRECTIVE true
 
 /* A C statement (sans semicolon) to output to the stdio stream
    FILE the assembler definition of uninitialized global DECL named
===================================================================
Index: config/i386/sysv4.h
--- config/i386/sysv4.h	16 Jun 2002 21:13:11 -0000	1.23
+++ config/i386/sysv4.h	15 Jun 2003 00:43:20 -0000
@@ -34,12 +34,9 @@ Boston, MA 02111-1307, USA.  */
 /* Output at beginning of assembler file.  */
 /* The .file command should always begin the output.  */
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)						\
-  do {									\
-	output_file_directive (FILE, main_input_filename);		\
-	fprintf (FILE, "\t.version\t\"01.01\"\n");			\
-  } while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+#undef X86_FILE_START_VERSION_DIRECTIVE
+#define X86_FILE_START_VERSION_DIRECTIVE true
 
 #undef DBX_REGISTER_NUMBER
 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
===================================================================
Index: config/i960/i960-coff.h
--- config/i960/i960-coff.h	15 Nov 2001 17:55:27 -0000	1.6
+++ config/i960/i960-coff.h	15 Jun 2003 00:43:20 -0000
@@ -32,9 +32,8 @@ Boston, MA 02111-1307, USA.  */
    use the standard definition of LIB_SPEC.  */
 #undef LIB_SPEC
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-  output_file_directive ((FILE), main_input_filename)
+/* Emit a .file directive.  */
+#define ASM_FILE_START_FILE_DIRECTIVE true
 
 /* Support the ctors and dtors sections for g++.  */
 
===================================================================
Index: config/i960/i960.h
--- config/i960/i960.h	14 Jun 2003 21:47:41 -0000	1.79
+++ config/i960/i960.h	15 Jun 2003 00:43:20 -0000
@@ -1161,10 +1161,6 @@ extern struct rtx_def *i960_compare_op0,
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(file)
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/ia64/ia64-protos.h
--- config/ia64/ia64-protos.h	7 Jun 2003 17:11:45 -0000	1.58
+++ config/ia64/ia64-protos.h	15 Jun 2003 00:43:20 -0000
@@ -134,7 +134,6 @@ extern int ia64_register_move_cost PARAM
 					   enum reg_class));
 extern int ia64_epilogue_uses PARAMS((int));
 extern int ia64_eh_uses PARAMS((int));
-extern void emit_safe_across_calls PARAMS((FILE *));
 extern void ia64_init_builtins PARAMS((void));
 extern void ia64_override_options PARAMS((void));
 extern int ia64_dbx_register_number PARAMS((int));
===================================================================
Index: config/ia64/ia64.c
--- config/ia64/ia64.c	7 Jun 2003 17:11:45 -0000	1.227
+++ config/ia64/ia64.c	15 Jun 2003 00:43:22 -0000
@@ -240,6 +240,7 @@ static void bundling PARAMS ((FILE *, in
 
 static void ia64_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
 					  HOST_WIDE_INT, tree));
+static void ia64_file_start PARAMS ((void));
 
 static void ia64_select_rtx_section PARAMS ((enum machine_mode, rtx,
 					     unsigned HOST_WIDE_INT));
@@ -355,6 +356,9 @@ static const struct attribute_spec ia64_
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START ia64_file_start
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ia64_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -1607,13 +1611,14 @@ ia64_split_call (retval, addr, retaddr, 
 
 /* Begin the assembly file.  */
 
-void
-emit_safe_across_calls (f)
-     FILE *f;
+static void
+ia64_file_start ()
 {
   unsigned int rs, re;
   int out_state;
 
+  default_file_start ();
+
   rs = 1;
   out_state = 0;
   while (1)
@@ -1626,19 +1631,19 @@ emit_safe_across_calls (f)
 	continue;
       if (out_state == 0)
 	{
-	  fputs ("\t.pred.safe_across_calls ", f);
+	  fputs ("\t.pred.safe_across_calls ", asm_out_file);
 	  out_state = 1;
 	}
       else
-	fputc (',', f);
+	fputc (',', asm_out_file);
       if (re == rs + 1)
-	fprintf (f, "p%u", rs);
+	fprintf (asm_out_file, "p%u", rs);
       else
-	fprintf (f, "p%u-p%u", rs, re - 1);
+	fprintf (asm_out_file, "p%u-p%u", rs, re - 1);
       rs = re + 1;
     }
   if (out_state)
-    fputc ('\n', f);
+    fputc ('\n', asm_out_file);
 }
 
 /* Helper function for ia64_compute_frame_size: find an appropriate general
===================================================================
Index: config/ia64/ia64.h
--- config/ia64/ia64.h	14 Jun 2003 21:47:41 -0000	1.152
+++ config/ia64/ia64.h	15 Jun 2003 00:43:23 -0000
@@ -1456,11 +1456,6 @@ do {									\
 
 #define EH_USES(REGNO) ia64_eh_uses (REGNO)
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(FILE) \
-  emit_safe_across_calls (FILE)
-
 /* Output part N of a function descriptor for DECL.  For ia64, both
    words are emitted with a single relocation, so ignore N > 0.  */
 #define ASM_OUTPUT_FDESC(FILE, DECL, PART)				\
===================================================================
Index: config/ia64/sysv4.h
--- config/ia64/sysv4.h	16 Apr 2003 19:53:13 -0000	1.28
+++ config/ia64/sysv4.h	15 Jun 2003 00:43:23 -0000
@@ -117,26 +117,6 @@ do {									\
   fputc ('\n', FILE);							\
 } while (0)
 
-/* A C expression which outputs to the stdio stream STREAM some appropriate
-   text to go at the start of an assembler file.  */
-
-/* ??? Looks like almost every port, except for a few original ones, get this
-   wrong.  Must emit #NO_APP as first line of file to turn of special assembler
-   preprocessing of files.  */
-
-/* ??? Even worse, it doesn't work, because gas does not accept the tab chars
-   that dwarf2out.c emits when #NO_APP.  */
-
-/* ??? Unrelated, but dwarf2out.c emits unnecessary newlines after strings,
-   may as well fix at the same time.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(STREAM) \
-do {									\
-  output_file_directive (STREAM, main_input_filename);			\
-  emit_safe_across_calls (STREAM);					\
-} while (0)
-
 /* Override default elf definition.  */
 #undef	TARGET_ASM_SELECT_RTX_SECTION
 #define TARGET_ASM_SELECT_RTX_SECTION  ia64_select_rtx_section
===================================================================
Index: config/m32r/m32r-protos.h
--- config/m32r/m32r-protos.h	13 Jun 2003 16:57:26 -0000	1.16
+++ config/m32r/m32r-protos.h	15 Jun 2003 00:43:23 -0000
@@ -30,7 +30,6 @@ extern unsigned m32r_compute_frame_size	
 extern int    m32r_first_insn_address		PARAMS ((void));
 extern void   m32r_expand_prologue		PARAMS ((void));
 extern void   m32r_finalize_pic			PARAMS ((void));
-extern void   m32r_asm_file_start		PARAMS ((FILE *));
 extern int    direct_return 			PARAMS ((void));
 #ifdef TREE_CODE
 extern enum m32r_function_type m32r_compute_function_type PARAMS ((tree));
===================================================================
Index: config/m32r/m32r.c
--- config/m32r/m32r.c	13 Jun 2003 16:57:26 -0000	1.67
+++ config/m32r/m32r.c	15 Jun 2003 00:43:23 -0000
@@ -77,6 +77,8 @@ static tree  m32r_handle_model_attribute
 static void  m32r_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void  m32r_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 
+static void  m32r_file_start PARAMS ((void));
+
 static int    m32r_adjust_cost 	   PARAMS ((rtx, rtx, rtx, int));
 static int    m32r_adjust_priority PARAMS ((rtx, int));
 static void   m32r_sched_init	   PARAMS ((FILE *, int, int));
@@ -103,6 +105,9 @@ static bool m32r_rtx_costs PARAMS ((rtx,
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE m32r_output_function_epilogue
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START m32r_file_start
+
 #undef TARGET_SCHED_ADJUST_COST
 #define TARGET_SCHED_ADJUST_COST m32r_adjust_cost
 #undef TARGET_SCHED_ADJUST_PRIORITY
@@ -2215,15 +2220,13 @@ m32r_initialize_trampoline (tramp, fnadd
 {
 }
 
-/* Set the cpu type and print out other fancy things,
-   at the top of the file.  */
-
-void
-m32r_asm_file_start (file)
-     FILE * file;
+static void
+m32r_asm_file_start ()
 {
+  default_file_start ();
+
   if (flag_verbose_asm)
-    fprintf (file,
+    fprintf (asm_out_file,
 	     "%s M32R/D special options: -G " HOST_WIDE_INT_PRINT_UNSIGNED "\n",
 	     ASM_COMMENT_START, g_switch_value);
 }
===================================================================
Index: config/m32r/m32r.h
--- config/m32r/m32r.h	14 Jun 2003 21:47:42 -0000	1.87
+++ config/m32r/m32r.h	15 Jun 2003 00:43:24 -0000
@@ -30,7 +30,6 @@ Boston, MA 02111-1307, USA.  */
 #undef PTRDIFF_TYPE
 #undef WCHAR_TYPE
 #undef WCHAR_TYPE_SIZE
-#undef ASM_FILE_START
 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
 #undef TARGET_VERSION
 #undef CPP_SPEC
@@ -1516,9 +1515,6 @@ do {									\
 /*#define LEGITIMATE_PIC_OPERAND_P(X)*/
 
 /* Control the assembler format that we output.  */
-
-/* Output at beginning of assembler file.  */
-#define ASM_FILE_START(FILE) m32r_asm_file_start (FILE)
 
 /* A C string constant describing how to begin a comment in the target
    assembler language.  The compiler assumes that the comment will
===================================================================
Index: config/m68hc11/m68hc11-protos.h
--- config/m68hc11/m68hc11-protos.h	14 May 2003 07:29:50 -0000	1.27
+++ config/m68hc11/m68hc11-protos.h	15 Jun 2003 00:43:24 -0000
@@ -33,8 +33,6 @@ extern int m68hc11_initial_elimination_o
 extern void expand_prologue PARAMS((void));
 extern void expand_epilogue PARAMS((void));
 
-extern void m68hc11_asm_file_start PARAMS((FILE*, const char*));
-
 #ifdef TREE_CODE
 extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*,
                                                  enum machine_mode,
===================================================================
Index: config/m68hc11/m68hc11.c
--- config/m68hc11/m68hc11.c	22 May 2003 17:54:18 -0000	1.78
+++ config/m68hc11/m68hc11.c	15 Jun 2003 00:43:25 -0000
@@ -82,6 +82,7 @@ static void asm_print_register PARAMS ((
 static void m68hc11_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void m68hc11_asm_out_constructor PARAMS ((rtx, int));
 static void m68hc11_asm_out_destructor PARAMS ((rtx, int));
+static void m68hc11_file_start PARAMS ((void));
 static void m68hc11_encode_section_info PARAMS((tree, rtx, int));
 static int autoinc_mode PARAMS((rtx));
 static int m68hc11_make_autoinc_notes PARAMS((rtx *, void *));
@@ -230,6 +231,10 @@ static int nb_soft_regs;
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE m68hc11_output_function_epilogue
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START m68hc11_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  m68hc11_encode_section_info
 
@@ -5663,59 +5668,10 @@ m68hc11_rtx_costs (x, code, outer_code, 
 }
 
 
-/* print_options - called at the start of the code generation for a
-   module.  */
-
-extern char *asm_file_name;
-
-#include <time.h>
-#include <sys/types.h>
-
 static void
-print_options (out)
-     FILE *out;
+m68hc11_file_start ()
 {
-  const char *a_time;
-  long c_time;
-  int i;
-  extern int save_argc;
-  extern char **save_argv;
-
-  fprintf (out, ";;; Command:\t");
-  for (i = 0; i < save_argc; i++)
-    {
-      fprintf (out, "%s", save_argv[i]);
-      if (i + 1 < save_argc)
-	fprintf (out, " ");
-    }
-  fprintf (out, "\n");
-  c_time = time (0);
-  a_time = ctime (&c_time);
-  fprintf (out, ";;; Compiled:\t%s", a_time);
-#ifdef __GNUC__
-#ifndef __VERSION__
-#define __VERSION__ "[unknown]"
-#endif
-  fprintf (out, ";;; (META)compiled by GNU C version %s.\n", __VERSION__);
-#else
-  fprintf (out, ";;; (META)compiled by CC.\n");
-#endif
-}
-
-void
-m68hc11_asm_file_start (out, main_file)
-     FILE *out;
-     const char *main_file;
-{
-  fprintf (out, ";;;-----------------------------------------\n");
-  fprintf (out, ";;; Start %s gcc assembly output\n",
-           TARGET_M6811
-           ? "MC68HC11"
-           : TARGET_M68S12 ? "MC68HCS12" : "MC68HC12");
-  fprintf (out, ";;; gcc compiler %s\n", version_string);
-  print_options (out);
-  fprintf (out, ";;;-----------------------------------------\n");
-  output_file_directive (out, main_file);
+  default_file_start ();
 
   if (TARGET_SHORT)
     fprintf (out, "\t.mode mshort\n");
===================================================================
Index: config/m68hc11/m68hc11.h
--- config/m68hc11/m68hc11.h	17 May 2003 20:29:33 -0000	1.74
+++ config/m68hc11/m68hc11.h	15 Jun 2003 00:43:25 -0000
@@ -1511,17 +1511,6 @@ do {                                    
 #define TARGET_ASM_CONSTRUCTOR  m68hc11_asm_out_constructor
 #define TARGET_ASM_DESTRUCTOR   m68hc11_asm_out_destructor
 
-/* This is how to begin an assembly language file.  Most svr4 assemblers want
-   at least a .file directive to come first, and some want to see a .version
-   directive come right after that.  Here we just establish a default
-   which generates only the .file directive.  If you need a .version
-   directive for any specific target, you should override this definition
-   in the target-specific file which includes this one.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)                            \
-    m68hc11_asm_file_start ((FILE), main_input_filename)
-
 /* Comment character */
 #define ASM_COMMENT_START	";"
 
===================================================================
Index: config/m68k/coff.h
--- config/m68k/coff.h	17 May 2003 18:20:55 -0000	1.10
+++ config/m68k/coff.h	15 Jun 2003 00:43:25 -0000
@@ -76,9 +76,7 @@ Boston, MA 02111-1307, USA.  */
  "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp",	\
  "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" }
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-  output_file_directive ((FILE), main_input_filename)
+#define ASM_FILE_START_FILE_DIRECTIVE true
 
 /* If defined, a C expression whose value is a string containing the
    assembler operation to identify the following data as uninitialized global
===================================================================
Index: config/m68k/hp320.h
--- config/m68k/hp320.h	4 Jun 2003 17:33:50 -0000	1.24
+++ config/m68k/hp320.h	15 Jun 2003 00:43:26 -0000
@@ -112,7 +112,6 @@ Boston, MA 02111-1307, USA.  */
 
 #endif /* default is -msoft-float */
 
-
 /* -m68000 requires special flags to the assembler.  */
 #define ASM_SPEC \
  "%{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
@@ -168,7 +167,6 @@ Boston, MA 02111-1307, USA.  */
 #undef REGISTER_NAMES
 #undef ASM_OUTPUT_REG_PUSH
 #undef ASM_OUTPUT_REG_POP
-#undef ASM_FILE_START
 #undef ASM_APP_ON
 #undef ASM_APP_OFF
 #undef TEXT_SECTION_ASM_OP
@@ -211,16 +209,7 @@ Boston, MA 02111-1307, USA.  */
   fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
 
 /* For HPUX versions before 6.5, define this macro as empty.  */
-#define ASM_FILE_START(FILE)						\
-  if (TARGET_68020)							\
-    {									\
-      if (TARGET_68881)							\
-	 fprintf (FILE, "\tversion 3\n"); /* 68020 fp regs saved */	\
-      else								\
-	 fprintf (FILE, "\tversion 2\n"); /* 68020 no fp regs saved */	\
-    }									\
-  else									\
-    fprintf (FILE, "\tversion 1\n");	/* 68010 */
+#define TARGET_ASM_FILE_START m68k_hp320_file_start
 
 #define ASM_APP_ON ""
 
===================================================================
Index: config/m68k/m68k.c
--- config/m68k/m68k.c	4 Jun 2003 21:18:48 -0000	1.86
+++ config/m68k/m68k.c	15 Jun 2003 00:43:26 -0000
@@ -59,6 +59,7 @@ static void m68k_svr3_asm_out_constructo
 #endif
 #ifdef HPUX_ASM
 static void m68k_hp320_internal_label PARAMS ((FILE *, const char *, unsigned long));
+static void m68k_hp320_file_start PARAMS ((void));
 #endif
 static void m68k_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
 					  HOST_WIDE_INT, tree));
@@ -131,6 +132,8 @@ int m68k_last_compare_had_fp_operands;
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
 
+#define TARGET_ASM_FILE_START_APP_OFF true
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS m68k_rtx_costs
 
@@ -3662,6 +3665,20 @@ m68k_hp320_internal_label (stream, prefi
     fprintf(stream, "\tset %s%ld,.+2\n", prefix, labelno);
   else
     fprintf (stream, "%s%ld:\n", prefix, labelno);
+}
+
+static void
+m68k_hp320_file_start ()
+{
+  if (TARGET_68020)
+    {
+      if (TARGET_68881)
+	fprintf (FILE, "\tversion 3\n"); /* 68020 fp regs saved */
+      else
+	fprintf (FILE, "\tversion 2\n"); /* 68020 no fp regs saved */
+    }
+  else
+    fprintf (FILE, "\tversion 1\n");	/* 68010 */
 }
 #endif
 
===================================================================
Index: config/m68k/m68k.h
--- config/m68k/m68k.h	23 May 2003 18:19:21 -0000	1.89
+++ config/m68k/m68k.h	15 Jun 2003 00:43:27 -0000
@@ -1292,11 +1292,6 @@ __transfer_from_trampoline ()					\
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(FILE)	\
-  fprintf (FILE, "#NO_APP\n");
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/mcore/mcore-pe.h
--- config/mcore/mcore-pe.h	12 Mar 2003 11:46:56 -0000	1.16
+++ config/mcore/mcore-pe.h	15 Jun 2003 00:43:27 -0000
@@ -105,15 +105,7 @@ drectve_section ()						\
     }								\
   while (0);
 
-#undef  ASM_FILE_START
-#define ASM_FILE_START(STREAM)					\
-  do								\
-    {								\
-      fprintf (STREAM, "%s Generated by gcc %s for MCore/pe\n",	\
-	   ASM_COMMENT_START, version_string);			\
-      output_file_directive ((STREAM), main_input_filename);	\
-    }								\
-  while (0)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 #undef  ASM_OUTPUT_SOURCE_LINE
 #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE)				  \
===================================================================
Index: config/mips/iris6.h
--- config/mips/iris6.h	7 Jun 2003 17:11:46 -0000	1.61
+++ config/mips/iris6.h	15 Jun 2003 00:43:27 -0000
@@ -356,8 +356,6 @@ current_section_flags ()						\
 /* SGI assembler needs all sorts of extra help to do alignment properly.  */
 #undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN iris6_asm_output_align
-#undef ASM_FILE_START
-#define ASM_FILE_START  iris6_asm_file_start
 
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (32768*8)
===================================================================
Index: config/mips/mips-protos.h
--- config/mips/mips-protos.h	9 Jun 2003 07:10:47 -0000	1.42
+++ config/mips/mips-protos.h	15 Jun 2003 00:43:27 -0000
@@ -28,8 +28,6 @@ Boston, MA 02111-1307, USA.  */
 
 extern HOST_WIDE_INT	compute_frame_size PARAMS ((HOST_WIDE_INT));
 extern int		mips_initial_elimination_offset PARAMS ((int, int));
-extern void		mips_asm_file_start PARAMS ((FILE *));
-extern void		iris6_asm_file_start PARAMS ((FILE *));
 extern void		iris6_asm_output_align PARAMS ((FILE *, unsigned));
 extern const char *	current_section_name PARAMS ((void));
 extern unsigned int	current_section_flags PARAMS ((void));
===================================================================
Index: config/mips/mips.c
--- config/mips/mips.c	9 Jun 2003 07:19:14 -0000	1.277
+++ config/mips/mips.c	15 Jun 2003 00:43:29 -0000
@@ -275,6 +275,7 @@ static void iris6_asm_named_section		PAR
 static int iris_section_align_entry_eq		PARAMS ((const PTR, const PTR));
 static hashval_t iris_section_align_entry_hash	PARAMS ((const PTR));
 static int iris6_section_align_1		PARAMS ((void **, void *));
+static void iris6_file_start			PARAMS ((void));
 static void iris6_file_end			PARAMS ((void));
 #endif
 static int mips_adjust_cost			PARAMS ((rtx, rtx, rtx, int));
@@ -291,6 +292,7 @@ static int mips_use_dfa_pipeline_interfa
 static bool mips_rtx_costs			PARAMS ((rtx, int, int, int *));
 static int mips_address_cost                    PARAMS ((rtx));
 static void mips_encode_section_info            PARAMS ((tree, rtx, int));
+static void mips_file_start			PARAMS ((void));
 static void mips_file_end			PARAMS ((void));
 
 /* Structure to be filled in by compute_frame_size with register
@@ -872,12 +874,16 @@ const struct mips_cpu_info mips_cpu_info
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG mips_reorg
 
+#undef TARGET_ASM_FILE_START
 #undef TARGET_ASM_FILE_END
 #ifdef TARGET_IRIX6
+#define TARGET_ASM_FILE_START iris6_file_start
 #define TARGET_ASM_FILE_END iris6_file_end
 #else
+#define TARGET_ASM_FILE_START mips_file_start
 #define TARGET_ASM_FILE_END mips_file_end
 #endif
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -6501,11 +6507,10 @@ mips_output_ascii (stream, string_param,
    relevant .comm/.lcomm/.extern/.sdata declaration when the code is
    processed, it generates a two instruction sequence.  */
 
-void
-mips_asm_file_start (stream)
-     FILE *stream;
+static void
+mips_file_start ()
 {
-  ASM_OUTPUT_SOURCE_FILENAME (stream, main_input_filename);
+  default_file_start ()
 
   /* Versions of the MIPS assembler before 2.20 generate errors if a branch
      inside of a .set noreorder section jumps to a label outside of the .set
@@ -6513,7 +6518,7 @@ mips_asm_file_start (stream)
      fixing the bug.  */
 
   if (TARGET_MIPS_AS && optimize && flag_delayed_branch)
-    fprintf (stream, "\t.set\tnobopt\n");
+    fprintf (asm_out_file, "\t.set\tnobopt\n");
 
   if (TARGET_GAS)
     {
@@ -6541,28 +6546,26 @@ mips_asm_file_start (stream)
 	 because in this way we can avoid creating an allocated section.  We
 	 do not want this section to take up any space in the running
 	 executable.  */
-      fprintf (stream, "\t.section .mdebug.%s\n", abi_string);
+      fprintf (asm_out_file, "\t.section .mdebug.%s\n", abi_string);
 
       /* Restore the default section.  */
-      fprintf (stream, "\t.previous\n");
+      fprintf (asm_out_file, "\t.previous\n");
 #endif
     }
 
-
-
   /* Generate the pseudo ops that System V.4 wants.  */
 #ifndef ABICALLS_ASM_OP
 #define ABICALLS_ASM_OP "\t.abicalls"
 #endif
   if (TARGET_ABICALLS)
     /* ??? but do not want this (or want pic0) if -non-shared? */
-    fprintf (stream, "%s\n", ABICALLS_ASM_OP);
+    fprintf (asm_out_file, "%s\n", ABICALLS_ASM_OP);
 
   if (TARGET_MIPS16)
-    fprintf (stream, "\t.set\tmips16\n");
+    fprintf (asm_out_file, "\t.set\tmips16\n");
 
   if (flag_verbose_asm)
-    fprintf (stream, "\n%s -G value = %d, Arch = %s, ISA = %d\n",
+    fprintf (asm_out_file, "\n%s -G value = %d, Arch = %s, ISA = %d\n",
 	     ASM_COMMENT_START,
 	     mips_section_threshold, mips_arch_info->name, mips_isa);
 }
@@ -10736,11 +10739,10 @@ iris6_asm_output_align (file, log)
    switching games so that we can emit a .section directive at the
    beginning of the file with the proper alignment attached.  */
 
-void
-iris6_asm_file_start (stream)
-     FILE *stream;
+static void
+iris6_file_start ()
 {
-  mips_asm_file_start (stream);
+  mips_file_start ();
 
   iris_orig_asm_out_file = asm_out_file;
   stream = tmpfile ();
===================================================================
Index: config/mips/mips.h
--- config/mips/mips.h	14 Jun 2003 21:47:42 -0000	1.262
+++ config/mips/mips.h	15 Jun 2003 00:43:31 -0000
@@ -3288,17 +3288,6 @@ typedef struct mips_args {
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.
-   If we are optimizing to use the global pointer, create a temporary
-   file to hold all of the text stuff, and write it out to the end.
-   This is needed because the MIPS assembler is evidently one pass,
-   and if it hasn't seen the relevant .comm/.lcomm/.extern/.sdata
-   declaration when the code is processed, it generates a two
-   instruction sequence.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(STREAM) mips_asm_file_start (STREAM)
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/mmix/mmix-protos.h
--- config/mmix/mmix-protos.h	7 Jun 2003 17:11:46 -0000	1.25
+++ config/mmix/mmix-protos.h	15 Jun 2003 00:43:31 -0000
@@ -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 void mmix_asm_file_start PARAMS ((FILE *));
 extern void mmix_asm_output_source_filename PARAMS ((FILE *, const char *));
 extern void mmix_output_quoted_string PARAMS ((FILE *, const char *, int));
 extern void mmix_asm_output_source_line  PARAMS ((FILE *, int));
===================================================================
Index: config/mmix/mmix.h
--- config/mmix/mmix.h	14 Jun 2003 21:47:43 -0000	1.54
+++ config/mmix/mmix.h	15 Jun 2003 00:43:31 -0000
@@ -919,9 +919,6 @@ typedef struct { int regs; int lib; } CU
 
 /* Node: File Framework */
 
-#define ASM_FILE_START(STREAM) \
- mmix_asm_file_start (STREAM)
-
 /* While any other punctuation character but ";" would do, we prefer "%"
    or "!"; "!" is an unary operator and so will not be mistakenly included
    in correctly formed expressions.  The hash character adds mass; catches
===================================================================
Index: config/mn10300/mn10300-protos.h
--- config/mn10300/mn10300-protos.h	14 Feb 2003 21:47:48 -0000	1.7
+++ config/mn10300/mn10300-protos.h	15 Jun 2003 00:43:31 -0000
@@ -53,7 +53,6 @@ extern struct rtx_def *mn10300_va_arg PA
 #endif /* TREE_CODE */
 
 extern struct rtx_def *mn10300_builtin_saveregs PARAMS ((void));
-extern void asm_file_start PARAMS ((FILE *));
 extern void expand_prologue PARAMS ((void));
 extern void expand_epilogue PARAMS ((void));
 extern int initial_offset PARAMS ((int, int));
===================================================================
Index: config/mn10300/mn10300.c
--- config/mn10300/mn10300.c	14 Feb 2003 21:47:48 -0000	1.50
+++ config/mn10300/mn10300.c	15 Jun 2003 00:43:31 -0000
@@ -58,6 +58,7 @@ Boston, MA 02111-1307, USA.  */
 static int mn10300_address_cost_1 PARAMS ((rtx, int *));
 static int mn10300_address_cost PARAMS ((rtx));
 static bool mn10300_rtx_costs PARAMS ((rtx, int, int, int *));
+static void mn10300_file_start PARAMS ((void));
 
 
 /* Initialize the GCC target structure.  */
@@ -69,21 +70,20 @@ static bool mn10300_rtx_costs PARAMS ((r
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST mn10300_address_cost
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START mn10300_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
-void
-asm_file_start (file)
+static void
+mn10300_file_start (file)
      FILE *file;
 {
-  fprintf (file, "#\tGCC For the Matsushita MN10300\n");
-  if (optimize)
-    fprintf (file, "# -O%d\n", optimize);
-  else
-    fprintf (file, "\n\n");
+  default_file_start ();
 
   if (TARGET_AM33)
     fprintf (file, "\t.am33\n");
-  output_file_directive (file, main_input_filename);
 }
 
 
===================================================================
Index: config/mn10300/mn10300.h
--- config/mn10300/mn10300.h	11 Jun 2003 17:52:40 -0000	1.70
+++ config/mn10300/mn10300.h	15 Jun 2003 00:43:32 -0000
@@ -839,10 +839,6 @@ struct cum_arg {int nbytes; };
 #define DATA_SECTION_ASM_OP "\t.section .data"
 #define BSS_SECTION_ASM_OP "\t.section .bss"
 
-/* Output at beginning/end of assembler file.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) asm_file_start(FILE)
-
 #define ASM_COMMENT_START "#"
 
 /* Output to assembler file text saying following lines
===================================================================
Index: config/ns32k/ns32k.c
--- config/ns32k/ns32k.c	16 May 2003 22:23:13 -0000	1.37
+++ config/ns32k/ns32k.c	15 Jun 2003 00:43:32 -0000
@@ -96,6 +96,8 @@ static int ns32k_address_cost PARAMS ((r
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST ns32k_address_cost
 
+#define TARGET_ASM_FILE_START_APP_OFF true
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Generate the assembly code for function entry.  FILE is a stdio
===================================================================
Index: config/ns32k/ns32k.h
--- config/ns32k/ns32k.h	14 Jun 2003 21:47:43 -0000	1.56
+++ config/ns32k/ns32k.h	15 Jun 2003 00:43:32 -0000
@@ -1256,10 +1256,6 @@ __transfer_from_trampoline ()		\
 
 /* Define the output Assembly Language */
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(FILE) fprintf (FILE, "#NO_APP\n");
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/pa/elf.h
--- config/pa/elf.h	19 May 2002 05:23:18 -0000	1.13
+++ config/pa/elf.h	15 Jun 2003 00:43:32 -0000
@@ -32,20 +32,7 @@ Boston, MA 02111-1307, USA.  */
 #define DATA_SECTION_ASM_OP "\t.data"
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do {  \
-     if (TARGET_PA_20) \
-       fputs("\t.LEVEL 2.0\n", FILE); \
-     else if (TARGET_PA_11) \
-       fputs("\t.LEVEL 1.1\n", FILE); \
-     else \
-       fputs("\t.LEVEL 1.0\n", FILE); \
-     if (profile_flag)\
-       fprintf (FILE, "\t.IMPORT _mcount, ENTRY\n");\
-     if (write_symbols != NO_DEBUG) \
-       output_file_directive ((FILE), main_input_filename); \
-   } while (0)
+#define TARGET_ASM_FILE_START pa_elf_file_start
 
 #undef ASM_DECLARE_FUNCTION_NAME
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
===================================================================
Index: config/pa/pa-linux.h
--- config/pa/pa-linux.h	3 Jun 2003 09:06:54 -0000	1.33
+++ config/pa/pa-linux.h	15 Jun 2003 00:43:32 -0000
@@ -106,29 +106,7 @@ Boston, MA 02111-1307, USA.  */
 #define DATA_SECTION_ASM_OP "\t.data"
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
-/* Output at beginning of assembler file.  We override the definition
-   from <linux.h> so that we can get the proper .LEVEL directive.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-  do								\
-    {								\
-      if (write_symbols != NO_DEBUG)				\
-	{							\
-	  output_file_directive (FILE, main_input_filename);	\
-	  fputs ("\t.version\t\"01.01\"\n", FILE);		\
-	}							\
-      if (TARGET_64BIT)						\
-	fputs("\t.LEVEL 2.0w\n", FILE);				\
-      else if (TARGET_PA_20)					\
-	fputs("\t.LEVEL 2.0\n", FILE);				\
-      else if (TARGET_PA_11)					\
-	fputs("\t.LEVEL 1.1\n", FILE);				\
-      else							\
-	fputs("\t.LEVEL 1.0\n", FILE);				\
-      if (profile_flag)						\
-	fputs ("\t.IMPORT _mcount, CODE\n", FILE);		\
-    }								\
-   while (0)
+#define TARGET_ASM_FILE_START pa_linux_file_start
 
 /* We want local labels to start with period if made with asm_fprintf.  */
 #undef LOCAL_LABEL_PREFIX
===================================================================
Index: config/pa/pa.c
--- config/pa/pa.c	13 Jun 2003 11:36:31 -0000	1.214
+++ config/pa/pa.c	15 Jun 2003 00:43:34 -0000
@@ -136,6 +136,15 @@ static void copy_fp_args PARAMS ((rtx)) 
 static int length_fp_args PARAMS ((rtx)) ATTRIBUTE_UNUSED;
 static struct deferred_plabel *get_plabel PARAMS ((const char *))
      ATTRIBUTE_UNUSED;
+static inline void pa_file_start_level PARAMS ((void)) ATTRIBUTE_UNUSED;
+static inline void pa_file_start_space PARAMS ((int)) ATTRIBUTE_UNUSED;
+static inline void pa_file_start_file PARAMS ((int)) ATTRIBUTE_UNUSED;
+static inline void pa_file_start_mcount PARAMS ((const char*)) ATTRIBUTE_UNUSED;
+static void pa_elf_file_start PARAMS ((void)) ATTRIBUTE_UNUSED;
+static void pa_som_file_start PARAMS ((void)) ATTRIBUTE_UNUSED;
+static void pa_linux_file_start PARAMS ((void)) ATTRIBUTE_UNUSED;
+static void pa_hpux64_gas_file_start PARAMS ((void)) ATTRIBUTE_UNUSED;
+static void pa_hpux64_hpas_file_start PARAMS ((void)) ATTRIBUTE_UNUSED;
 static void output_deferred_plabels PARAMS ((void));
 
 /* Save the operands last given to a compare for use when we
@@ -219,6 +228,9 @@ static size_t n_deferred_plabels = 0;
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START pa_file_start
+
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END output_deferred_plabels
 
@@ -4902,6 +4914,104 @@ output_global_address (file, x, round_co
   else
     output_addr_const (file, x);
 }
+
+/* Output boilerplate text to appear at the beginning of the file.
+   There are several possible versions.  */
+#define aputs(x) fputs(x, asm_out_file)
+static inline void
+pa_file_start_level ()
+{
+  if (TARGET_64BIT)
+    aputs ("\t.LEVEL 2.0w\n");
+  else if (TARGET_PA_20)
+    aputs ("\t.LEVEL 2.0\n");
+  else if (TARGET_PA_11)
+    aputs ("\t.LEVEL 1.1\n");
+  else
+    aputs ("\t.LEVEL 1.0\n");
+}
+
+static inline void
+pa_file_start_space (sortspace)
+     int sortspace;
+{
+  aputs ("\t.SPACE $PRIVATE$");
+  if (sortspace)
+    aputs (",SORT=16");
+  aputs ("\n\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31");
+  aputs ("\n\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82");
+  aputs ("\n\t.SPACE $TEXT$");
+  if (sortspace)
+    aputs (",SORT=8");
+  aputs ("\n\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44");
+  aputs ("\n\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n");
+}
+
+static inline void
+pa_file_start_file (want_version)
+     int want_version;
+{
+  if (write_symbols != NO_DEBUG)
+    {
+      output_file_directive (asm_out_file, main_input_filename);
+      if (want_version)
+	aputs ("\t.version\t\"01.01\"\n");
+    }
+}
+
+static inline void
+pa_file_start_mcount (aswhat)
+     const char *aswhat;
+{
+  if (profile_flag)
+    fprintf (asm_out_file, "\t.IMPORT _mcount,%s\n", aswhat);
+}
+  
+static void
+pa_elf_file_start ()
+{
+  pa_file_start_level ();
+  pa_file_start_mcount ("ENTRY");
+  pa_file_start_file (0);
+}
+
+static void
+pa_som_file_start ()
+{
+  pa_file_start_level ();
+  pa_file_start_space (0);
+  aputs ("\t.IMPORT $global$,DATA\n");
+  aputs ("\t.IMPORT $$dyncall,MILLICODE\n");
+  pa_file_start_mcount ("CODE");
+  pa_file_start_file (0);
+}
+
+static void
+pa_linux_file_start ()
+{
+  pa_file_start_file (1);
+  pa_file_start_level ();
+  pa_file_start_mcount ("CODE");
+}
+
+static void
+pa_hpux64_gas_file_start ()
+{
+  pa_file_start_level ();
+  if (profile_flag)
+    ASM_OUTPUT_TYPE_DIRECTIVE (asm_out_file, "_mcount", "function");
+  pa_file_start_file (1);
+}
+
+static void
+pa_hpux64_hpas_file_start ()
+{
+  pa_file_start_level ();
+  pa_file_start_space (1);
+  pa_file_start_mcount ("CODE");
+  pa_file_start_file_directive (0);
+}
+#undef aputs
 
 static struct deferred_plabel *
 get_plabel (fname)
===================================================================
Index: config/pa/pa64-hpux.h
--- config/pa/pa64-hpux.h	6 Jun 2003 21:10:59 -0000	1.27
+++ config/pa/pa64-hpux.h	15 Jun 2003 00:43:34 -0000
@@ -100,25 +100,7 @@ Boston, MA 02111-1307, USA.  */
 /* We are using GAS.  */
 #define TARGET_GAS 1
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-do {								\
-  if (TARGET_64BIT)						\
-    fputs("\t.LEVEL 2.0w\n", FILE);				\
-  else if (TARGET_PA_20)					\
-    fputs("\t.LEVEL 2.0\n", FILE);				\
-  else if (TARGET_PA_11)					\
-    fputs("\t.LEVEL 1.1\n", FILE);				\
-  else								\
-    fputs("\t.LEVEL 1.0\n", FILE);				\
-  if (profile_flag)						\
-    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, "_mcount", "function");	\
-  if (write_symbols != NO_DEBUG)				\
-    {								\
-      output_file_directive ((FILE), main_input_filename);	\
-      fputs ("\t.version\t\"01.01\"\n", FILE);			\
-    }								\
-} while (0)
+#define TARGET_ASM_FILE_START pa_hpux64_gas_file_start
 
 /* This is how we output a null terminated string.  */
 #undef STRING_ASM_OP
@@ -221,28 +203,7 @@ do {								\
 /* This target uses the ELF object file format.  */
 #define OBJECT_FORMAT_ELF
 
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)					\
-do {								\
-  if (TARGET_64BIT)						\
-    fputs("\t.LEVEL 2.0w\n", FILE);				\
-  else if (TARGET_PA_20)					\
-    fputs("\t.LEVEL 2.0\n", FILE);				\
-  else if (TARGET_PA_11)					\
-    fputs("\t.LEVEL 1.1\n", FILE);				\
-  else								\
-    fputs("\t.LEVEL 1.0\n", FILE);				\
-  fputs("\t.SPACE $PRIVATE$,SORT=16\n\
-\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
-\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
-\t.SPACE $TEXT$,SORT=8\n\
-\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
-\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE);	\
-  if (profile_flag)						\
-    fprintf (FILE, "\t.IMPORT _mcount, CODE\n");		\
-  if (write_symbols != NO_DEBUG)				\
-    output_file_directive ((FILE), main_input_filename);	\
-} while (0)
+#define TARGET_ASM_FILE_START pa_hpux64_hpas_file_start
 
 #undef TEXT_SECTION_ASM_OP
 #define TEXT_SECTION_ASM_OP		"\t.SUBSPA $CODE$\n"
===================================================================
Index: config/pa/som.h
--- config/pa/som.h	16 Jan 2003 00:34:43 -0000	1.41
+++ config/pa/som.h	15 Jun 2003 00:43:34 -0000
@@ -214,29 +214,7 @@ do {								\
 	     fputs ("\n", FILE);					\
 	   }} while (0)
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(FILE) \
-do {  \
-     if (TARGET_PA_20) \
-       fputs("\t.LEVEL 2.0\n", FILE); \
-     else if (TARGET_PA_11) \
-       fputs("\t.LEVEL 1.1\n", FILE); \
-     else \
-       fputs("\t.LEVEL 1.0\n", FILE); \
-     fputs ("\t.SPACE $PRIVATE$\n\
-\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
-\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
-\t.SPACE $TEXT$\n\
-\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
-\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n\
-\t.IMPORT $global$,DATA\n\
-\t.IMPORT $$dyncall,MILLICODE\n", FILE);\
-     if (profile_flag)\
-       fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
-     if (write_symbols != NO_DEBUG) \
-       output_file_directive ((FILE), main_input_filename); \
-   } while (0)
+#define TARGET_ASM_FILE_START pa_som_file_start
 
 /* Output before code.  */
 
===================================================================
Index: config/pdp11/pdp11.h
--- config/pdp11/pdp11.h	14 Jun 2003 21:47:44 -0000	1.51
+++ config/pdp11/pdp11.h	15 Jun 2003 00:43:35 -0000
@@ -990,20 +990,6 @@ extern struct rtx_def *cc0_reg_rtx;
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-
-#if 0
-#define ASM_FILE_START(FILE) \
-(								\
-fprintf (FILE, "\t.data\n"),					\
-fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n")	\
-/* do we need reg def's R0 = %0 etc ??? */			\
-)
-#else
-#define ASM_FILE_START(FILE)
-#endif
-
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/rs6000/linux64.h
--- config/rs6000/linux64.h	7 Jun 2003 17:11:47 -0000	1.44
+++ config/rs6000/linux64.h	15 Jun 2003 00:43:35 -0000
@@ -103,17 +103,6 @@
   rs6000_override_options (((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
 			   ? (char *) 0 : TARGET_CPU_DEFAULT)
 
-#undef	ASM_FILE_START
-#define	ASM_FILE_START(FILE)						    \
-  do									    \
-    {                                                                       \
-      output_file_directive ((FILE), main_input_filename);		    \
-      rs6000_file_start (FILE, (((TARGET_DEFAULT ^ target_flags)	    \
-				 & MASK_64BIT)				    \
-				? (char *) 0 : TARGET_CPU_DEFAULT));	    \
-    }									    \
-  while (0)
-
 #endif
 
 #undef	ASM_DEFAULT_SPEC
===================================================================
Index: config/rs6000/rs6000-protos.h
--- config/rs6000/rs6000-protos.h	4 Jun 2003 15:23:42 -0000	1.56
+++ config/rs6000/rs6000-protos.h	15 Jun 2003 00:43:35 -0000
@@ -167,7 +167,6 @@ extern enum direction function_arg_paddi
 
 extern void optimization_options PARAMS ((int, int));
 extern void rs6000_override_options PARAMS ((const char *));
-extern void rs6000_file_start PARAMS ((FILE *, const char *));
 extern int direct_return PARAMS ((void));
 extern union tree_node *rs6000_build_va_list PARAMS ((void));
 extern int first_reg_to_save PARAMS ((void));
===================================================================
Index: config/rs6000/rs6000.c
--- config/rs6000/rs6000.c	13 Jun 2003 02:01:52 -0000	1.490
+++ config/rs6000/rs6000.c	15 Jun 2003 00:43:38 -0000
@@ -940,15 +940,22 @@ optimization_options (level, size)
 
 /* Do anything needed at the start of the asm file.  */
 
-void
-rs6000_file_start (file, default_cpu)
-     FILE *file;
-     const char *default_cpu;
+static void
+rs6000_file_start ()
 {
   size_t i;
   char buffer[80];
   const char *start = buffer;
   struct rs6000_cpu_select *ptr;
+  const char *default_cpu = TARGET_CPU_DEFAULT;
+  FILE *file = asm_out_file;
+
+  default_file_start ();
+
+#ifdef TARGET_BI_ARCH
+  if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT)
+    default_cpu = 0;
+#endif
 
   if (flag_verbose_asm)
     {
@@ -14170,6 +14177,40 @@ rs6000_xcoff_section_type_flags (decl, n
 		 ? UNITS_PER_FP_WORD : MIN_UNITS_PER_WORD);
 
   return flags | (exact_log2 (align) & SECTION_ENTSIZE);
+}
+
+/* Output at beginning of assembler file.
+
+   Initialize the section names for the RS/6000 at this point.
+
+   Specify filename, including full path, to assembler.
+
+   We want to go into the TOC section so at least one .toc will be emitted.
+   Also, in order to output proper .bs/.es pairs, we need at least one static
+   [RW] section emitted.
+
+   Finally, declare mcount when profiling to make the assembler happy.  */
+
+static void
+rs6000_xcoff_file_start ()
+{
+  rs6000_gen_section_name (&xcoff_bss_section_name,
+			   main_input_filename, ".bss_");
+  rs6000_gen_section_name (&xcoff_private_data_section_name,
+			   main_input_filename, ".rw_");
+  rs6000_gen_section_name (&xcoff_read_only_section_name,
+			   main_input_filename, ".ro_");
+
+  fputs ("\t.file\t", asm_out_file);
+  output_quoted_string (asm_out_file, main_input_filename);
+  fputc ('\n', asm_out_file);
+  toc_section ();
+  if (write_symbols != NO_DEBUG)
+    private_data_section ();
+  text_section ();
+  if (profile_flag)
+    fprintf (asm_out_file, "\t.extern %s\n", RS6000_MCOUNT);
+  rs6000_file_start ();
 }
 
 /* Output at end of assembler file.
===================================================================
Index: config/rs6000/rs6000.h
--- config/rs6000/rs6000.h	12 Jun 2003 21:38:46 -0000	1.280
+++ config/rs6000/rs6000.h	15 Jun 2003 00:43:39 -0000
@@ -2423,6 +2423,8 @@ extern int toc_initialized;
     }									\
    while (0)
 
+#define TARGET_ASM_FILE_START rs6000_file_start
+
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/rs6000/sysv4.h
--- config/rs6000/sysv4.h	4 Jun 2003 15:23:42 -0000	1.131
+++ config/rs6000/sysv4.h	15 Jun 2003 00:43:39 -0000
@@ -714,16 +714,6 @@ do {									\
    || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V'			\
    || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
 
-/* Output .file.  */
-/* Override elfos.h definition.  */
-#undef	ASM_FILE_START
-#define	ASM_FILE_START(FILE)						\
-do {									\
-  output_file_directive ((FILE), main_input_filename);			\
-  rs6000_file_start (FILE, TARGET_CPU_DEFAULT);				\
-} while (0)
-
-
 extern int fixuplabelno;
 
 /* Handle constructors specially for -mrelocatable.  */
===================================================================
Index: config/rs6000/xcoff.h
--- config/rs6000/xcoff.h	7 Jun 2003 17:11:47 -0000	1.48
+++ config/rs6000/xcoff.h	15 Jun 2003 00:43:39 -0000
@@ -200,40 +200,10 @@ toc_section ()						\
 /* Globalizing directive for a label.  */
 #define GLOBAL_ASM_OP "\t.globl "
 
-/* Output at beginning of assembler file.
-
-   Initialize the section names for the RS/6000 at this point.
-
-   Specify filename, including full path, to assembler.
-
-   We want to go into the TOC section so at least one .toc will be emitted.
-   Also, in order to output proper .bs/.es pairs, we need at least one static
-   [RW] section emitted.
-
-   Finally, declare mcount when profiling to make the assembler happy.  */
-
-#define ASM_FILE_START(FILE)					\
-{								\
-  rs6000_gen_section_name (&xcoff_bss_section_name,		\
-			   main_input_filename, ".bss_");	\
-  rs6000_gen_section_name (&xcoff_private_data_section_name,	\
-			   main_input_filename, ".rw_");	\
-  rs6000_gen_section_name (&xcoff_read_only_section_name,	\
-			   main_input_filename, ".ro_");	\
-								\
-  fputs ("\t.file\t", FILE);                                    \
-  output_quoted_string (FILE, main_input_filename);             \
-  fputc ('\n', FILE);                                           \
-  toc_section ();						\
-  if (write_symbols != NO_DEBUG)				\
-    private_data_section ();					\
-  text_section ();						\
-  if (profile_flag)						\
-    fprintf (FILE, "\t.extern %s\n", RS6000_MCOUNT);		\
-  rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
-}
-
+#define TARGET_ASM_FILE_START rs6000_xcoff_file_start
 #define TARGET_ASM_FILE_END rs6000_xcoff_file_end
+#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
 
 /* This macro produces the initial definition of a function name.
    On the RS/6000, we need to place an extra '.' in the function name and
===================================================================
Index: config/sh/elf.h
--- config/sh/elf.h	18 May 2003 09:46:19 -0000	1.28
+++ config/sh/elf.h	15 Jun 2003 00:43:39 -0000
@@ -19,6 +19,10 @@ along with GNU CC; see the file COPYING.
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+/* Let sh.c know this is ELF.  */
+#undef TARGET_ELF
+#define TARGET_ELF 1
+
 /* Generate DWARF2 debugging information and make it the default */
 #define DWARF2_DEBUGGING_INFO 1
 
@@ -42,21 +46,6 @@ Boston, MA 02111-1307, USA.  */
 
 #undef LOCAL_LABEL_PREFIX
 #define LOCAL_LABEL_PREFIX "."
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) do {				\
-  output_file_directive ((FILE), main_input_filename);		\
-/* We also need to show the text section with the proper	\
-   attributes as in TEXT_SECTION_ASM_OP, before dwarf2out	\
-   emits it without attributes in TEXT_SECTION, else GAS	\
-   will complain.  We can teach GAS specifically about the	\
-   default attributes for our choice of text section, but	\
-   then we would have to change GAS again if/when we change	\
-   the text section name.  */					\
-   fprintf ((FILE), "%s\n", TEXT_SECTION_ASM_OP);		\
-  if (TARGET_LITTLE_ENDIAN)					\
-    fprintf ((FILE), "\t.little\n");				\
-} while (0)
 
 #undef SIZE_TYPE
 #define SIZE_TYPE (TARGET_SH5 ? "long unsigned int" : "unsigned int")
===================================================================
Index: config/sh/sh-protos.h
--- config/sh/sh-protos.h	10 Jun 2003 20:53:31 -0000	1.42
+++ config/sh/sh-protos.h	15 Jun 2003 00:43:39 -0000
@@ -111,7 +111,6 @@ extern tree sh_build_va_list PARAMS ((vo
 extern const char *output_jump_label_table PARAMS ((void));
 extern int sh_handle_pragma PARAMS ((int (*)(void), void (*)(int), const char *));
 extern struct rtx_def *get_fpscr_rtx PARAMS ((void));
-extern void output_file_start PARAMS ((FILE *));
 extern int sh_media_register_for_return PARAMS ((void));
 extern void sh_expand_prologue PARAMS ((void));
 extern void sh_expand_epilogue PARAMS ((void));
===================================================================
Index: config/sh/sh.c
--- config/sh/sh.c	10 Jun 2003 20:53:31 -0000	1.216
+++ config/sh/sh.c	15 Jun 2003 00:43:41 -0000
@@ -215,6 +215,7 @@ static void sh_media_init_builtins PARAM
 static rtx sh_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
 static void sh_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
 					HOST_WIDE_INT, tree));
+static void sh_file_start PARAMS ((void));
 static int flow_dependent_p PARAMS ((rtx, rtx));
 static void flow_dependent_p_1 PARAMS ((rtx, rtx, void *));
 static int shiftcosts PARAMS ((rtx));
@@ -251,6 +252,10 @@ static int sh_address_cost PARAMS ((rtx)
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START sh_file_start
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 #undef TARGET_INSERT_ATTRIBUTES
 #define TARGET_INSERT_ATTRIBUTES sh_insert_attributes
 
@@ -1282,24 +1287,37 @@ output_ieee_ccmpeq (insn, operands)
 
 /* Output to FILE the start of the assembler file.  */
 
-void
-output_file_start (file)
+static void
+sh_file_start (file)
      FILE *file;
 {
-  output_file_directive (file, main_input_filename);
+  default_file_start ();
 
-  /* Switch to the data section so that the coffsem symbol
-     isn't in the text section.  */
-  data_section ();
+  if (TARGET_ELF)
+    /* We need to show the text section with the proper
+       attributes as in TEXT_SECTION_ASM_OP, before dwarf2out
+       emits it without attributes in TEXT_SECTION, else GAS
+       will complain.  We can teach GAS specifically about the
+       default attributes for our choice of text section, but
+       then we would have to change GAS again if/when we change
+       the text section name.  */
+    fprintf ((FILE), "%s\n", TEXT_SECTION_ASM_OP);
+  else
+    /* Switch to the data section so that the coffsem symbol
+       isn't in the text section.  */
+    data_section ();
 
   if (TARGET_LITTLE_ENDIAN)
     fprintf (file, "\t.little\n");
 
-  if (TARGET_SHCOMPACT)
-    fprintf (file, "\t.mode\tSHcompact\n");
-  else if (TARGET_SHMEDIA)
-    fprintf (file, "\t.mode\tSHmedia\n\t.abi\t%i\n",
-	     TARGET_SHMEDIA64 ? 64 : 32);
+  if (!TARGET_ELF)
+    {
+      if (TARGET_SHCOMPACT)
+	fprintf (file, "\t.mode\tSHcompact\n");
+      else if (TARGET_SHMEDIA)
+	fprintf (file, "\t.mode\tSHmedia\n\t.abi\t%i\n",
+		 TARGET_SHMEDIA64 ? 64 : 32);
+    }
 }
 
 /* Check if PAT includes UNSPEC_CALLER unspec pattern.  */
===================================================================
Index: config/sh/sh.h
--- config/sh/sh.h	14 Jun 2003 21:47:44 -0000	1.206
+++ config/sh/sh.h	15 Jun 2003 00:43:42 -0000
@@ -151,6 +151,9 @@ extern int target_flags;
 #define LITTLE_ENDIAN_BIT (1<<29)
 #define IEEE_BIT (1<<30)
 
+/* Nonzero if this is an ELF target - compile time only */
+#define TARGET_ELF 0
+
 /* Nonzero if we should dump out instruction size info.  */
 #define TARGET_DUMPISIZE  (target_flags & ISIZE_BIT)
 
@@ -2818,10 +2821,6 @@ while (0)
    assembler language.  The compiler assumes that the comment will end at
    the end of the line.  */
 #define ASM_COMMENT_START "!"
-
-/* The text to go at the start of the assembler file.  */
-#define ASM_FILE_START(STREAM) \
-  output_file_start (STREAM)
 
 #define ASM_APP_ON  		""
 #define ASM_APP_OFF  		""
===================================================================
Index: config/sparc/sparc.h
--- config/sparc/sparc.h	14 Jun 2003 21:47:45 -0000	1.229
+++ config/sparc/sparc.h	15 Jun 2003 00:43:43 -0000
@@ -2668,10 +2668,6 @@ do {                                    
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-
-#define ASM_FILE_START(file)
-
 /* A C string constant describing how to begin a comment in the target
    assembler language.  The compiler assumes that the comment will end at
    the end of the line.  */
===================================================================
Index: config/v850/v850-protos.h
--- config/v850/v850-protos.h	14 May 2003 07:29:54 -0000	1.19
+++ config/v850/v850-protos.h	15 Jun 2003 00:43:43 -0000
@@ -35,7 +35,6 @@ extern void   zdata_section             
 extern void   rozdata_section               PARAMS ((void));
 extern void   zbss_section                  PARAMS ((void));
 extern int    v850_handle_pragma            PARAMS ((int (*)(void), void (*)(int), char *));
-extern void   asm_file_start                PARAMS ((FILE *));
 extern void   override_options              PARAMS ((void));
 extern int    compute_register_save_size    PARAMS ((long *));
 extern int    compute_frame_size            PARAMS ((int, long *));
===================================================================
Index: config/v850/v850.c
--- config/v850/v850.c	16 May 2003 22:39:21 -0000	1.77
+++ config/v850/v850.c	15 Jun 2003 00:43:44 -0000
@@ -105,6 +105,8 @@ static int v850_interrupt_p = FALSE;
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO v850_encode_section_info
 
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS v850_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -158,15 +160,6 @@ override_options ()
     }
 }
 
-
-/* Output assembly code for the start of the file.  */
-
-void
-asm_file_start (file)
-     FILE *file;
-{
-  output_file_directive (file, main_input_filename);
-}
 
 
 /* Return an RTX to represent where a value with mode MODE will be returned
===================================================================
Index: config/v850/v850.h
--- config/v850/v850.h	14 Jun 2003 21:47:45 -0000	1.87
+++ config/v850/v850.h	15 Jun 2003 00:43:45 -0000
@@ -1144,10 +1144,6 @@ zbss_section ()								\
 #define ZCOMMON_ASM_OP 	       "\t.zcomm\t"
 #define TCOMMON_ASM_OP 	       "\t.tcomm\t"
 
-/* Output at beginning/end of assembler file.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) asm_file_start(FILE)
-
 #define ASM_COMMENT_START "#"
 
 /* Output to assembler file text saying following lines
===================================================================
Index: config/vax/vax.c
--- config/vax/vax.c	4 Jun 2003 21:18:48 -0000	1.45
+++ config/vax/vax.c	15 Jun 2003 00:43:45 -0000
@@ -43,6 +43,7 @@ Boston, MA 02111-1307, USA.  */
 
 static int follows_p PARAMS ((rtx, rtx));
 static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
+static void vax_file_start PARAMS ((void));
 static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
 					 HOST_WIDE_INT, tree));
 static int vax_address_cost_1 PARAMS ((rtx));
@@ -57,6 +58,10 @@ static bool vax_rtx_costs PARAMS ((rtx, 
 #undef TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE vax_output_function_prologue
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START vax_file_start
+#define TARGET_ASM_FILE_START_APP_OFF true
+
 #undef TARGET_ASM_OUTPUT_MI_THUNK
 #define TARGET_ASM_OUTPUT_MI_THUNK vax_output_mi_thunk
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
@@ -124,6 +129,18 @@ vax_output_function_prologue (file, size
     asm_fprintf (file, "\tmovab %wd(%Rsp),%Rsp\n", -size);
   else if (size)
     asm_fprintf (file, "\tsubl2 $%wd,%Rsp\n", size);
+}
+
+/* When debugging with stabs, we want to output an extra dummy label
+   so that gas can distinguish between D_float and G_float prior to
+   processing the .stabs directive identifying type double.  */
+static void
+vax_file_start ()
+{
+  default_file_start ();
+
+  if (write_symbols == DBX_DEBUG)
+    fprintf (asm_out_file, "___vax_%c_doubles:\n", ASM_DOUBLE_CHAR);
 }
 
 /* This is like nonimmediate_operand with a restriction on the type of MEM.  */
===================================================================
Index: config/vax/vax.h
--- config/vax/vax.h	30 May 2003 14:02:48 -0000	1.61
+++ config/vax/vax.h	15 Jun 2003 00:43:45 -0000
@@ -938,19 +938,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_
 
 /* Control the assembler format that we output.  */
 
-/* Output at beginning of assembler file.  */
-/* When debugging, we want to output an extra dummy label so that gas
-   can distinguish between D_float and G_float prior to processing the
-   .stabs directive identifying type double.  */
-
-#define ASM_FILE_START(FILE) \
-  do {								\
-    fputs (ASM_APP_OFF, FILE);					\
-    if (write_symbols == DBX_DEBUG)				\
-      fprintf (FILE, "___vax_%c_doubles:\n", ASM_DOUBLE_CHAR);	\
-  } while (0)
-
-
 /* Output to assembler file text saying following lines
    may contain character constants, extra white space, comments, etc.  */
 
===================================================================
Index: config/vax/vaxv.h
--- config/vax/vaxv.h	12 May 2003 09:51:36 -0000	1.12
+++ config/vax/vaxv.h	15 Jun 2003 00:43:45 -0000
@@ -40,9 +40,7 @@ Boston, MA 02111-1307, USA.  */
 #undef LIB_SPEC
 
 /* The .file command should always begin the output.  */
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE) \
-output_file_directive ((FILE), main_input_filename)
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 #undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN(FILE,LOG) \



More information about the Gcc-patches mailing list