This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Target hook for ASM_FILE_END (take four)


Zack Weinberg <zack@codesourcery.com> writes:

> Zack Weinberg <zack@codesourcery.com> writes:
>
>> Here's a revised patch with that change.  I would appreciate a close
>> second look at the mips.c changes -- I'm not sure about the
>> interaction with the file-switching gunk.
>
> Re-revised patch based on errors found with cross compiler builds.

Re-re-revised patch incorporating Richard Sandiford's suggestions for
the MIPS back end.  There are no other functional changes.  I am
checking this in.

>         * config.gcc (with_cpu handling): Translate sparc64 in
>         $machine to --with-cpu=v9.
>         * config/alpha/alpha.c
>         (TARGET_ASM_GLOBALIZE_LABEL [TARGET_ABI_UNICOSMK]): Correct definition.
>         (alpha_setup_incoming_varargs): #ifdef out when TARGET_ABI_UNICOSMK.
>
>>       * target.h: New hook asm_out.file_end.
>>       * target.h: Update to match.  New hook macro TARGET_ASM_FILE_END.
>>       * toplev.c (compile_file: Use targetm.asm_out.file_end.
>>       * system.h: Poison ASM_FILE_END.
>>       * varasm.c (file_end_indicate_exec_stack): New.
>>       * output.h: Prototype it.
>>       * doc/tm.texi: Document TARGET_ASM_FILE_END and
>>       file_end_indicate_exec_stack.  Delete references to attasm.h.
>>
>>       * config/darwin.h (TARGET_ASM_FILE_END): Reset to darwin_file_end.
>>       (ASM_FILE_END): Delete; move code...
>>       * config/darwin.c (darwin_file_end): Here; new function.
>>       * config/darwin-protos.h: Prototype it.
>>       * config/alpha/alpha.c (unicosmk_asm_file_end): Make static,
>>       rename unicosmk_file_end.
>>       * config/arm/aof.h (ASM_FILE_END): Delete; move code...
>>       * config/arm/arm.c (aof_file_end): ... here; new static function.
>>       Set TARGET_ASM_FILE_END to aof_file_end if AOF_ASSEMBLER.
>>       Make aof_dump_imports and aof_dump_pic_table static.
>>       * config/avr/avr.c (asm_file_end): Rename avr_file_end, make static.
>>       Set TARGET_ASM_FILE_END to avr_file_end.
>>       * config/c4x/c4x.c (c4x_file_end): Make static.  Take no arguments.
>>       Set TARGET_ASM_FILE_END to c4x_file_end.
>>       * config/h8300/h8300.c (asm_file_end): Rename h8300_file_end,
>>       make static. Take no arguments.  Set TARGET_ASM_FILE_END to
>>       h8300_file_end.
>>       * config/i370/i370.h (ASM_FILE_END): Delete; move code...
>>       * config/i370/i370.c (i370_file_end): ... here; new static function.
>>       Set TARGET_ASM_FILE_END to i370_file_end.
>         * config/i386/i386.c (ix86_asm_file_end): Rename ix86_file_end.
>         Take no arguments.  Call file_end_indicate_exec_stack if
>         NEED_INDICATE_EXEC_STACK; don't use SUBTARGET_FILE_END.
>>       * config/i386/i386.h: Set TARGET_ASM_FILE_END, not ASM_FILE_END.
>>       Define NEED_INDICATE_EXEC_STACK to 0.
>>       * config/i386/linux.h, config/i386/linux64.h: Redefine
>>       NEED_INDICATE_EXEC_STACK to 1 instead of setting SUBTARGET_FILE_END.
>>       * config/i386/winnt.c (i386_pe_asm_file_end): Rename to
>>       i386_pe_file_end.  Take no arguments.  Use ix86_file_end.
>>       * config/ia64/ia64.c (ia64_hpux_asm_file_end): Rename to
>>       ia64_hpux_file_end, make static.  Take no arguments.
>>       * config/ip2k/ip2k.c (asm_file_start, asm_file_end,
>>       commands_in_prologues, commands_in_epilogues): Delete.
>>       (function_epilogue): Update to match.
>>       * config/mips/mips.c (mips_asm_file_end): Rename mips_file_end,
>>       make static.  Take no arguments.
>>       (iris6_asm_file_end): Rename iris6_file_end, make static, use
>>       mips_file_end, take no arguments.
         Set TARGET_ASM_FILE_END to iris6_file_end or mips_file_end as
         appropriate.
>>       * config/mmix/mmix.c (mmix_asm_file_end): Rename mmix_file_end,
>>       make static, take no arguments. Set TARGET_ASM_FILE_END to
>>       mmix_file_end.
>>       * config/pa/pa.c (output_deferred_plabels): Make static, take
>>       no arguments.  Set TARGET_ASM_FILE_END to output_deferred_plabels.
>>       * config/rs6000/xcoff.h (TARGET_ASM_FILE_END): Set it.
>>       (ASM_FILE_END): Delete; move code...
>>       * config/rs6000/rs6000.c (rs6000_xcoff_file_end): ... here;
>>       new static function.
>>
>>       * config/avr/avr.h, config/cris/cris.h, config/h8300/h8300.h
         * config/mmix/mmix.h, config/mips/iris6.h, config/mips/mips.h: 
         Don't set ASM_FILE_END.
>>       * config/alpha/linux-elf.h, config/m68k/linux.h, config/rs6000/linux.h
>>       * config/rs6000/linux64.h, config/s390/linux.h, config/sparc/linux.h
>>       * config/sparc/linux64.h: Set TARGET_ASM_FILE_END to 
>>       file_end_indicate_exec_stack; don't set ASM_FILE_END.
>>       * config/alpha/unicosmk.h, config/i386/cygming.h
         * config/ia64/hpux.h: Set TARGET_ASM_FILE_END, not ASM_FILE_END.
>>       * config/arm/arm-protos.h, config/alpha/alpha-protos.h
>>       * config/avr/avr-protos.h, config/c4x/c4x-protos.h
>>       * config/h8300/h8300-protos.h, config/ia64/ia64-protos.h
>>       * config/ip2k/ip2k-protos.h, config/mips/mips-protos.h
>>       * config/mmix/mmix-protos.h, config/pa/pa-protos.h: Update.

===================================================================
Index: config.gcc
--- config.gcc	6 Jun 2003 16:23:21 -0000	1.316
+++ config.gcc	7 Jun 2003 16:57:53 -0000
@@ -2226,6 +2226,9 @@ then
 			;;
 		sparc*-*-*)
 			with_cpu="`echo $machine | sed 's/-.*$//'`"
+			if [ x$with_cpu = xsparc64 ]; then
+				with_cpu=v9
+			fi
 			;;
 		esac
 	fi
===================================================================
Index: output.h
--- output.h	4 Jun 2003 05:21:38 -0000	1.126
+++ output.h	7 Jun 2003 16:57:53 -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 file_end_indicate_exec_stack PARAMS ((void));
 extern bool default_valid_pointer_mode PARAMS ((enum machine_mode));
 
 /* Emit data for vtable gc for GNU binutils.  */
===================================================================
Index: system.h
--- system.h	4 Jun 2003 11:35:09 -0000	1.151
+++ system.h	7 Jun 2003 16:57:53 -0000
@@ -623,7 +623,7 @@ typedef char _Bool;
 	WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION	\
 	ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL	\
 	ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS	\
-	ADDRESS_COST MACHINE_DEPENDENT_REORG
+	ADDRESS_COST MACHINE_DEPENDENT_REORG ASM_FILE_END
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
===================================================================
Index: target-def.h
--- target-def.h	14 May 2003 07:29:38 -0000	1.49
+++ target-def.h	7 Jun 2003 16:57:53 -0000
@@ -150,6 +150,10 @@ Foundation, 59 Temple Place - Suite 330,
 #define TARGET_ASM_EH_FRAME_SECTION default_eh_frame_section
 #endif
 
+#ifndef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END hook_void_void
+#endif
+
 #define TARGET_ASM_ALIGNED_INT_OP				\
 		       {TARGET_ASM_ALIGNED_HI_OP,		\
 			TARGET_ASM_ALIGNED_SI_OP,		\
@@ -184,7 +188,8 @@ Foundation, 59 Temple Place - Suite 330,
 			TARGET_ASM_CONSTRUCTOR,			\
 			TARGET_ASM_DESTRUCTOR,                  \
                         TARGET_ASM_OUTPUT_MI_THUNK,             \
-                        TARGET_ASM_CAN_OUTPUT_MI_THUNK }
+                        TARGET_ASM_CAN_OUTPUT_MI_THUNK,         \
+                        TARGET_ASM_FILE_END}
 
 /* Scheduler hooks.  All of these default to null pointers, which
    haifa-sched.c looks for and handles.  */
===================================================================
Index: target.h
--- target.h	14 May 2003 07:29:41 -0000	1.56
+++ target.h	7 Jun 2003 16:57:53 -0000
@@ -142,6 +142,9 @@ struct gcc_target
 				          HOST_WIDE_INT delta,
 				          HOST_WIDE_INT vcall_offset,
 				          tree function_decl));
+
+    /* Output any boilerplate text needed at the end of a translation unit.  */
+    void (*file_end) PARAMS ((void));
   } asm_out;
 
   /* Functions relating to instruction scheduling.  */
===================================================================
Index: toplev.c
--- toplev.c	7 Jun 2003 11:10:39 -0000	1.767
+++ toplev.c	7 Jun 2003 16:57:56 -0000
@@ -2261,9 +2261,7 @@ compile_file (void)
       timevar_pop (TV_DUMP);
     }
 
-#ifdef ASM_FILE_END
-  ASM_FILE_END (asm_out_file);
-#endif
+  targetm.asm_out.file_end ();
 
   /* Attach a special .ident directive to the end of the file to identify
      the version of GCC which compiled this code.  The format of the .ident
===================================================================
Index: varasm.c
--- varasm.c	4 Jun 2003 04:36:53 -0000	1.358
+++ varasm.c	7 Jun 2003 16:57:56 -0000
@@ -5364,4 +5364,18 @@ default_internal_label (stream, prefix, 
   ASM_OUTPUT_LABEL (stream, buf);
 }
 
+/* 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
+   a GNU extension to ELF but could be used on other targets.  */
+void
+file_end_indicate_exec_stack ()
+{
+  unsigned int flags = SECTION_DEBUG;
+  if (trampolines_created)
+    flags |= SECTION_CODE;
+
+  named_section_flags (".note.GNU-stack", flags);
+}
+
 #include "gt-varasm.h"
===================================================================
Index: config/darwin-protos.h
--- config/darwin-protos.h	20 Apr 2003 18:20:36 -0000	1.22
+++ config/darwin-protos.h	7 Jun 2003 16:57:57 -0000
@@ -78,6 +78,8 @@ extern void darwin_pragma_ignore PARAMS 
 extern void darwin_pragma_options PARAMS ((struct cpp_reader *));
 extern void darwin_pragma_unused PARAMS ((struct cpp_reader *));
 
+extern void darwin_file_end PARAMS ((void));
+
 /* Expanded by EXTRA_SECTION_FUNCTIONS into varasm.o.  */
 extern void const_section PARAMS ((void));
 extern void const_data_section PARAMS ((void));
===================================================================
Index: config/darwin.c
--- config/darwin.c	1 May 2003 18:00:50 -0000	1.37
+++ config/darwin.c	7 Jun 2003 16:57:57 -0000
@@ -1374,5 +1374,17 @@ darwin_asm_output_dwarf_delta (file, siz
     fprintf (file, "\n\t.long L$set$%d", darwin_dwarf_label_counter++);
 }
 
+void
+darwin_file_end ()
+{
+  machopic_finish (asm_out_file);
+  if (strcmp (lang_hooks.name, "GNU C++") == 0)
+    {
+      constructor_section ();
+      destructor_section ();
+      ASM_OUTPUT_ALIGN (asm_out_file, 1);
+    }
+}
+
 #include "gt-darwin.h"
 
===================================================================
Index: config/darwin.h
--- config/darwin.h	4 Jun 2003 15:23:40 -0000	1.53
+++ config/darwin.h	7 Jun 2003 16:57:57 -0000
@@ -330,17 +330,8 @@ do { text_section ();							\
 #undef	ASM_FILE_START
 #define ASM_FILE_START(FILE)
 
-#undef	ASM_FILE_END
-#define ASM_FILE_END(FILE)					\
-  do {								\
-    machopic_finish (asm_out_file);                             \
-    if (strcmp (lang_hooks.name, "GNU C++") == 0)		\
-      {								\
-	constructor_section ();					\
-	destructor_section ();					\
-	ASM_OUTPUT_ALIGN (FILE, 1);				\
-      }								\
-  } while (0)
+#undef  TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END darwin_file_end
 
 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
   fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", SIZE)
===================================================================
Index: config/alpha/alpha-protos.h
--- config/alpha/alpha-protos.h	14 May 2003 07:29:42 -0000	1.45
+++ config/alpha/alpha-protos.h	7 Jun 2003 16:57:57 -0000
@@ -180,6 +180,5 @@ extern void unicosmk_output_align PARAMS
 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_asm_file_end 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	4 Jun 2003 17:33:43 -0000	1.308
+++ config/alpha/alpha.c	7 Jun 2003 16:58:00 -0000
@@ -269,6 +269,7 @@ static void unicosmk_output_deferred_cas
 static void unicosmk_gen_dsib PARAMS ((unsigned long *imaskP));
 static void unicosmk_output_ssib PARAMS ((FILE *, const char *));
 static int unicosmk_need_dex PARAMS ((rtx));
+static void unicosmk_file_end PARAMS ((void));
 
 /* Get the number of args of a function in one of two ways.  */
 #if TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK
@@ -309,7 +310,7 @@ static void unicosmk_unique_section PARA
 # undef TARGET_ASM_UNIQUE_SECTION
 # define TARGET_ASM_UNIQUE_SECTION unicosmk_unique_section
 # undef TARGET_ASM_GLOBALIZE_LABEL
-# define TARGET_ASM_GLOBALIZE_LABEL hook_FILEptr_constcharptr_void
+# define TARGET_ASM_GLOBALIZE_LABEL hook_void_FILEptr_constcharptr
 #endif
 
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -6398,7 +6399,7 @@ alpha_build_va_list ()
    not the most efficient way to implement varargs with just one register
    class, but it isn't worth doing anything more efficient in this rare
    case.  */
-
+#ifndef TARGET_ABI_UNICOSMK
 void   
 alpha_setup_incoming_varargs(cum, mode, type, pretend_size, no_rtl)
      CUMULATIVE_ARGS cum;
@@ -6430,6 +6431,7 @@ alpha_setup_incoming_varargs(cum, mode, 
      }
   *pretend_size = 12 * UNITS_PER_WORD;
 }
+#endif
 
 void
 alpha_va_start (valist, nextarg)
@@ -9663,24 +9665,23 @@ unicosmk_asm_file_start (file)
 /* Output text to appear at the end of an assembler file. This includes all
    pending extern declarations and DEX expressions.  */
 
-void
-unicosmk_asm_file_end (file)
-      FILE *file;
+static void
+unicosmk_file_end ()
 {
-  fputs ("\t.endp\n\n", file);
+  fputs ("\t.endp\n\n", asm_out_file);
 
   /* Output all pending externs.  */
 
-  unicosmk_output_externs (file);
+  unicosmk_output_externs (asm_out_file);
 
   /* Output dex definitions used for functions whose names conflict with 
      register names.  */
 
-  unicosmk_output_dex (file);
+  unicosmk_output_dex (asm_out_file);
 
-  fputs ("\t.end\t", file);
-  unicosmk_output_module_name (file);
-  putc ('\n', file);
+  fputs ("\t.end\t", asm_out_file);
+  unicosmk_output_module_name (asm_out_file);
+  putc ('\n', asm_out_file);
 }
 
 /* Output the definition of a common variable.  */
@@ -9985,7 +9986,7 @@ unicosmk_ssib_name ()
   x = XEXP (x, 0);
   if (GET_CODE (x) != SYMBOL_REF)
     abort ();
-  fnname = default_name_encoding (XSTR (x, 0));
+  fnname = XSTR (x, 0);
 
   len = strlen (fnname);
   if (len + SSIB_PREFIX_LEN > 255)
===================================================================
Index: config/alpha/linux-elf.h
--- config/alpha/linux-elf.h	4 Jun 2003 16:44:50 -0000	1.11
+++ config/alpha/linux-elf.h	7 Jun 2003 16:58:00 -0000
@@ -42,9 +42,4 @@ Boston, MA 02111-1307, USA.  */
 #define LIB_SPEC \
 "%{pthread:-lpthread} %{shared:-lc}%{!shared:%{profile:-lc_p}%{!profile:-lc}} "
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
===================================================================
Index: config/alpha/unicosmk.h
--- config/alpha/unicosmk.h	12 May 2003 09:51:20 -0000	1.18
+++ config/alpha/unicosmk.h	7 Jun 2003 16:58:00 -0000
@@ -342,8 +342,7 @@ ssib_section ()			\
 
 /* This outputs text to go at the end of an assembler file.  */
 
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE)	unicosmk_asm_file_end (FILE)
+#define TARGET_ASM_FILE_END	unicosmk_file_end
 
 /* We take care of that in ASM_FILE_START.  */
 
===================================================================
Index: config/arm/aof.h
--- config/arm/aof.h	4 Jun 2003 17:33:48 -0000	1.25
+++ config/arm/aof.h	7 Jun 2003 16:58:02 -0000
@@ -170,15 +170,6 @@ do {					\
 #define NAME__MAIN "__gccmain"
 #define SYMBOL__MAIN __gccmain
 
-#define ASM_FILE_END(STREAM)		\
-do					\
-{					\
-  if (flag_pic)				\
-    aof_dump_pic_table (STREAM);	\
-  aof_dump_imports (STREAM);		\
-  fputs ("\tEND\n", (STREAM));		\
-} while (0);
-
 #define ASM_COMMENT_START ";"
 
 #define ASM_APP_ON ""
===================================================================
Index: config/arm/arm-protos.h
--- config/arm/arm-protos.h	4 Jun 2003 05:21:40 -0000	1.55
+++ config/arm/arm-protos.h	7 Jun 2003 16:58:02 -0000
@@ -158,12 +158,10 @@ extern int    arm_function_arg_pass_by_r
 
 #if defined AOF_ASSEMBLER 
 extern rtx    aof_pic_entry		PARAMS ((rtx));
-extern void   aof_dump_pic_table	PARAMS ((FILE *));
 extern char * aof_text_section		PARAMS ((void));
 extern char * aof_data_section		PARAMS ((void));
 extern void   aof_add_import		PARAMS ((const char *));
 extern void   aof_delete_import		PARAMS ((const char *));
-extern void   aof_dump_imports		PARAMS ((FILE *));
 extern void   zero_init_section		PARAMS ((void));
 extern void   common_section		PARAMS ((void));
 #endif /* AOF_ASSEMBLER */
===================================================================
Index: config/arm/arm.c
--- config/arm/arm.c	4 Jun 2003 21:18:47 -0000	1.277
+++ config/arm/arm.c	7 Jun 2003 16:58:06 -0000
@@ -147,6 +147,9 @@ static void	 arm_encode_section_info	PAR
 #endif
 #ifdef AOF_ASSEMBLER
 static void	 aof_globalize_label		PARAMS ((FILE *, Ccstar));
+static void	 aof_dump_imports		PARAMS ((FILE *));
+static void	 aof_dump_pic_table		PARAMS ((FILE *));
+static void	 aof_file_end			PARAMS ((void));
 #endif
 
 #undef Hint
@@ -172,6 +175,8 @@ static void	 aof_globalize_label		PARAMS
 #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_END
+#define TARGET_ASM_FILE_END aof_file_end
 #else
 #undef  TARGET_ASM_ALIGNED_SI_OP
 #define TARGET_ASM_ALIGNED_SI_OP NULL
@@ -12080,7 +12085,7 @@ aof_delete_import (name)
 
 int arm_main_function = 0;
 
-void
+static void
 aof_dump_imports (f)
      FILE * f;
 {
@@ -12112,6 +12117,15 @@ aof_globalize_label (stream, name)
   default_globalize_label (stream, name);
   if (! strcmp (name, "main"))
     arm_main_function = 1;
+}
+
+static void
+aof_file_end ()
+{
+  if (flag_pic)
+    aof_dump_pic_table (asm_out_file);
+  aof_dump_imports (asm_out_file);
+  fputs ("\tEND\n", asm_out_file);
 }
 #endif /* AOF_ASSEMBLER */
 
===================================================================
Index: config/avr/avr-protos.h
--- config/avr/avr-protos.h	14 May 2003 07:29:44 -0000	1.26
+++ config/avr/avr-protos.h	7 Jun 2003 16:58:06 -0000
@@ -23,7 +23,6 @@
 
 extern int    function_arg_regno_p              PARAMS ((int r));
 extern void   asm_file_start                    PARAMS ((FILE *file));
-extern void   asm_file_end                      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	16 May 2003 23:41:11 -0000	1.93
+++ config/avr/avr.c	7 Jun 2003 16:58:07 -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_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));
 static void   avr_unique_section PARAMS ((tree, int));
@@ -218,6 +219,8 @@ 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_END
+#define TARGET_ASM_FILE_END avr_file_end
 
 #undef TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE avr_output_function_prologue
@@ -4918,13 +4921,12 @@ asm_file_start (file)
 /* Outputs to the stdio stream FILE some
    appropriate text to go at the end of an assembler file.  */
 
-void
-asm_file_end (file)
-     FILE *file;
+static void
+avr_file_end ()
 {
-  fputs ("/* File ", file);
-  output_quoted_string (file, main_input_filename);
-  fprintf (file,
+  fputs ("/* File ", asm_out_file);
+  output_quoted_string (asm_out_file, main_input_filename);
+  fprintf (asm_out_file,
 	   ": code %4d = 0x%04x (%4d), prologues %3d, epilogues %3d */\n",
 	   commands_in_file,
 	   commands_in_file,
===================================================================
Index: config/avr/avr.h
--- config/avr/avr.h	7 Jun 2003 11:46:10 -0000	1.83
+++ config/avr/avr.h	7 Jun 2003 16:58:08 -0000
@@ -1699,17 +1699,6 @@ progmem_section ()							      \
    On systems that use SDB, it is necessary to output certain
    commands; see `attasm.h'.  */
 
-#define ASM_FILE_END(STREAM) asm_file_end (STREAM)
-/* A C expression which outputs to the stdio stream STREAM some
-   appropriate text to go at the end of an assembler file.
-
-   If this macro is not defined, the default is to output nothing
-   special at the end of the file.  Most systems don't require any
-   definition.
-
-   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-protos.h
--- config/c4x/c4x-protos.h	14 May 2003 07:29:44 -0000	1.32
+++ config/c4x/c4x-protos.h	7 Jun 2003 16:58:08 -0000
@@ -43,8 +43,6 @@ extern void c4x_global_label (const char
 
 extern void c4x_external_ref (const char *);
 
-extern void c4x_file_end (FILE *);
-
 #ifdef TREE_CODE
 extern void c4x_function_arg_advance PARAMS ((CUMULATIVE_ARGS *, 
 					      enum machine_mode, tree, int));
===================================================================
Index: config/c4x/c4x.c
--- config/c4x/c4x.c	16 May 2003 20:49:42 -0000	1.126
+++ config/c4x/c4x.c	7 Jun 2003 16:58:09 -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_end PARAMS ((void));
 static void c4x_check_attribute PARAMS ((const char *, tree, tree, tree *));
 static int c4x_r11_set_p PARAMS ((rtx));
 static int c4x_rptb_valid_p PARAMS ((rtx, rtx));
@@ -207,6 +208,8 @@ 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_END
+#define TARGET_ASM_FILE_END c4x_file_end
 
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE c4x_attribute_table
@@ -4562,9 +4565,8 @@ c4x_external_ref (name)
 }
 
 
-void
-c4x_file_end (fp)
-     FILE *fp;
+static void
+c4x_file_end ()
 {
   struct name_list *p;
   
@@ -4572,12 +4574,12 @@ c4x_file_end (fp)
   p = extern_head;
   while (p)
     {
-      fprintf (fp, "\t.ref\t");
-      assemble_name (fp, p->name);
-      fprintf (fp, "\n");
+      fprintf (asm_out_file, "\t.ref\t");
+      assemble_name (asm_out_file, p->name);
+      fprintf (asm_out_file, "\n");
       p = p->next;
     }
-  fprintf (fp, "\t.end\n");
+  fprintf (asm_out_file, "\t.end\n");
 }
 
 
===================================================================
Index: config/c4x/c4x.h
--- config/c4x/c4x.h	4 Jun 2003 17:33:49 -0000	1.130
+++ config/c4x/c4x.h	7 Jun 2003 16:58:10 -0000
@@ -1602,9 +1602,6 @@ c4x_external_ref (NAME)
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
 c4x_external_ref (XSTR (FUN, 0))
 
-#define	ASM_FILE_END(FILE) \
-c4x_file_end (FILE)
-
 /* The prefix to add to user-visible assembler symbols.  */
 
 #define USER_LABEL_PREFIX "_"
===================================================================
Index: config/cris/cris.h
--- config/cris/cris.h	18 May 2003 09:46:09 -0000	1.52
+++ config/cris/cris.h	7 Jun 2003 16:58:11 -0000
@@ -1410,10 +1410,6 @@ call_ ## FUNC (void)						\
     }								\
   while (0)
 
-/* Override previous definitions (elfos.h).  */
-#undef ASM_FILE_END
-#define ASM_FILE_END(STREAM)
-
 /* 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/h8300/h8300-protos.h
--- config/h8300/h8300-protos.h	4 Apr 2003 22:01:42 -0000	1.55
+++ config/h8300/h8300-protos.h	7 Jun 2003 16:58:11 -0000
@@ -95,7 +95,6 @@ extern void h8300_expand_prologue PARAMS
 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 void asm_file_end PARAMS ((FILE *));
 extern int h8300_initial_elimination_offset PARAMS ((int, int));
 
 struct cpp_reader;
===================================================================
Index: config/h8300/h8300.c
--- config/h8300/h8300.c	6 Jun 2003 05:28:07 -0000	1.230
+++ config/h8300/h8300.c	7 Jun 2003 16:58:12 -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_end PARAMS ((void));
 #ifndef OBJECT_FORMAT_ELF
 static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
 #endif
@@ -112,6 +113,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_END
+#define TARGET_ASM_FILE_END h8300_file_end
+
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO h8300_encode_section_info
 
@@ -715,11 +720,10 @@ asm_file_start (file)
 
 /* Output assembly language code for the end of file.  */
 
-void
-asm_file_end (file)
-     FILE *file;
+static void
+h8300_file_end ()
 {
-  fprintf (file, "\t.end\n");
+  fputs ("\t.end\n", asm_out_file);
 }
 
 /* Return true if OP is a valid source operand for an integer move
===================================================================
Index: config/h8300/h8300.h
--- config/h8300/h8300.h	4 Jun 2003 17:33:49 -0000	1.142
+++ config/h8300/h8300.h	7 Jun 2003 16:58:13 -0000
@@ -1039,8 +1039,6 @@ struct cum_arg
 
 #define ASM_FILE_START(FILE) asm_file_start (FILE)
 
-#define ASM_FILE_END(FILE) asm_file_end (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	4 Jun 2003 17:53:02 -0000	1.35
+++ config/i370/i370.c	7 Jun 2003 16:58:13 -0000
@@ -107,6 +107,8 @@ 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_end PARAMS ((void));
+
 #ifdef LONGEXTERNAL
 static int mvs_hash_alias PARAMS ((const char *));
 #endif
@@ -318,6 +320,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_END
+#define TARGET_ASM_FILE_END i370_file_end
 #undef TARGET_ASM_INTERNAL_LABEL
 #define  TARGET_ASM_INTERNAL_LABEL i370_internal_label
 #undef TARGET_RTX_COSTS
@@ -1596,6 +1600,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_end ()
+{
+  fputs ("\tEND\n", asm_out_file);
 }
 
 static void
===================================================================
Index: config/i370/i370.h
--- config/i370/i370.h	4 Jun 2003 17:53:03 -0000	1.61
+++ config/i370/i370.h	7 Jun 2003 16:58:14 -0000
@@ -1036,7 +1036,6 @@ enum reg_class
 { fputs ("\tRMODE\tANY\n", FILE);					\
   fputs ("\tCSECT\n", FILE); }
 
-#define ASM_FILE_END(FILE) fputs ("\tEND\n", FILE);
 #define ASM_COMMENT_START "*"
 #define ASM_APP_OFF ""
 #define ASM_APP_ON ""
===================================================================
Index: config/i386/cygming.h
--- config/i386/cygming.h	4 Jun 2003 17:33:50 -0000	1.3
+++ config/i386/cygming.h	7 Jun 2003 16:58:14 -0000
@@ -294,9 +294,8 @@ extern void i386_pe_unique_section PARAM
   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
 
 /* Output function declarations at the end of the file.  */
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE) \
-  i386_pe_asm_file_end (FILE)
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END i386_pe_file_end
 
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START " #"
@@ -332,7 +331,7 @@ extern void i386_pe_unique_section PARAM
 extern void i386_pe_record_external_function PARAMS ((const char *));
 extern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int));
 extern void i386_pe_record_exported_symbol PARAMS ((const char *, int));
-extern void i386_pe_asm_file_end PARAMS ((FILE *));
+extern void i386_pe_file_end PARAMS ((void));
 extern int i386_pe_dllexport_name_p PARAMS ((const char *));
 extern int i386_pe_dllimport_name_p PARAMS ((const char *));
 
===================================================================
Index: config/i386/i386-protos.h
--- config/i386/i386-protos.h	14 May 2003 07:29:45 -0000	1.97
+++ config/i386/i386-protos.h	7 Jun 2003 16:58:14 -0000
@@ -27,7 +27,7 @@ extern int ix86_can_use_return_insn_p PA
 extern int ix86_frame_pointer_required PARAMS ((void));
 extern void ix86_setup_frame_addresses PARAMS ((void));
 
-extern void ix86_asm_file_end PARAMS ((FILE *));
+extern void ix86_file_end PARAMS ((void));
 extern HOST_WIDE_INT ix86_initial_elimination_offset PARAMS((int, int));
 extern void ix86_expand_prologue PARAMS ((void));
 extern void ix86_expand_epilogue PARAMS ((int));
===================================================================
Index: config/i386/i386.c
--- config/i386/i386.c	7 Jun 2003 16:32:57 -0000	1.572
+++ config/i386/i386.c	7 Jun 2003 16:58:19 -0000
@@ -4705,8 +4705,7 @@ get_pc_thunk_name (name, regno)
    the return address of the caller and then returns.  */
 
 void
-ix86_asm_file_end (file)
-     FILE *file;
+ix86_file_end ()
 {
   rtx xops[2];
   int regno;
@@ -4733,16 +4732,16 @@ ix86_asm_file_end (file)
 	  (*targetm.asm_out.unique_section) (decl, 0);
 	  named_section (decl, NULL, 0);
 
-	  (*targetm.asm_out.globalize_label) (file, name);
-	  fputs ("\t.hidden\t", file);
-	  assemble_name (file, name);
-	  fputc ('\n', file);
-	  ASM_DECLARE_FUNCTION_NAME (file, name, decl);
+	  (*targetm.asm_out.globalize_label) (asm_out_file, name);
+	  fputs ("\t.hidden\t", asm_out_file);
+	  assemble_name (asm_out_file, name);
+	  fputc ('\n', asm_out_file);
+	  ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl);
 	}
       else
 	{
 	  text_section ();
-	  ASM_OUTPUT_LABEL (file, name);
+	  ASM_OUTPUT_LABEL (asm_out_file, name);
 	}
 
       xops[0] = gen_rtx_REG (SImode, regno);
@@ -4751,9 +4750,8 @@ ix86_asm_file_end (file)
       output_asm_insn ("ret", xops);
     }
 
-#ifdef SUBTARGET_FILE_END
-  SUBTARGET_FILE_END (file);
-#endif
+  if (NEED_INDICATE_EXEC_STACK)
+    file_end_indicate_exec_stack ();
 }
 
 /* Emit code for the SET_GOT patterns.  */
===================================================================
Index: config/i386/i386.h
--- config/i386/i386.h	7 Jun 2003 16:32:58 -0000	1.341
+++ config/i386/i386.h	7 Jun 2003 16:58:21 -0000
@@ -1825,11 +1825,8 @@ typedef struct ix86_args {
 #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
   ix86_va_arg ((VALIST), (TYPE))
 
-/* This macro is invoked at the end of compilation.  It is used here to
-   output code for -fpic that will load the return address into %ebx.  */
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE)  ix86_asm_file_end (FILE)
+#define TARGET_ASM_FILE_END ix86_file_end
+#define NEED_INDICATE_EXEC_STACK 0
 
 /* Output assembler code to FILE to increment profiler label # LABELNO
    for profiling a function entry.  */
===================================================================
Index: config/i386/linux.h
--- config/i386/linux.h	5 Jun 2003 00:23:22 -0000	1.46
+++ config/i386/linux.h	7 Jun 2003 16:58:21 -0000
@@ -223,12 +223,8 @@ Boston, MA 02111-1307, USA.  */
 	   : "=d"(BASE))
 #endif
 
-#define SUBTARGET_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: config/i386/linux64.h
--- config/i386/linux64.h	5 Jun 2003 00:23:23 -0000	1.23
+++ config/i386/linux64.h	7 Jun 2003 16:58:21 -0000
@@ -71,12 +71,8 @@ Boston, MA 02111-1307, USA.  */
 
 #define MULTILIB_DEFAULTS { "m64" }
 
-#define SUBTARGET_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  
===================================================================
Index: config/i386/winnt.c
--- config/i386/winnt.c	21 May 2003 00:33:26 -0000	1.47
+++ config/i386/winnt.c	7 Jun 2003 16:58:22 -0000
@@ -763,12 +763,11 @@ i386_pe_record_exported_symbol (name, is
    output the .drectve section.  */
 
 void
-i386_pe_asm_file_end (file)
-     FILE *file;
+i386_pe_file_end ()
 {
   struct extern_list *p;
 
-  ix86_asm_file_end (file);
+  ix86_file_end ();
 
   for (p = extern_head; p != NULL; p = p->next)
     {
@@ -780,7 +779,8 @@ i386_pe_asm_file_end (file)
       if (! TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (decl))
 	{
 	  TREE_ASM_WRITTEN (decl) = 1;
-	  i386_pe_declare_function_type (file, p->name, TREE_PUBLIC (decl));
+	  i386_pe_declare_function_type (asm_out_file, p->name,
+			  		 TREE_PUBLIC (decl));
 	}
     }
 
@@ -790,7 +790,7 @@ i386_pe_asm_file_end (file)
       drectve_section ();
       for (q = export_head; q != NULL; q = q->next)
 	{
-	  fprintf (file, "\t.ascii \" -export:%s%s\"\n",
+	  fprintf (asm_out_file, "\t.ascii \" -export:%s%s\"\n",
 		   i386_pe_strip_name_encoding (q->name),
 		   (q->is_data) ? ",data" : "");
 	}
===================================================================
Index: config/ia64/hpux.h
--- config/ia64/hpux.h	13 Mar 2003 18:26:29 -0000	1.26
+++ config/ia64/hpux.h	7 Jun 2003 16:58:22 -0000
@@ -136,7 +136,7 @@ do {								\
 
 /* Put out the needed function declarations at the end.  */
 
-#define ASM_FILE_END(STREAM) ia64_hpux_asm_file_end(STREAM)
+#define TARGET_ASM_FILE_END ia64_hpux_file_end
 
 #undef CTORS_SECTION_ASM_OP
 #define CTORS_SECTION_ASM_OP  "\t.section\t.init_array,\t\"aw\",\"init_array\""
===================================================================
Index: config/ia64/ia64-protos.h
--- config/ia64/ia64-protos.h	14 May 2003 07:29:47 -0000	1.57
+++ config/ia64/ia64-protos.h	7 Jun 2003 16:58:22 -0000
@@ -153,4 +153,3 @@ extern enum direction ia64_hpux_function
 #endif /* ARGS_SIZE_RTX */
 
 extern void ia64_hpux_handle_builtin_pragma PARAMS ((struct cpp_reader *));
-extern void ia64_hpux_asm_file_end PARAMS ((FILE *));
===================================================================
Index: config/ia64/ia64.c
--- config/ia64/ia64.c	16 May 2003 18:57:41 -0000	1.226
+++ config/ia64/ia64.c	7 Jun 2003 16:58:25 -0000
@@ -257,6 +257,9 @@ static unsigned int ia64_rwreloc_section
 
 static void ia64_hpux_add_extern_decl PARAMS ((const char *name))
      ATTRIBUTE_UNUSED;
+static void ia64_hpux_file_end PARAMS ((void))
+     ATTRIBUTE_UNUSED;
+
 
 /* Table of valid machine attributes.  */
 static const struct attribute_spec ia64_attribute_table[] =
@@ -8359,9 +8362,8 @@ ia64_hpux_add_extern_decl (name)
 
 /* Print out the list of used global functions.  */
 
-void
-ia64_hpux_asm_file_end (file)
-	FILE *file;
+static void
+ia64_hpux_file_end ()
 {
   while (extern_func_head)
     {
@@ -8376,12 +8378,13 @@ ia64_hpux_asm_file_end (file)
         {
 	  if (decl)
 	    TREE_ASM_WRITTEN (decl) = 1;
-	  (*targetm.asm_out.globalize_label) (file, extern_func_head->name);
-	  fprintf (file, "%s", TYPE_ASM_OP);
-	  assemble_name (file, extern_func_head->name);
-	  putc (',', file);
-	  fprintf (file, TYPE_OPERAND_FMT, "function");
-	  putc ('\n', file);
+	  (*targetm.asm_out.globalize_label) (asm_out_file,
+					      extern_func_head->name);
+	  fputs (TYPE_ASM_OP, asm_out_file);
+	  assemble_name (asm_out_file, extern_func_head->name);
+	  putc (',', asm_out_file);
+	  fprintf (asm_out_file, TYPE_OPERAND_FMT, "function");
+	  putc ('\n', asm_out_file);
         }
       extern_func_head = extern_func_head->next;
     }
===================================================================
Index: config/ip2k/ip2k-protos.h
--- config/ip2k/ip2k-protos.h	14 May 2003 07:29:50 -0000	1.6
+++ config/ip2k/ip2k-protos.h	7 Jun 2003 16:58:25 -0000
@@ -18,9 +18,6 @@
    the Free Software Foundation, 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-extern void asm_file_start PARAMS ((FILE *));
-extern void asm_file_end PARAMS ((FILE *));
-
 extern void function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 extern void function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 extern int find_one_set_bit_p PARAMS ((HOST_WIDE_INT));
===================================================================
Index: config/ip2k/ip2k.c
--- config/ip2k/ip2k.c	16 May 2003 22:05:08 -0000	1.20
+++ config/ip2k/ip2k.c	7 Jun 2003 16:58:26 -0000
@@ -111,12 +111,6 @@ const struct attribute_spec ip2k_attribu
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
-/* Commands in the functions prologues in the compiled file.  */
-static int commands_in_prologues;
-
-/* Commands in the functions epilogues in the compiled file.  */
-static int commands_in_epilogues;
-
 /* Prologue/Epilogue size in words.  */
 static int prologue_size;
 static int epilogue_size;
@@ -536,8 +530,6 @@ function_epilogue (file, size)
     }
   
   fprintf (file, "/* epilogue end (size=%d) */\n", epilogue_size);
-  commands_in_prologues += prologue_size;
-  commands_in_epilogues += epilogue_size;
 }
 
 /* Return the difference between the registers after the function
@@ -3240,32 +3232,6 @@ ip2k_handle_fndecl_attribute (node, name
     }
 
   return NULL_TREE;
-}
-
-/* Outputs to the stdio stream FILE some
-   appropriate text to go at the start of an assembler file.  */
-
-void
-asm_file_start (file)
-     FILE *file;
-{
-  output_file_directive (file, main_input_filename);
-  
-  commands_in_prologues = 0;
-  commands_in_epilogues = 0;
-}
-
-/* Outputs to the stdio stream FILE some
-   appropriate text to go at the end of an assembler file.  */
-
-void
-asm_file_end (file)
-     FILE *file;
-{
-  fprintf
-    (file,
-     "/* File %s: prologues %3d, epilogues %3d */\n",
-     main_input_filename, commands_in_prologues, commands_in_epilogues);
 }
 
 /* Cost functions.  */
===================================================================
Index: config/m68k/linux.h
--- config/m68k/linux.h	4 Jun 2003 16:44:51 -0000	1.32
+++ config/m68k/linux.h	7 Jun 2003 16:58:26 -0000
@@ -335,9 +335,4 @@ do {									\
      : "%d0", "%d2", "%d3");						\
 }
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
===================================================================
Index: config/mips/iris6.h
--- config/mips/iris6.h	12 May 2003 09:51:31 -0000	1.60
+++ config/mips/iris6.h	7 Jun 2003 16:58:27 -0000
@@ -358,8 +358,6 @@ current_section_flags ()						\
 #define ASM_OUTPUT_ALIGN iris6_asm_output_align
 #undef ASM_FILE_START
 #define ASM_FILE_START  iris6_asm_file_start
-#undef ASM_FILE_END
-#define ASM_FILE_END	iris6_asm_file_end
 
 #undef MAX_OFILE_ALIGNMENT
 #define MAX_OFILE_ALIGNMENT (32768*8)
===================================================================
Index: config/mips/mips-protos.h
--- config/mips/mips-protos.h	29 May 2003 08:33:24 -0000	1.40
+++ config/mips/mips-protos.h	7 Jun 2003 16:58:27 -0000
@@ -28,10 +28,8 @@ 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_end PARAMS ((FILE *));
 extern void		mips_asm_file_start PARAMS ((FILE *));
 extern void		iris6_asm_file_start PARAMS ((FILE *));
-extern void		iris6_asm_file_end 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	3 Jun 2003 08:57:54 -0000	1.272
+++ config/mips/mips.c	7 Jun 2003 16:58:30 -0000
@@ -272,6 +272,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_end			PARAMS ((void));
 #endif
 static int mips_adjust_cost			PARAMS ((rtx, rtx, rtx, int));
 static int mips_issue_rate			PARAMS ((void));
@@ -287,7 +288,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_end			PARAMS ((void));
 
 /* Structure to be filled in by compute_frame_size with register
    save masks, and offsets for the current function.  */
@@ -872,6 +873,13 @@ const struct mips_cpu_info mips_cpu_info
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG mips_reorg
 
+#undef TARGET_ASM_FILE_END
+#ifdef TARGET_IRIX6
+#define TARGET_ASM_FILE_END iris6_file_end
+#else
+#define TARGET_ASM_FILE_END mips_file_end
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* If X is one of the constants described by mips_constant_type,
@@ -6550,16 +6558,15 @@ mips_asm_file_start (stream)
    warning if the data area is more than 32K and -pic because 3 instructions
    are needed to reference the data pointers.  */
 
-void
-mips_asm_file_end (file)
-     FILE *file;
+static void
+mips_file_end ()
 {
   tree name_tree;
   struct extern_list *p;
 
   if (extern_head)
     {
-      fputs ("\n", file);
+      fputs ("\n", asm_out_file);
 
       for (p = extern_head; p != 0; p = p->next)
 	{
@@ -6571,13 +6578,13 @@ mips_asm_file_end (file)
 	      TREE_ASM_WRITTEN (name_tree) = 1;
 #ifdef ASM_OUTPUT_UNDEF_FUNCTION
 	      if (p->size == -1)
-		ASM_OUTPUT_UNDEF_FUNCTION (file, p->name);
+		ASM_OUTPUT_UNDEF_FUNCTION (asm_out_file, p->name);
 	      else
 #endif
 		{
-		  fputs ("\t.extern\t", file);
-		  assemble_name (file, p->name);
-		  fprintf (file, ", %d\n", p->size);
+		  fputs ("\t.extern\t", asm_out_file);
+		  assemble_name (asm_out_file, p->name);
+		  fprintf (asm_out_file, ", %d\n", p->size);
 		}
 	    }
 	}
@@ -6585,8 +6592,8 @@ mips_asm_file_end (file)
 
   if (TARGET_FILE_SWITCHING)
     {
-      fprintf (file, "\n\t.text\n");
-      copy_file_data (file, asm_out_text_file);
+      fputs ("\n\t.text\n", asm_out_file);
+      copy_file_data (asm_out_file, asm_out_text_file);
     }
 }
 
@@ -6612,7 +6619,7 @@ copy_file_data (to, from)
 }
 
 /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
-   is used, so that we don't emit an .extern for it in mips_asm_file_end.  */
+   is used, so that we don't emit an .extern for it in mips_file_end.  */
 
 void
 mips_declare_object (stream, name, init_string, final_string, size)
@@ -10717,19 +10724,19 @@ iris6_section_align_1 (slot, data)
   return 1;
 }
 
-void
-iris6_asm_file_end (stream)
-     FILE *stream;
+static void
+iris6_file_end ()
 {
   /* Emit section directives with the proper alignment at the top of the
      real output file.  */
+  FILE *temp = asm_out_file;
   asm_out_file = iris_orig_asm_out_file;
   htab_traverse (iris_section_align_htab, iris6_section_align_1, NULL);
 
   /* Copy the data emitted to the temp file to the real output file.  */
-  copy_file_data (asm_out_file, stream);
+  copy_file_data (asm_out_file, temp);
 
-  mips_asm_file_end (stream);
+  mips_file_end ();
 }
 #endif /* TARGET_IRIX6 */
 
===================================================================
Index: config/mips/mips.h
--- config/mips/mips.h	4 Jun 2003 17:50:42 -0000	1.256
+++ config/mips/mips.h	7 Jun 2003 16:58:32 -0000
@@ -3930,11 +3930,6 @@ while (0)
 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
   mips_output_external(STREAM,DECL,NAME)
 
-/* This says what to print at the end of the assembly file */
-#undef ASM_FILE_END
-#define ASM_FILE_END(STREAM) mips_asm_file_end(STREAM)
-
-
 /* Play switch file games if we're optimizing the global pointer.  */
 
 #undef TEXT_SECTION
===================================================================
Index: config/mmix/mmix-protos.h
--- config/mmix/mmix-protos.h	14 May 2003 07:29:51 -0000	1.24
+++ config/mmix/mmix-protos.h	7 Jun 2003 16:58:32 -0000
@@ -34,7 +34,6 @@ extern int mmix_register_move_cost
 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_file_end 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.c
--- config/mmix/mmix.c	14 May 2003 07:29:51 -0000	1.51
+++ config/mmix/mmix.c	7 Jun 2003 16:58:32 -0000
@@ -135,6 +135,7 @@ static void mmix_target_asm_function_epi
 static void mmix_reorg PARAMS ((void));
 static void mmix_asm_output_mi_thunk
   PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
+static void mmix_file_end PARAMS ((void));
 static bool mmix_rtx_costs
   PARAMS ((rtx, int, int, int *));
 
@@ -173,6 +174,8 @@ static bool mmix_rtx_costs
 #define TARGET_ASM_OUTPUT_MI_THUNK mmix_asm_output_mi_thunk
 #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_END
+#define TARGET_ASM_FILE_END mmix_file_end
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS mmix_rtx_costs
@@ -1310,11 +1313,10 @@ mmix_asm_file_start (stream)
   text_section ();
 }
 
-/* ASM_FILE_END.  */
+/* TARGET_ASM_FILE_END.  */
 
-void
-mmix_asm_file_end (stream)
-     FILE * stream ATTRIBUTE_UNUSED;
+static void
+mmix_file_end ()
 {
   /* Make sure each file ends with the data section. */
   data_section ();
===================================================================
Index: config/mmix/mmix.h
--- config/mmix/mmix.h	14 May 2003 07:29:51 -0000	1.52
+++ config/mmix/mmix.h	7 Jun 2003 16:58:34 -0000
@@ -922,9 +922,6 @@ typedef struct { int regs; int lib; } CU
 #define ASM_FILE_START(STREAM) \
  mmix_asm_file_start (STREAM)
 
-#define ASM_FILE_END(STREAM) \
- mmix_asm_file_end (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/pa/pa-protos.h
--- config/pa/pa-protos.h	14 May 2003 07:29:51 -0000	1.25
+++ config/pa/pa-protos.h	7 Jun 2003 16:58:34 -0000
@@ -133,7 +133,6 @@ extern int zdepi_cint_p PARAMS ((unsigne
 
 extern struct rtx_def *hppa_builtin_saveregs PARAMS ((void));
 
-extern void output_deferred_plabels PARAMS ((FILE *));
 extern void override_options PARAMS ((void));
 extern void output_ascii PARAMS ((FILE *, const char *, int));
 extern int compute_frame_size PARAMS ((int, int *));
===================================================================
Index: config/pa/pa.c
--- config/pa/pa.c	5 Jun 2003 16:47:01 -0000	1.212
+++ config/pa/pa.c	7 Jun 2003 16:58:37 -0000
@@ -136,6 +136,7 @@ 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 void output_deferred_plabels PARAMS ((void));
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -174,6 +175,7 @@ struct deferred_plabel GTY(())
 static GTY((length ("n_deferred_plabels"))) struct deferred_plabel *
   deferred_plabels;
 static size_t n_deferred_plabels = 0;
+
 
 /* Initialize the GCC target structure.  */
 
@@ -217,6 +219,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_END
+#define TARGET_ASM_FILE_END output_deferred_plabels
+
 #if !defined(USE_COLLECT2)
 #undef TARGET_ASM_CONSTRUCTOR
 #define TARGET_ASM_CONSTRUCTOR pa_asm_out_constructor
@@ -4939,9 +4944,8 @@ get_plabel (fname)
   return &deferred_plabels[i];
 }
 
-void
-output_deferred_plabels (file)
-     FILE *file;
+static void
+output_deferred_plabels ()
 {
   size_t i;
   /* If we have deferred plabels, then we need to switch into the data
@@ -4950,13 +4954,14 @@ output_deferred_plabels (file)
   if (n_deferred_plabels)
     {
       data_section ();
-      ASM_OUTPUT_ALIGN (file, TARGET_64BIT ? 3 : 2);
+      ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2);
     }
 
   /* Now output the deferred plabels.  */
   for (i = 0; i < n_deferred_plabels; i++)
     {
-      (*targetm.asm_out.internal_label) (file, "L", CODE_LABEL_NUMBER (deferred_plabels[i].internal_label));
+      (*targetm.asm_out.internal_label) (asm_out_file, "L",
+		 CODE_LABEL_NUMBER (deferred_plabels[i].internal_label));
       assemble_integer (gen_rtx_SYMBOL_REF (Pmode, deferred_plabels[i].name),
 			TARGET_64BIT ? 8 : 4, TARGET_64BIT ? 64 : 32, 1);
     }
===================================================================
Index: config/pa/pa.h
--- config/pa/pa.h	6 Jun 2003 21:10:58 -0000	1.195
+++ config/pa/pa.h	7 Jun 2003 16:58:37 -0000
@@ -1682,10 +1682,6 @@ do { 									\
 
 #define ASM_APP_OFF ""
 
-/* Output deferred plabels at the end of the file.  */
-
-#define ASM_FILE_END(FILE) output_deferred_plabels (FILE)
-
 /* This is how to output the definition of a user-level label named NAME,
    such as the label on a static function or variable NAME.  */
 
===================================================================
Index: config/rs6000/linux.h
--- config/rs6000/linux.h	4 Jun 2003 16:44:51 -0000	1.39
+++ config/rs6000/linux.h	7 Jun 2003 16:58:38 -0000
@@ -86,12 +86,7 @@
 /* We don't need to generate entries in .fixup.  */
 #undef RELOCATABLE_NEEDS_FIXUP
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: config/rs6000/linux64.h
--- config/rs6000/linux64.h	7 Jun 2003 06:11:18 -0000	1.43
+++ config/rs6000/linux64.h	7 Jun 2003 16:58:38 -0000
@@ -515,13 +515,7 @@ while (0)
 #undef DRAFT_V4_STRUCT_RET
 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    if (! TARGET_64BIT)							\
-      named_section_flags (".note.GNU-stack",				\
-			   SECTION_DEBUG				\
-			   | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: config/rs6000/rs6000.c
--- config/rs6000/rs6000.c	4 Jun 2003 17:41:06 -0000	1.484
+++ config/rs6000/rs6000.c	7 Jun 2003 16:58:42 -0000
@@ -258,6 +258,7 @@ static void rs6000_xcoff_select_rtx_sect
 						     unsigned HOST_WIDE_INT));
 static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *));
 static unsigned int rs6000_xcoff_section_type_flags PARAMS ((tree, const char *, int));
+static void rs6000_xcoff_file_end PARAMS ((void));
 #endif
 #if TARGET_MACHO
 static bool rs6000_binds_local_p PARAMS ((tree));
@@ -14139,6 +14140,20 @@ rs6000_xcoff_section_type_flags (decl, n
 		 ? UNITS_PER_FP_WORD : MIN_UNITS_PER_WORD);
 
   return flags | (exact_log2 (align) & SECTION_ENTSIZE);
+}
+
+/* Output at end of assembler file.
+   On the RS/6000, referencing data should automatically pull in text.  */
+
+static void
+rs6000_xcoff_file_end ()
+{
+  text_section ();
+  fputs ("_section_.text:\n", asm_out_file);
+  data_section ();
+  fputs (TARGET_32BIT
+	 ? "\t.long _section_.text\n" : "\t.llong _section_.text\n",
+	 asm_out_file);
 }
 #endif /* TARGET_XCOFF */
 
===================================================================
Index: config/rs6000/xcoff.h
--- config/rs6000/xcoff.h	4 Jun 2003 17:53:07 -0000	1.47
+++ config/rs6000/xcoff.h	7 Jun 2003 16:58:42 -0000
@@ -233,18 +233,7 @@ toc_section ()						\
   rs6000_file_start (FILE, TARGET_CPU_DEFAULT);			\
 }
 
-/* Output at end of assembler file.
-
-   On the RS/6000, referencing data should automatically pull in text.  */
-
-#define ASM_FILE_END(FILE)					\
-{								\
-  text_section ();						\
-  fputs ("_section_.text:\n", FILE);				\
-  data_section ();						\
-  fputs (TARGET_32BIT						\
-	 ? "\t.long _section_.text\n" : "\t.llong _section_.text\n", FILE); \
-}
+#define TARGET_ASM_FILE_END rs6000_xcoff_file_end
 
 /* 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/s390/linux.h
--- config/s390/linux.h	4 Jun 2003 16:44:50 -0000	1.30
+++ config/s390/linux.h	7 Jun 2003 16:58:42 -0000
@@ -121,12 +121,7 @@ Boston, MA 02111-1307, USA.  */
   { "link_arch31",	LINK_ARCH31_SPEC },	\
   { "link_arch64",	LINK_ARCH64_SPEC },	\
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: config/sparc/linux.h
--- config/sparc/linux.h	4 Jun 2003 16:44:51 -0000	1.48
+++ config/sparc/linux.h	7 Jun 2003 16:58:42 -0000
@@ -259,12 +259,7 @@ do {									\
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: config/sparc/linux64.h
--- config/sparc/linux64.h	4 Jun 2003 16:44:51 -0000	1.69
+++ config/sparc/linux64.h	7 Jun 2003 16:58:42 -0000
@@ -324,12 +324,7 @@ do {									\
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
 
-#define ASM_FILE_END(FILE) \
-  do {									\
-    named_section_flags (".note.GNU-stack",				\
-			 SECTION_DEBUG					\
-			 | (trampolines_created ? SECTION_CODE : 0));	\
-  } while (0)
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
===================================================================
Index: doc/tm.texi
--- doc/tm.texi	7 Jun 2003 11:46:10 -0000	1.229
+++ doc/tm.texi	7 Jun 2003 16:58:47 -0000
@@ -6186,22 +6186,23 @@ Normally this macro is defined to output
 @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
 
-On systems that use SDB, it is necessary to output certain commands;
-see @file{attasm.h}.
+@deftypefn {Target Hook} void TARGET_ASM_FILE_END ()
+Output to @code{asm_out_file} any text which the assembler expects
+to find at the end of a file.  The default is to output nothing.
+@end deftypefn
 
-@findex ASM_FILE_END
-@item ASM_FILE_END (@var{stream})
-A C expression which outputs to the stdio stream @var{stream}
-some appropriate text to go at the end of an assembler file.
-
-If this macro is not defined, the default is to output nothing
-special at the end of the file.  Most systems don't require any
-definition.
-
-On systems that use SDB, it is necessary to output certain commands;
-see @file{attasm.h}.
+@deftypefun void file_end_indicate_exec_stack ()
+Some systems use a common convention, the @samp{.note.GNU-stack}
+special section, to indicate whether or not an object file relies on
+the stack being executable.  If your system uses this convention, you
+should define @code{TARGET_ASM_FILE_END} to this function.  If you
+need to do other things in that hook, have your hook function call
+this function.
+@end deftypefun
 
+@table @code
 @findex ASM_COMMENT_START
 @item ASM_COMMENT_START
 A C string constant describing how to begin a comment in the target


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]