From: Alan Modra Date: Tue, 5 Jul 2022 03:56:38 +0000 (+0930) Subject: gas: rename md_end to md_finish X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed2917de68fe1ae3f279cef3b48c6464c75e9d72;p=binutils-gdb.git gas: rename md_end to md_finish Currently md_end is typically used for some final actions rather than freeing memory like other *_end functions. Rename it to md_finish, and rename target implementation. The renaming of target functions makes it possible to find them all with "grep md_finish", eg. md_mips_end is renamed to mips_md_finish, not md_mips_finish. This patch leaves a number of md_end functions unchanged, those that either do nothing or deallocate memory, and calls them late. The idea here is that target maintainers implement md_end functions to tidy memory, if anyone cares. Freeing persistent memory in gas is not at all important, except that it can hide more important memory leaks, those that happen once per some frequent gas operation, amongst these unimportant memory leaks. * as.c (main): Rename md_end to md_finish. * config/tc-alpha.c, * config/tc-alpha.h, * config/tc-arc.c, * config/tc-arc.h, * config/tc-arm.c, * config/tc-arm.h, * config/tc-csky.c, * config/tc-csky.h, * config/tc-ia64.c, * config/tc-ia64.h, * config/tc-mcore.c, * config/tc-mcore.h, * config/tc-mips.c, * config/tc-mips.h, * config/tc-mmix.c, * config/tc-mmix.h, * config/tc-msp430.c, * config/tc-msp430.h, * config/tc-nds32.c, * config/tc-nds32.h, * config/tc-ppc.c, * config/tc-ppc.h, * config/tc-pru.c, * config/tc-pru.h, * config/tc-riscv.c, * config/tc-riscv.h, * config/tc-s390.c, * config/tc-s390.h, * config/tc-sparc.c, * config/tc-sparc.h, * config/tc-tic4x.c, * config/tc-tic4x.h, * config/tc-tic6x.c, * config/tc-tic6x.h, * config/tc-v850.c, * config/tc-v850.h, * config/tc-xtensa.c, * config/tc-xtensa.h, * config/tc-z80.c, * config/tc-z80.h: Similarly. * output-file.c (output_file_close): Call md_end. --- diff --git a/gas/as.c b/gas/as.c index 2b8886e8b54..6268779cf90 100644 --- a/gas/as.c +++ b/gas/as.c @@ -1398,8 +1398,8 @@ main (int argc, char ** argv) cond_finish_check (-1); -#ifdef md_end - md_end (); +#ifdef md_finish + md_finish (); #endif #if defined OBJ_ELF || defined OBJ_MAYBE_ELF diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index a1b276193c0..ecc6a2f4b18 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -4030,7 +4030,7 @@ s_alpha_coff_wrapper (int which) unless the compiler has done it for us. */ void -alpha_elf_md_end (void) +alpha_elf_md_finish (void) { struct alpha_elf_frame_data *p; diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h index 6a0755c586c..a916a50bddd 100644 --- a/gas/config/tc-alpha.h +++ b/gas/config/tc-alpha.h @@ -149,8 +149,8 @@ extern void alpha_before_fix (void); #endif #ifdef OBJ_ELF -#define md_end alpha_elf_md_end -extern void alpha_elf_md_end (void); +#define md_finish alpha_elf_md_finish +extern void alpha_elf_md_finish (void); #endif /* New fields for supporting explicit relocations (such as !literal to mark diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 40b051750dc..6c5b1d68078 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -5055,7 +5055,7 @@ arc_set_public_attributes (void) /* Add the default contents for the .ARC.attributes section. */ void -arc_md_end (void) +arc_md_finish (void) { arc_set_public_attributes (); diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h index bbad54c42fb..29b4582ae22 100644 --- a/gas/config/tc-arc.h +++ b/gas/config/tc-arc.h @@ -190,7 +190,7 @@ extern const char *arc_target_format; #define obj_adjust_symtab() arc_adjust_symtab () /* Object attribute hooks. */ -#define md_end arc_md_end +#define md_finish arc_md_finish #define CONVERT_SYMBOLIC_ATTRIBUTE(name) arc_convert_symbolic_attribute (name) #ifndef TC_COPY_SYMBOL_ATTRIBUTES #define TC_COPY_SYMBOL_ATTRIBUTES(DEST, SRC) \ @@ -199,7 +199,7 @@ extern const char *arc_target_format; extern void arc_copy_symbol_attributes (symbolS *, symbolS *); extern int arc_convert_symbolic_attribute (const char *); -extern void arc_md_end (void); +extern void arc_md_finish (void); extern void arc_adjust_symtab (void); extern int arc_pcrel_adjust (fragS *); extern bool arc_parse_name (const char *, struct expressionS *); diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 68fd6896607..e28085310c8 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -33317,7 +33317,7 @@ arm_md_post_relax (void) /* Add the default contents for the .ARM.attributes section. */ void -arm_md_end (void) +arm_md_finish (void) { if (EF_ARM_EABI_VERSION (meabi_flags) < EF_ARM_EABI_VER4) return; diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index d2176e03c98..d28c83054ac 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -98,8 +98,8 @@ extern bool tc_start_label_without_colon (void); #define tc_frob_fake_label(S) arm_frob_label (S) #ifdef OBJ_ELF -#define md_end arm_md_end -extern void arm_md_end (void); +#define md_finish arm_md_finish +extern void arm_md_finish (void); bool arm_is_eabi (void); #define md_post_relax_hook arm_md_post_relax () diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index 5b824d89af0..ad99ebf4bc9 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -5216,7 +5216,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, /* MD interface: Symbol and relocation handling. */ -void md_csky_end (void) +void csky_md_finish (void) { dump_literals (0); } diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h index 567e546e4ce..2ea6abe3271 100644 --- a/gas/config/tc-csky.h +++ b/gas/config/tc-csky.h @@ -38,7 +38,7 @@ #define TC_GENERIC_RELAX_TABLE csky_relax_table -#define md_end md_csky_end +#define md_finish csky_md_finish #define md_relax_frag csky_relax_frag #define DOUBLESLASH_LINE_COMMENTS #define LOCAL_LABELS_FB 1 @@ -90,7 +90,7 @@ struct tls_addend #include "write.h" extern const relax_typeS csky_relax_table []; -extern void md_csky_end (void); +extern void csky_md_finish (void); extern void csky_cons_fix_new (fragS *, unsigned int off, unsigned int len, diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index a4555046492..771071b23cf 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -7566,7 +7566,7 @@ ia64_target_format (void) } void -ia64_end_of_source (void) +ia64_md_finish (void) { /* terminate insn group upon reaching end of file: */ insn_group_break (1, 0, 0); diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index 907047cd745..ecb6de26e91 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -92,7 +92,7 @@ struct ia64_fix enum ia64_opnd opnd; }; -extern void ia64_end_of_source (void); +extern void ia64_md_finish (void); extern void ia64_start_line (void); extern int ia64_unrecognized_line (int); extern void ia64_frob_label (struct symbol *); @@ -122,7 +122,7 @@ extern void ia64_check_label (symbolS *); extern int ia64_estimate_size_before_relax (fragS *, asection *); extern void ia64_convert_frag (fragS *); -#define md_end() ia64_end_of_source () +#define md_finish() ia64_md_finish () #define md_start_line_hook() ia64_start_line () #define tc_unrecognized_line(ch) ia64_unrecognized_line (ch) #define tc_frob_label(s) ia64_frob_label (s) diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c index bc3304158fa..965e8512a90 100644 --- a/gas/config/tc-mcore.c +++ b/gas/config/tc-mcore.c @@ -1615,7 +1615,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED) } void -md_mcore_end (void) +mcore_md_finish (void) { dump_literals (0); subseg_set (text_section, 0); diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h index 8f9205ab85b..6bf72c33204 100644 --- a/gas/config/tc-mcore.h +++ b/gas/config/tc-mcore.h @@ -39,7 +39,7 @@ extern const struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table -#define md_end md_mcore_end +#define md_finish mcore_md_finish /* Want the section information too... */ #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) @@ -86,7 +86,7 @@ struct mcore_tc_sy #include "write.h" /* For definition of fixS */ -extern void md_mcore_end (void); +extern void mcore_md_finish (void); extern arelent *tc_gen_reloc (asection *, fixS *); extern int mcore_force_relocation (fixS *); extern bool mcore_fix_adjustable (fixS *); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 406a04aeae6..da04414bdf8 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -20573,7 +20573,7 @@ mips_convert_symbolic_attribute (const char *name) } void -md_mips_end (void) +mips_md_finish (void) { int fpabi = Val_GNU_MIPS_ABI_FP_ANY; diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index 393e7f4d8f9..c79b9e3b9db 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -163,8 +163,8 @@ extern void mips_elf_final_processing (void); #endif -extern void md_mips_end (void); -#define md_end() md_mips_end() +extern void mips_md_finish (void); +#define md_finish() mips_md_finish() extern void mips_pop_insert (void); #define md_pop_insert() mips_pop_insert() diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index d32e235aa86..4c3d7e80066 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -3368,7 +3368,7 @@ mmix_md_relax_frag (segT seg, fragS *fragP, long stretch) { switch (fragP->fr_subtype) { - /* Growth for this type has been handled by mmix_md_end and + /* Growth for this type has been handled by mmix_md_finish and correctly estimated, so there's nothing more to do here. */ case STATE_GREG_DEF: return 0; @@ -3490,7 +3490,7 @@ mmix_md_relax_frag (segT seg, fragS *fragP, long stretch) /* Various things we punt until all input is seen. */ void -mmix_md_end (void) +mmix_md_finish (void) { fragS *fragP; symbolS *mainsym; diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h index 10fc4963506..bdf680f3c52 100644 --- a/gas/config/tc-mmix.h +++ b/gas/config/tc-mmix.h @@ -48,8 +48,8 @@ extern void mmix_handle_mmixal (void); extern void mmix_md_begin (void); #define md_begin mmix_md_begin -extern void mmix_md_end (void); -#define md_end mmix_md_end +extern void mmix_md_finish (void); +#define md_finish mmix_md_finish extern int mmix_current_location \ (void (*fn) (expressionS *), expressionS *); diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 43cc1332d9f..1835a244f8b 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -1613,7 +1613,7 @@ msp430_refsym (int arg ATTRIBUTE_UNUSED) This is only used for validating the attributes in the assembly file against the options gas has been invoked with. If the attributes and options are compatible then we add the attributes to the assembly file in - msp430_md_end. */ + msp430_md_finish. */ static void msp430_object_attribute (int attr_type) { @@ -5107,7 +5107,7 @@ msp430_insert_uleb128_fixes (bfd *abfd ATTRIBUTE_UNUSED, /* Called after all assembly has been done. */ void -msp430_md_end (void) +msp430_md_finish (void) { if (check_for_nop) { diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h index f8c583e8d53..8d8c40f195b 100644 --- a/gas/config/tc-msp430.h +++ b/gas/config/tc-msp430.h @@ -135,8 +135,8 @@ extern bool msp430_fix_adjustable (struct fix *); is A5A5h... */ #define NUMBERS_WITH_SUFFIX 1 -#define md_end msp430_md_end -extern void msp430_md_end (void); +#define md_finish msp430_md_finish +extern void msp430_md_finish (void); /* Do not allow call frame debug info optimization as otherwise we could generate the DWARF directives without the relocs necessary to patch diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index e236169ba3c..3ad227bf31c 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -7519,7 +7519,7 @@ nds32_elf_insert_final_frag (void) } void -md_end (void) +md_finish (void) { nds32_elf_insert_final_frag (); nds32_elf_analysis_relax_hint (); diff --git a/gas/config/tc-nds32.h b/gas/config/tc-nds32.h index 35a6888f89c..3a8b8335eb1 100644 --- a/gas/config/tc-nds32.h +++ b/gas/config/tc-nds32.h @@ -133,7 +133,7 @@ extern void nds32_macro_info (void *); extern void nds32_start_line_hook (void); extern void nds32_elf_section_change_hook (void); extern void md_begin (void); -extern void md_end (void); +extern void md_finish (void); extern int nds32_start_label (int, int); extern void nds32_cleanup (void); extern void nds32_flush_pending_output (void); @@ -150,7 +150,7 @@ extern void nds32_do_align (int); (NEXT_CHAR == ':' && nds32_start_label (0, 0)) #define tc_check_label(label) nds32_check_label (label) #define tc_frob_label(label) nds32_frob_label (label) -#define md_end md_end +#define md_finish md_finish #define md_start_line_hook() nds32_start_line_hook () #define md_cons_align(n) nds32_cons_align (n) /* COLE: TODO: Review md_do_align. */ diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 5f2c41621b4..0c3e670d11b 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2534,7 +2534,7 @@ ppc_elf_gnu_attribute (int ignored ATTRIBUTE_UNUSED) /* Set ABI version in output file. */ void -ppc_elf_end (void) +ppc_elf_md_finish (void) { if (ppc_obj64 && ppc_abiversion != 0) { @@ -5666,7 +5666,7 @@ ppc_vbyte (int dummy ATTRIBUTE_UNUSED) } void -ppc_xcoff_end (void) +ppc_xcoff_md_finish (void) { int i; diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index eb046111eef..e335aa611fe 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -187,8 +187,8 @@ do { \ symbol_get_tc (dest)->within = symbol_get_tc (src)->within; \ } while (0) -extern void ppc_xcoff_end (void); -#define md_end ppc_xcoff_end +extern void ppc_xcoff_md_finish (void); +#define md_finish ppc_xcoff_md_finish #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ ppc_xcoff_parse_cons (EXP, NBYTES) @@ -251,8 +251,8 @@ extern void ppc_frob_file_before_adjust (void); #define tc_adjust_symtab() ppc_elf_adjust_symtab () extern void ppc_elf_adjust_symtab (void); -extern void ppc_elf_end (void); -#define md_end ppc_elf_end +extern void ppc_elf_md_finish (void); +#define md_finish ppc_elf_md_finish #endif /* OBJ_ELF */ diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c index 61524117255..fa2b52e6568 100644 --- a/gas/config/tc-pru.c +++ b/gas/config/tc-pru.c @@ -1787,7 +1787,7 @@ md_pcrel_from (fixS *fixP ATTRIBUTE_UNUSED) /* Called just before the assembler exits. */ void -md_end (void) +pru_md_end (void) { htab_delete (pru_opcode_hash); htab_delete (pru_reg_hash); diff --git a/gas/config/tc-pru.h b/gas/config/tc-pru.h index 186f0b8ce24..5d97f0da7d0 100644 --- a/gas/config/tc-pru.h +++ b/gas/config/tc-pru.h @@ -47,7 +47,8 @@ extern const char *pru_target_format (void); /* Function prototypes exported to rest of GAS. */ extern void md_assemble (char *op_str); -extern void md_end (void); +extern void pru_md_end (void); +#define md_end pru_md_end extern void md_begin (void); #define tc_fix_adjustable(fixp) pru_fix_adjustable (fixp) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index a0e8456a0d1..7807dd00cf2 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -4462,7 +4462,7 @@ riscv_set_public_attributes (void) /* Called after all assembly has been done. */ void -riscv_md_end (void) +riscv_md_finish (void) { riscv_set_public_attributes (); } diff --git a/gas/config/tc-riscv.h b/gas/config/tc-riscv.h index acf8b003860..802e7afe670 100644 --- a/gas/config/tc-riscv.h +++ b/gas/config/tc-riscv.h @@ -123,10 +123,10 @@ extern void riscv_elf_final_processing (void); /* Adjust debug_line after relaxation. */ #define DWARF2_USE_FIXED_ADVANCE_PC 1 -#define md_end riscv_md_end +#define md_finish riscv_md_finish #define CONVERT_SYMBOLIC_ATTRIBUTE riscv_convert_symbolic_attribute -extern void riscv_md_end (void); +extern void riscv_md_finish (void); extern int riscv_convert_symbolic_attribute (const char *); /* Set mapping symbol states. */ diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 04a3c059c91..29b1f79f16e 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -584,7 +584,7 @@ md_begin (void) /* Called after all assembly has been done. */ void -s390_md_end (void) +s390_md_finish (void) { if (s390_arch_size == 64) bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_64); diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h index 8039c9f58cf..1a3a94b375d 100644 --- a/gas/config/tc-s390.h +++ b/gas/config/tc-s390.h @@ -78,8 +78,8 @@ extern int target_big_endian; #define md_operand(x) -extern void s390_md_end (void); -#define md_end() s390_md_end () +extern void s390_md_finish (void); +#define md_finish() s390_md_finish () #define TARGET_USE_CFIPOP 1 diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 4e443b1d28d..a0bf22f5eea 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -1081,7 +1081,7 @@ md_begin (void) /* Called after all assembly has been done. */ void -sparc_md_end (void) +sparc_md_finish (void) { unsigned long mach; #ifndef TE_SOLARIS diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h index a70e5004ec7..f09d617747f 100644 --- a/gas/config/tc-sparc.h +++ b/gas/config/tc-sparc.h @@ -125,8 +125,8 @@ extern void sparc_elf_final_processing (void); #define md_operand(x) -extern void sparc_md_end (void); -#define md_end() sparc_md_end () +extern void sparc_md_finish (void); +#define md_finish() sparc_md_finish () #define TC_PARSE_CONS_RETURN_TYPE const char * #define TC_PARSE_CONS_RETURN_NONE NULL diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index 5af250256d9..b1b7bcf6268 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -1371,7 +1371,7 @@ md_begin (void) } void -tic4x_end (void) +tic4x_md_finish (void) { bfd_set_arch_mach (stdoutput, bfd_arch_tic4x, IS_CPU_TIC4X (tic4x_cpu) ? bfd_mach_tic4x : bfd_mach_tic3x); diff --git a/gas/config/tc-tic4x.h b/gas/config/tc-tic4x.h index a4ea9185b77..0ed630a2a46 100644 --- a/gas/config/tc-tic4x.h +++ b/gas/config/tc-tic4x.h @@ -88,6 +88,6 @@ extern void tic4x_start_line (void); extern void tic4x_cleanup (void); #define md_cleanup() tic4x_cleanup() -extern void tic4x_end (void); -#define md_end() tic4x_end() +extern void tic4x_md_finish (void); +#define md_finish() tic4x_md_finish() diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 82813fe0e28..411350af084 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -1037,7 +1037,7 @@ bool tic6x_do_align (int n, char *fill, int len ATTRIBUTE_UNUSED, int max) { /* Given code alignments of 4, 8, 16 or 32 bytes, we try to handle - them in the md_end pass by inserting NOPs in parallel with + them in the md_finish pass by inserting NOPs in parallel with previous instructions. We only do this in sections containing nothing but instructions. Code alignments of 1 or 2 bytes have no effect in such sections (but we record them with @@ -4078,7 +4078,7 @@ md_atof (int type, char *litP, int *sizeP) return ieee_md_atof (type, litP, sizeP, target_big_endian); } -/* Adjust the frags in SECTION (see tic6x_end). */ +/* Adjust the frags in SECTION (see tic6x_md_finish). */ static void tic6x_adjust_section (bfd *abfd ATTRIBUTE_UNUSED, segT section, @@ -4403,7 +4403,7 @@ tic6x_set_attributes (void) relaxing. */ void -tic6x_end (void) +tic6x_md_finish (void) { /* Set object attributes at this point if not explicitly set. */ tic6x_set_attributes (); @@ -4419,7 +4419,7 @@ tic6x_end (void) } /* No machine-dependent frags at this stage; all converted in - tic6x_end. */ + tic6x_md_finish. */ void md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec ATTRIBUTE_UNUSED, @@ -4429,7 +4429,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec ATTRIBUTE_UNUSED, } /* No machine-dependent frags at this stage; all converted in - tic6x_end. */ + tic6x_md_finish. */ int md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED, diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h index d52a8b3c05e..c0d50426ce4 100644 --- a/gas/config/tc-tic6x.h +++ b/gas/config/tc-tic6x.h @@ -170,8 +170,8 @@ extern bool tic6x_do_align (int n, char *fill, int len, int max); tic6x_convert_symbolic_attribute (name) extern int tic6x_convert_symbolic_attribute (const char *); -#define md_end() tic6x_end (); -extern void tic6x_end (void); +#define md_finish() tic6x_md_finish (); +extern void tic6x_md_finish (void); #define md_parse_name(name, exprP, mode, nextcharP) \ tic6x_parse_name (name, exprP, mode, nextcharP) diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 255526346ad..f571e69e4a1 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -3728,7 +3728,7 @@ v850_force_relocation (struct fix *fixP) /* Create a v850 note section. */ void -v850_md_end (void) +v850_md_finish (void) { segT note_sec; segT orig_seg = now_seg; diff --git a/gas/config/tc-v850.h b/gas/config/tc-v850.h index 7480b584731..3397d98c69a 100644 --- a/gas/config/tc-v850.h +++ b/gas/config/tc-v850.h @@ -85,5 +85,5 @@ extern long v850_pcrel_from_section (struct fix *, asection *); #define TC_FIX_TYPE void * #define TC_INIT_FIX_DATA(fixP) (fixP)->tc_fix_data = NULL -#define md_end v850_md_end -extern void v850_md_end (void); +#define md_finish v850_md_finish +extern void v850_md_finish (void); diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 3e3deb5dd36..b7403ac45d4 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -94,7 +94,7 @@ static enum debug_info_type xt_saved_debug_type = DEBUG_NONE; /* Some functions are only valid in the front end. This variable allows us to assert that we haven't crossed over into the back end. */ -static bool past_xtensa_end = false; +static bool past_xtensa_md_finish = false; /* Flags for properties of the last instruction in a segment. */ #define FLAG_IS_A0_WRITER 0x1 @@ -1189,9 +1189,9 @@ const pseudo_typeS md_pseudo_table[] = static bool use_transform (void) { - /* After md_end, you should be checking frag by frag, rather + /* After md_finish, you should be checking frag by frag, rather than state directives. */ - gas_assert (!past_xtensa_end); + gas_assert (!past_xtensa_md_finish); return directive_state[directive_transform]; } @@ -1199,10 +1199,10 @@ use_transform (void) static bool do_align_targets (void) { - /* Do not use this function after md_end; just look at align_targets + /* Do not use this function after md_finish; just look at align_targets instead. There is no target-align directive, so alignment is either enabled for all frags or not done at all. */ - gas_assert (!past_xtensa_end); + gas_assert (!past_xtensa_md_finish); return align_targets && use_transform (); } @@ -4980,7 +4980,7 @@ xtensa_set_frag_assembly_state (fragS *fragP) fragP->tc_frag_data.is_no_density = true; /* This function is called from subsegs_finish, which is called - after xtensa_end, so we can't use "use_transform" or + after xtensa_md_finish, so we can't use "use_transform" or "use_schedule" here. */ if (!directive_state[directive_transform]) fragP->tc_frag_data.is_no_transform = true; @@ -6600,7 +6600,7 @@ find_vinsn_conflicts (vliw_insn *vinsn) int branches = 0; xtensa_isa isa = xtensa_default_isa; - gas_assert (!past_xtensa_end); + gas_assert (!past_xtensa_md_finish); for (i = 0 ; i < vinsn->num_slots; i++) { @@ -7369,7 +7369,7 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn) } -/* xtensa_end and helper functions. */ +/* xtensa_md_finish and helper functions. */ static void xtensa_cleanup_align_frags (void); static void xtensa_fix_target_frags (void); @@ -7384,12 +7384,12 @@ static void xtensa_sanity_check (void); static void xtensa_add_config_info (void); void -xtensa_end (void) +xtensa_md_finish (void) { directive_balance (); xtensa_flush_pending_output (); - past_xtensa_end = true; + past_xtensa_md_finish = true; xtensa_move_literals (); @@ -7927,7 +7927,7 @@ xtensa_maybe_create_literal_pool_frag (bool create, bool only_if_needed) { if (only_if_needed) { - if (past_xtensa_end || !use_transform() || + if (past_xtensa_md_finish || !use_transform() || frag_now->tc_frag_data.is_no_transform) { return; diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h index 1887558ecf1..e67abbc9920 100644 --- a/gas/config/tc-xtensa.h +++ b/gas/config/tc-xtensa.h @@ -329,7 +329,7 @@ extern void xtensa_frag_init (fragS *); extern int xtensa_force_relocation (struct fix *); extern int xtensa_validate_fix_sub (struct fix *); extern void xtensa_frob_label (struct symbol *); -extern void xtensa_end (void); +extern void xtensa_md_finish (void); extern void xtensa_post_relax_hook (void); extern void xtensa_file_arch_init (bfd *); extern void xtensa_flush_pending_output (void); @@ -372,7 +372,7 @@ extern void xtensa_init (int, char **); #define tc_symbol_new_hook(sym) xtensa_symbol_new_hook (sym) #define md_do_align(a,b,c,d,e) xtensa_flush_pending_output () #define md_elf_section_change_hook xtensa_elf_section_change_hook -#define md_end xtensa_end +#define md_finish xtensa_md_finish #define md_flush_pending_output() xtensa_flush_pending_output () #define md_operand(x) #define TEXT_SECTION_NAME xtensa_section_rename (".text") diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 714e704e24a..029513a2614 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -538,7 +538,7 @@ md_begin (void) } void -z80_md_end (void) +z80_md_finish (void) { int mach_type; diff --git a/gas/config/tc-z80.h b/gas/config/tc-z80.h index a3e68ad8b13..cb399f9c27b 100644 --- a/gas/config/tc-z80.h +++ b/gas/config/tc-z80.h @@ -55,11 +55,11 @@ (as_fatal (_("estimate_size_before_relax called")), 1) /* Define some functions to be called by generic code. */ -#define md_end z80_md_end +#define md_finish z80_md_finish #define md_start_line_hook() { if (z80_start_line_hook ()) continue; } #define TC_CONS_FIX_NEW(f,w,s,e,r) z80_cons_fix_new ((f), (w), (s), (e)) -extern void z80_md_end (void); +extern void z80_md_finish (void); extern int z80_start_line_hook (void); extern void z80_cons_fix_new (fragS *, int, int, expressionS *); diff --git a/gas/output-file.c b/gas/output-file.c index 3c4074b263d..e2d00370317 100644 --- a/gas/output-file.c +++ b/gas/output-file.c @@ -105,6 +105,9 @@ output_file_close (void) if (!keep_it && filename) unlink_if_ordinary (filename); +#ifdef md_end + md_end (); +#endif macro_end (); read_end (); symbol_end ();