diff options
61 files changed, 310 insertions, 288 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58bba210f51..2b58ad4f1ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,85 @@ +2003-06-07 Zack Weinberg <zack@codesourcery.com> + + * 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. + Sat Jun 7 18:32:13 CEST 2003 Jan Hubicka <jh@suse.cz> * i386.h (OPTION_DEFAULT_SPECS): Avoid -mcpu default when -march is @@ -312,10 +394,10 @@ Thu Jun 5 13:23:51 CEST 2003 Jan Hubicka <jh@suse.cz> 2003-06-05 Nick Clifton <nickc@redhat.com> * config.gcc (m32r-elf): Revert previous delta. - * config/m32r/t-m32r (crtinit.o): Fix rule to work with - multilibs. Remove m32rx specific version. - (crtfini.o): Likewise. - (EXTRA_MULTILIB_PARTS): Define. + * config/m32r/t-m32r (crtinit.o): Fix rule to work with + multilibs. Remove m32rx specific version. + (crtfini.o): Likewise. + (EXTRA_MULTILIB_PARTS): Define. 2003-06-05 Eric Botcazou <ebotcazou@libertysurf.fr> @@ -323,7 +405,7 @@ Thu Jun 5 13:23:51 CEST 2003 Jan Hubicka <jh@suse.cz> constraints related to floating-point registers on SPARC. 2003-06-05 Eric Botcazou <ebotcazou@libertysurf.fr> - Paolo Bonzini <bonzini@gnu.org> + Paolo Bonzini <bonzini@gnu.org> PR target/10663 * configure.in (HAVE_LD_RO_RW_SECTION_MIXING): Redirect diff --git a/gcc/config.gcc b/gcc/config.gcc index b8568421adb..f01209f6b11 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2226,6 +2226,9 @@ then ;; sparc*-*-*) with_cpu="`echo $machine | sed 's/-.*$//'`" + if [ x$with_cpu = xsparc64 ]; then + with_cpu=v9 + fi ;; esac fi diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index d71b2d1ac5b..460207b6b5d 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -180,6 +180,5 @@ 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_asm_file_end PARAMS ((FILE *)); extern void unicosmk_output_common PARAMS ((FILE *, const char *, int, int)); #endif /* TARGET_ABI_UNICOSMK */ diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index eef95ba05e9..1da140e5fc7 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -269,6 +269,7 @@ static void unicosmk_output_deferred_case_vectors PARAMS ((FILE *)); 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 PARAMS ((tree, int)); # 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, type, pretend_size, no_rtl) } *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) diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h index c7319f31ffe..f3f1d6723b5 100644 --- a/gcc/config/alpha/linux-elf.h +++ b/gcc/config/alpha/linux-elf.h @@ -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 diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h index 5fc1b342cc0..fc0a9703d92 100644 --- a/gcc/config/alpha/unicosmk.h +++ b/gcc/config/alpha/unicosmk.h @@ -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. */ diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h index ef0a6faa186..82749ffff81 100644 --- a/gcc/config/arm/aof.h +++ b/gcc/config/arm/aof.h @@ -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 "" diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 33117ba3589..43de1d98e7b 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -158,12 +158,10 @@ extern int arm_function_arg_pass_by_reference PARAMS ((CUMULATIVE_ARGS *, #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 */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index f28362af480..5b089e4b44a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -147,6 +147,9 @@ static void arm_encode_section_info PARAMS ((tree, rtx, int)); #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 ((FILE *, Ccstar)); #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; { @@ -12113,6 +12118,15 @@ aof_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 */ #ifdef OBJECT_FORMAT_ELF diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 1e002c88fba..f4953887571 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -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)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 5e4f1c0e9bd..fe883f9d3f9 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -63,6 +63,7 @@ static tree avr_handle_progmem_attribute PARAMS ((tree *, tree, tree, int, boo 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, diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index e8a90d36800..3d09c00b9c0 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -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 diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 3a5f7a7a535..458019c1d74 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -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)); diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 19b9047e2b6..e708521e509 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -186,6 +186,7 @@ static int c4x_valid_operands PARAMS ((enum rtx_code, rtx *, 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"); } diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 70c2afcdbc8..bea00ffa1c6 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -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 "_" diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index f741663b53d..cc9d43e5980 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -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. */ diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 518bea83c69..ad8b2340ae6 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -78,6 +78,8 @@ extern void darwin_pragma_ignore PARAMS ((struct cpp_reader *)); 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)); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index d9ba56f7a5e..c17fc74ba08 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1374,5 +1374,17 @@ darwin_asm_output_dwarf_delta (file, size, lab1, lab2) 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" diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 72c1eebcd5a..eebb0ee12c6 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -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) diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index 6cdfbeed571..025f4231131 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -95,7 +95,6 @@ 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 void asm_file_end PARAMS ((FILE *)); extern int h8300_initial_elimination_offset PARAMS ((int, int)); struct cpp_reader; diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 7ab530dbc8e..ae01d281795 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -63,6 +63,7 @@ static tree h8300_handle_eightbit_data_attribute PARAMS ((tree *, tree, tree, in 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_mov_op; #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 diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 3225b2cce27..e979e972ea2 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -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. */ diff --git a/gcc/config/i370/i370.c b/gcc/config/i370/i370.c index da26b9e9d68..cbb118b1b9b 100644 --- a/gcc/config/i370/i370.c +++ b/gcc/config/i370/i370.c @@ -107,6 +107,8 @@ static void i370_globalize_label PARAMS ((FILE *, const char *)); #endif static void i370_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void i370_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +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 @@ -1599,6 +1603,12 @@ i370_output_function_epilogue (file, l) } static void +i370_file_end () +{ + fputs ("\tEND\n", asm_out_file); +} + +static void i370_internal_label (stream, prefix, labelno) FILE *stream; const char *prefix; diff --git a/gcc/config/i370/i370.h b/gcc/config/i370/i370.h index a52bb804a6e..fcdde6afda7 100644 --- a/gcc/config/i370/i370.h +++ b/gcc/config/i370/i370.h @@ -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 "" diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index d6f2a85319b..2f9b0a1920e 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -294,9 +294,8 @@ extern void i386_pe_unique_section PARAMS ((TREE, int)); 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 PARAMS ((TREE, int)); 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 *)); diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index a7d76e7dce6..c40ce6967ce 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -27,7 +27,7 @@ extern int ix86_can_use_return_insn_p PARAMS ((void)); 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)); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 79c81be5de4..acf037e60e2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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. */ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 536e61bed21..03d4f60d43c 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -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. */ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 8f0a22c0494..df66a58447b 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -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. */ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h index ec398de8d66..582a22bacd4 100644 --- a/gcc/config/i386/linux64.h +++ b/gcc/config/i386/linux64.h @@ -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. diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 04f5cedb036..97cea6c58f5 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -763,12 +763,11 @@ i386_pe_record_exported_symbol (name, is_data) 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" : ""); } diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index 8e933b85fd4..60674ba49b4 100644 --- a/gcc/config/ia64/hpux.h +++ b/gcc/config/ia64/hpux.h @@ -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\"" diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 16d32fdc39d..e0760f3e17b 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -153,4 +153,3 @@ extern enum direction ia64_hpux_function_arg_padding PARAMS ((enum machine_mode, #endif /* ARGS_SIZE_RTX */ extern void ia64_hpux_handle_builtin_pragma PARAMS ((struct cpp_reader *)); -extern void ia64_hpux_asm_file_end PARAMS ((FILE *)); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 84f45af4f7b..ab49ff63328 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -257,6 +257,9 @@ static unsigned int ia64_rwreloc_section_type_flags 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; } diff --git a/gcc/config/ip2k/ip2k-protos.h b/gcc/config/ip2k/ip2k-protos.h index ba9a8ee7a50..0bc901c8462 100644 --- a/gcc/config/ip2k/ip2k-protos.h +++ b/gcc/config/ip2k/ip2k-protos.h @@ -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)); diff --git a/gcc/config/ip2k/ip2k.c b/gcc/config/ip2k/ip2k.c index c8c17ccc3d0..3e165054c95 100644 --- a/gcc/config/ip2k/ip2k.c +++ b/gcc/config/ip2k/ip2k.c @@ -111,12 +111,6 @@ const struct attribute_spec ip2k_attribute_table[]; 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 @@ -3242,32 +3234,6 @@ ip2k_handle_fndecl_attribute (node, name, args, flags, no_add_attrs) 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. */ /* Compute a (partial) cost for rtx X. Return true if the complete diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h index 82015d300ae..073eed76196 100644 --- a/gcc/config/m68k/linux.h +++ b/gcc/config/m68k/linux.h @@ -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 diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index f4d303ccb49..9ba7d21d2c1 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -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) diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index d74cfbc5746..a08cf008dd0 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -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)); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 0b216105e0a..af2bbf3acd8 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -272,6 +272,7 @@ static void iris6_asm_named_section PARAMS ((const char *, 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_interface PARAMS ((void)); 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_table[] = { #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 */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 6f550058981..abc3e4fd57e 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -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 diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index cd5bdb17cce..24ba4813209 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -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)); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 211033518a2..bf2a4a22f21 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -135,6 +135,7 @@ static void mmix_target_asm_function_epilogue 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 (); diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 179a5855a62..16c434f0fcb 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -922,9 +922,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #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 diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h index b7e46eb6da2..cff08c2ba1d 100644 --- a/gcc/config/pa/pa-protos.h +++ b/gcc/config/pa/pa-protos.h @@ -133,7 +133,6 @@ extern int zdepi_cint_p PARAMS ((unsigned HOST_WIDE_INT)); 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 *)); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 547c21174dc..3c775954d1f 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -136,6 +136,7 @@ static void copy_fp_args PARAMS ((rtx)) ATTRIBUTE_UNUSED; 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); } diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index 8a188ffc538..2d6c22e9c5e 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -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. */ diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index 7234d136171..3cfe0204734 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -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. */ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 8d136fb4bfd..a5c62e2f904 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -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. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5d0c7fcc3e2..68d0e964ace 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -258,6 +258,7 @@ static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *)); 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)); @@ -14140,6 +14141,20 @@ rs6000_xcoff_section_type_flags (decl, name, reloc) 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 */ #if TARGET_MACHO diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 892017692af..affe073dfa5 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -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 diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h index e4b34537a01..83c8247e2f3 100644 --- a/gcc/config/s390/linux.h +++ b/gcc/config/s390/linux.h @@ -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. */ diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index c78f1562e9a..f6616a77dd3 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -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. */ diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index 0bb1e646b1d..d4835dd34e3 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -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. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 6686a509c4c..de07785d61b 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6186,22 +6186,23 @@ 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 -On systems that use SDB, it is necessary to output certain commands; -see @file{attasm.h}. - -@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. +@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 -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 diff --git a/gcc/output.h b/gcc/output.h index b78dd63f07f..2bfc64d3a6b 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -519,6 +519,7 @@ extern bool default_binds_local_p PARAMS ((tree)); 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. */ diff --git a/gcc/system.h b/gcc/system.h index 904f13aad5a..f5b52204ed8 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -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 diff --git a/gcc/target-def.h b/gcc/target-def.h index 65d25c3e3a9..02374d08201 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -150,6 +150,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #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, Boston, MA 02111-1307, USA. 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. */ diff --git a/gcc/target.h b/gcc/target.h index cc2640b19b8..ad07f86d958 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -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. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 83db268232f..ea9388ca455 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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 diff --git a/gcc/varasm.c b/gcc/varasm.c index fec16d53196..b13e09cf6f4 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5364,4 +5364,18 @@ default_internal_label (stream, prefix, labelno) 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" |