public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld: Ad emultempl/emulation.em
@ 2022-02-04 21:05 H.J. Lu
  2022-02-06 14:25 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2022-02-04 21:05 UTC (permalink / raw)
  To: binutils

Add emultempl/emulation.em to define ld_${EMULATION_NAME}_emulation so
that new emulation hooks can be added easily.

	* emultempl/aix.em (LDEMUL_AFTER_OPEN): New.
	(LDEMUL_SET_OUTPUT_ARCH): Likewise.
	(LDEMUL_CHOOSE_TARGET): Likewise.
	(LDEMUL_BEFORE_ALLOCATION): Likewise.
	(LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Likewise.
	(LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
	(LDEMUL_PARSE_ARGS): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_UNRECOGNIZED_FILE): Likewise.
	(LDEMUL_PRINT_SYMBOL): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/beos.em (gld_${EMULATION_NAME}_before_parse):
	Renamed to ...
	(gld${EMULATION_NAME}_before_parse): This.
	(gld_${EMULATION_NAME}_set_symbols): Renamed to ...
	(gld${EMULATION_NAME}_set_symbols): This.
	(gld_${EMULATION_NAME}_after_open): Renamed to ...
	(gld${EMULATION_NAME}_after_open): This.
	(gld_${EMULATION_NAME}_before_allocation): Renamed to ...
	(gld${EMULATION_NAME}_before_allocation): This.
	(gld_${EMULATION_NAME}_get_script): Renamed to ...
	(gld${EMULATION_NAME}_get_script): This.
	(LDEMUL_AFTER_OPEN): New.
	(LDEMUL_BEFORE_ALLOCATION): Likewise.
	(LDEMUL_PLACE_ORPHAN): Likewise.
	(LDEMUL_SET_SYMBOLS): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/elf.em (LDEMUL_AFTER_PARSE): New.
	(LDEMUL_AFTER_OPEN): Likewise.
	(LDEMUL_BEFORE_PLACE_ORPHANS): Likewise.
	(LDEMUL_AFTER_ALLOCATION): Likewise.
	(LDEMUL_SET_OUTPUT_ARCH): Likewise.
	(LDEMUL_BEFORE_ALLOCATION): Likewise.
	(LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
	(LDEMUL_PLACE_ORPHAN): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_LIST_OPTIONS): Likewise.
	(LDEMUL_UNRECOGNIZED_FILE): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/emulation.em: New file.
	* emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/msp430.em (LDEMUL_AFTER_OPEN): New.
	(LDEMUL_AFTER_ALLOCATION): Likewise.
	(LDEMUL_PLACE_ORPHAN): Likewise.
	(LDEMUL_FINISH): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_LIST_OPTIONS): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/pe.em (gld_${EMULATION_NAME}_before_parse): Renamed
	to ...
	(gld${EMULATION_NAME}_before_parse): This.
	(gld_${EMULATION_NAME}_list_options): Renamed to ...
	(gld${EMULATION_NAME}_list_options): This.
	(gld_${EMULATION_NAME}_set_symbols): Renamed to ...
	(gld${EMULATION_NAME}_set_symbols): This.
	(gld_${EMULATION_NAME}_after_parse): Renamed to ...
	(gld${EMULATION_NAME}_after_parse): This.
	(gld_${EMULATION_NAME}_after_open): Renamed to ...
	(gld${EMULATION_NAME}_after_open): This.
	(gld_${EMULATION_NAME}_before_allocation): Renamed to ...
	(gld${EMULATION_NAME}_before_allocation): This.
	(gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
	(gld${EMULATION_NAME}_unrecognized_file): This.
	(gld_${EMULATION_NAME}_recognized_file): Renamed to ...
	(gld${EMULATION_NAME}_recognized_file): This.
	(gld_${EMULATION_NAME}_finish): Renamed to ...
	(gld${EMULATION_NAME}_finish): This.
	(gld_${EMULATION_NAME}_place_orphan): Renamed to ...
	(gld${EMULATION_NAME}_place_orphan): This.
	(gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
	(gld${EMULATION_NAME}_open_dynamic_archive): This.
	(gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
	(gld${EMULATION_NAME}_find_potential_libraries): This.
	(gld_${EMULATION_NAME}_get_script): Renamed to ...
	(gld${EMULATION_NAME}_get_script): This.
	(LDEMUL_AFTER_PARSE): New.
	(LDEMUL_AFTER_OPEN): Likewise.
	(LDEMUL_BEFORE_ALLOCATION): Likewise.
	(LDEMUL_FINISH=): Likewise.
	(LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
	(LDEMUL_PLACE_ORPHAN): Likewise.
	(LDEMUL_SET_SYMBOLS): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_UNRECOGNIZED_FILE): Likewise.
	(LDEMUL_LIST_OPTIONS): Likewise.
	(LDEMUL_RECOGNIZED_FILE): Likewise.
	(LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/pep.em (gld_${EMULATION_NAME}_before_parse): Renamed
	to ...
	(gld${EMULATION_NAME}_before_parse): This.
	(gld_${EMULATION_NAME}_list_options): Renamed to ...
	(gld${EMULATION_NAME}_list_options): This.
	(gld_${EMULATION_NAME}_set_symbols): Renamed to ...
	(gld${EMULATION_NAME}_set_symbols): This.
	(gld_${EMULATION_NAME}_after_parse): Renamed to ...
	(gld${EMULATION_NAME}_after_parse): This.
	(gld_${EMULATION_NAME}_after_open): Renamed to ...
	(gld${EMULATION_NAME}_after_open): This.
	(gld_${EMULATION_NAME}_before_allocation): Renamed to ...
	(gld${EMULATION_NAME}_before_allocation): This.
	(gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
	(gld${EMULATION_NAME}_unrecognized_file): This.
	(gld_${EMULATION_NAME}_recognized_file): Renamed to ...
	(gld${EMULATION_NAME}_recognized_file): This.
	(gld_${EMULATION_NAME}_finish): Renamed to ...
	(gld${EMULATION_NAME}_finish): This.
	(gld_${EMULATION_NAME}_place_orphan): Renamed to ...
	(gld${EMULATION_NAME}_place_orphan): This.
	(gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
	(gld${EMULATION_NAME}_open_dynamic_archive): This.
	(gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
	(gld${EMULATION_NAME}_find_potential_libraries): This.
	(gld_${EMULATION_NAME}_get_script): Renamed to ...
	(gld${EMULATION_NAME}_get_script): This.
	(LDEMUL_AFTER_PARSE): New.
	(LDEMUL_AFTER_OPEN): Likewise.
	(LDEMUL_BEFORE_ALLOCATION): Likewise.
	(LDEMUL_FINISH=): Likewise.
	(LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
	(LDEMUL_PLACE_ORPHAN): Likewise.
	(LDEMUL_SET_SYMBOLS): Likewise.
	(LDEMUL_ADD_OPTIONS): Likewise.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_UNRECOGNIZED_FILE): Likewise.
	(LDEMUL_LIST_OPTIONS): Likewise.
	(LDEMUL_RECOGNIZED_FILE): Likewise.
	(LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/ticoff.em (gld_${EMULATION_NAME}_list_options):
	Renamed to ...
	(gld${EMULATION_NAME}_list_options): This.
	(gld_${EMULATION_NAME}_before_parse): Renamed to ...
	(gld_${EMULATION_NAME}_get_script): Renamed to ...
	(gld${EMULATION_NAME}_get_script): This.
	(LDEMUL_ADD_OPTIONS): New.
	(LDEMUL_HANDLE_OPTION): Likewise.
	(LDEMUL_LIST_OPTIONS): Likewise.
	(ld_${EMULATION_NAME}_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
	* emultempl/vanilla.em (LDEMUL_BEFORE_PARSE): New.
	(LDEMUL_SET_OUTPUT_ARCH): Likewise.
	(LDEMUL_GET_SCRIPT): Likewise.
	(EMULATION_NAME): Likewise.
	(OUTPUT_FORMAT): Likewise.
	(ld_vanilla_emulation): Removed.
	Source ${srcdir}/emultempl/emulation.em.
---
 ld/emultempl/aix.em       | 49 +++++++----------------
 ld/emultempl/beos.em      | 55 ++++++-------------------
 ld/emultempl/elf.em       | 52 +++++++-----------------
 ld/emultempl/emulation.em | 40 +++++++++++++++++++
 ld/emultempl/generic.em   | 39 +-----------------
 ld/emultempl/msp430.em    | 46 +++++----------------
 ld/emultempl/pe.em        | 84 ++++++++++++++-------------------------
 ld/emultempl/pep.em       | 80 +++++++++++++------------------------
 ld/emultempl/ticoff.em    | 48 ++++------------------
 ld/emultempl/vanilla.em   | 44 ++++----------------
 10 files changed, 165 insertions(+), 372 deletions(-)
 create mode 100644 ld/emultempl/emulation.em

diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index b82305dc09e..6807aaee1c8 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -1601,39 +1601,18 @@ gld${EMULATION_NAME}_print_symbol (struct bfd_link_hash_entry *hash_entry,
 
   return true;
 }
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
-  gld${EMULATION_NAME}_before_parse,
-  syslib_default,
-  hll_default,
-  after_parse_default,
-  gld${EMULATION_NAME}_after_open,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  gld${EMULATION_NAME}_set_output_arch,
-  gld${EMULATION_NAME}_choose_target,
-  gld${EMULATION_NAME}_before_allocation,
-  gld${EMULATION_NAME}_get_script,
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  finish_default,
-  gld${EMULATION_NAME}_create_output_section_statements,
-  gld${EMULATION_NAME}_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
-  gld${EMULATION_NAME}_parse_args,
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  gld${EMULATION_NAME}_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  gld${EMULATION_NAME}_print_symbol
-};
 EOF
+
+LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
+LDEMUL_SET_OUTPUT_ARCH=gld${EMULATION_NAME}_set_output_arch
+LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
+LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=gld${EMULATION_NAME}_create_output_section_statements
+LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
+LDEMUL_PARSE_ARGS=gld${EMULATION_NAME}_parse_args
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
+LDEMUL_PRINT_SYMBOL=gld${EMULATION_NAME}_print_symbol
+
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index bebad8af2f7..93e85a792a3 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -62,7 +62,7 @@ static int dll;
 extern const char *output_filename;
 
 static void
-gld_${EMULATION_NAME}_before_parse (void)
+gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
   output_filename = "a.exe";
@@ -322,7 +322,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
    read.  */
 
 static void
-gld_${EMULATION_NAME}_set_symbols (void)
+gld${EMULATION_NAME}_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults. */
@@ -372,7 +372,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
 }
 
 static void
-gld_${EMULATION_NAME}_after_open (void)
+gld${EMULATION_NAME}_after_open (void)
 {
   after_open_default ();
 
@@ -606,7 +606,7 @@ sort_sections (lang_statement_union_type *s)
 }
 
 static void
-gld_${EMULATION_NAME}_before_allocation (void)
+gld${EMULATION_NAME}_before_allocation (void)
 {
 #ifdef TARGET_IS_armpe
   /* FIXME: we should be able to set the size of the interworking stub
@@ -710,7 +710,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
 }
 \f
 static char *
-gld_${EMULATION_NAME}_get_script (int *isfile)
+gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 
 if test x"$COMPILE_IN" = xyes
@@ -759,42 +759,11 @@ fragment <<EOF
 EOF
 fi
 
-fragment <<EOF
-
+LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
+LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
+LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
+LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
 
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  gld_${EMULATION_NAME}_before_parse,
-  syslib_default,
-  hll_default,
-  after_parse_default,
-  gld_${EMULATION_NAME}_after_open,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  set_output_arch_default,
-  ldemul_default_target,
-  gld_${EMULATION_NAME}_before_allocation,
-  gld_${EMULATION_NAME}_get_script,
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  gld${EMULATION_NAME}_place_orphan,
-  gld_${EMULATION_NAME}_set_symbols,
-  NULL, /* parse_args */
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  NULL,	/* unrecognized file */
-  NULL,	/* list options */
-  NULL,	/* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,	/* extra_map_file_text */
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
index 7325872e1d9..55dd20f0b02 100644
--- a/ld/emultempl/elf.em
+++ b/ld/emultempl/elf.em
@@ -909,41 +909,17 @@ EOF
 fi
 fi
 
-fragment <<EOF
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
-  ${LDEMUL_SYSLIB-syslib_default},
-  ${LDEMUL_HLL-hll_default},
-  ${LDEMUL_AFTER_PARSE-ldelf_after_parse},
-  ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open},
-  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
-  ${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans},
-  ${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation},
-  ${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch},
-  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
-  ${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation},
-  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  ${LDEMUL_FINISH-finish_default},
-  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
-  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive},
-  ${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan},
-  ${LDEMUL_SET_SYMBOLS-NULL},
-  ${LDEMUL_PARSE_ARGS-NULL},
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
-  ${LDEMUL_LIST_OPTIONS-${gld_list_options}},
-  ${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols},
-  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
-  ${LDEMUL_NEW_VERS_PATTERN-NULL},
-  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+LDEMUL_AFTER_PARSE=${LDEMUL_AFTER_PARSE-ldelf_after_parse}
+LDEMUL_AFTER_OPEN=${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open}
+LDEMUL_BEFORE_PLACE_ORPHANS=${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans}
+LDEMUL_AFTER_ALLOCATION=${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}
+LDEMUL_SET_OUTPUT_ARCH=${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch}
+LDEMUL_BEFORE_ALLOCATION=${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}
+LDEMUL_OPEN_DYNAMIC_ARCHIVE=${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}
+LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_LIST_OPTIONS=${LDEMUL_LIST_OPTIONS-${gld_list_options}}
+LDEMUL_RECOGNIZED_FILE=${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols}
+
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/emulation.em b/ld/emultempl/emulation.em
new file mode 100644
index 00000000000..cfa6567ac2b
--- /dev/null
+++ b/ld/emultempl/emulation.em
@@ -0,0 +1,40 @@
+# This shell script emits a C file. -*- C -*-
+# It does some substitutions.
+fragment <<EOF
+
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
+{
+  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
+  ${LDEMUL_SYSLIB-syslib_default},
+  ${LDEMUL_HLL-hll_default},
+  ${LDEMUL_AFTER_PARSE-after_parse_default},
+  ${LDEMUL_AFTER_OPEN-after_open_default},
+  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
+  ${LDEMUL_BEFORE_PLACE_ORPHANS-before_place_orphans_default},
+  ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
+  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
+  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
+  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
+  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
+  "${EMULATION_NAME}",
+  "${OUTPUT_FORMAT}",
+  ${LDEMUL_FINISH-finish_default},
+  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
+  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
+  ${LDEMUL_PLACE_ORPHAN-NULL},
+  ${LDEMUL_SET_SYMBOLS-NULL},
+  ${LDEMUL_PARSE_ARGS-NULL},
+  ${LDEMUL_ADD_OPTIONS-NULL},
+  ${LDEMUL_HANDLE_OPTION-NULL},
+  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
+  ${LDEMUL_LIST_OPTIONS-NULL},
+  ${LDEMUL_RECOGNIZED_FILE-NULL},
+  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
+  ${LDEMUL_NEW_VERS_PATTERN-NULL},
+  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
+  ${LDEMUL_EMIT_CTF_EARLY-NULL},
+  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
+  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
+  ${LDEMUL_PRINT_SYMBOL-NULL}
+};
+EOF
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index e7c990e7260..cecbb1c2728 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -128,41 +128,4 @@ EOF
 fi
 fi
 
-fragment <<EOF
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
-  ${LDEMUL_SYSLIB-syslib_default},
-  ${LDEMUL_HLL-hll_default},
-  ${LDEMUL_AFTER_PARSE-after_parse_default},
-  ${LDEMUL_AFTER_OPEN-after_open_default},
-  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
-  ${LDEMUL_BEFORE_PLACE_ORPHANS-before_place_orphans_default},
-  ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
-  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
-  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
-  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
-  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  ${LDEMUL_FINISH-finish_default},
-  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
-  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
-  ${LDEMUL_PLACE_ORPHAN-NULL},
-  ${LDEMUL_SET_SYMBOLS-NULL},
-  ${LDEMUL_PARSE_ARGS-NULL},
-  ${LDEMUL_ADD_OPTIONS-NULL},
-  ${LDEMUL_HANDLE_OPTION-NULL},
-  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
-  ${LDEMUL_LIST_OPTIONS-NULL},
-  ${LDEMUL_RECOGNIZED_FILE-NULL},
-  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
-  ${LDEMUL_NEW_VERS_PATTERN-NULL},
-  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em
index abfbdcb64a8..f188b46b4aa 100644
--- a/ld/emultempl/msp430.em
+++ b/ld/emultempl/msp430.em
@@ -905,43 +905,17 @@ gld${EMULATION_NAME}_finish (void)
   finish_default ();
   check_array_section_alignment ();
 }
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
-  ${LDEMUL_SYSLIB-syslib_default},
-  ${LDEMUL_HLL-hll_default},
-  ${LDEMUL_AFTER_PARSE-after_parse_default},
-  msp430_elf_after_open,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  msp430_elf_after_allocation,
-  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
-  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
-  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
-  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  gld${EMULATION_NAME}_finish,
-  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
-  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
-  ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
-  ${LDEMUL_SET_SYMBOLS-NULL},
-  ${LDEMUL_PARSE_ARGS-NULL},
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
-  gld${EMULATION_NAME}_list_options,
-  ${LDEMUL_RECOGNIZED_FILE-NULL},
-  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
-  ${LDEMUL_NEW_VERS_PATTERN-NULL},
-  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
 EOF
+
+LDEMUL_AFTER_OPEN=msp430_elf_after_open
+LDEMUL_AFTER_ALLOCATION=msp430_elf_after_allocation
+LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan}
+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
+
+source_em ${srcdir}/emultempl/emulation.em
 # \f
 # Local Variables:
 # mode: c
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 3c6a07e8e86..892bf70b7a6 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -172,7 +172,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_${EMULATION_NAME}_before_parse (void)
+gld${EMULATION_NAME}_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
@@ -454,7 +454,7 @@ static definfo init[] =
 
 
 static void
-gld_${EMULATION_NAME}_list_options (FILE *file)
+gld${EMULATION_NAME}_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -1002,7 +1002,7 @@ compute_dll_image_base (const char *ofile)
    read.  */
 
 static void
-gld_${EMULATION_NAME}_set_symbols (void)
+gld${EMULATION_NAME}_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -1069,7 +1069,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
    have been read.  */
 
 static void
-gld_${EMULATION_NAME}_after_parse (void)
+gld${EMULATION_NAME}_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1382,7 +1382,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_${EMULATION_NAME}_after_open (void)
+gld${EMULATION_NAME}_after_open (void)
 {
   after_open_default ();
 
@@ -1803,7 +1803,7 @@ gld_${EMULATION_NAME}_after_open (void)
 }
 \f
 static void
-gld_${EMULATION_NAME}_before_allocation (void)
+gld${EMULATION_NAME}_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1849,7 +1849,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1930,7 +1930,7 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
 }
 
 static bool
-gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gld${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1952,7 +1952,7 @@ gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUT
 }
 
 static void
-gld_${EMULATION_NAME}_finish (void)
+gld${EMULATION_NAME}_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -2052,9 +2052,9 @@ gld_${EMULATION_NAME}_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_${EMULATION_NAME}_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gld${EMULATION_NAME}_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2251,7 +2251,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
 }
 
 static bool
-gld_${EMULATION_NAME}_open_dynamic_archive
+gld${EMULATION_NAME}_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2357,14 +2357,14 @@ gld_${EMULATION_NAME}_open_dynamic_archive
 }
 
 static int
-gld_${EMULATION_NAME}_find_potential_libraries
+gld${EMULATION_NAME}_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_${EMULATION_NAME}_get_script (int *isfile)
+gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 
 if test x"$COMPILE_IN" = xyes
@@ -2426,42 +2426,18 @@ fragment <<EOF
 EOF
 fi
 
-fragment <<EOF
-
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  gld_${EMULATION_NAME}_before_parse,
-  syslib_default,
-  hll_default,
-  gld_${EMULATION_NAME}_after_parse,
-  gld_${EMULATION_NAME}_after_open,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  set_output_arch_default,
-  ldemul_default_target,
-  gld_${EMULATION_NAME}_before_allocation,
-  gld_${EMULATION_NAME}_get_script,
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  gld_${EMULATION_NAME}_finish,
-  NULL, /* Create output section statements.  */
-  gld_${EMULATION_NAME}_open_dynamic_archive,
-  gld_${EMULATION_NAME}_place_orphan,
-  gld_${EMULATION_NAME}_set_symbols,
-  NULL, /* parse_args */
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  gld_${EMULATION_NAME}_unrecognized_file,
-  gld_${EMULATION_NAME}_list_options,
-  gld_${EMULATION_NAME}_recognized_file,
-  gld_${EMULATION_NAME}_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
+LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
+LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
+LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
+LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
+LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
+LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
+LDEMUL_RECOGNIZED_FILE=gld${EMULATION_NAME}_recognized_file
+LDEMUL_FIND_POTENTIAL_LIBRARIES=gld${EMULATION_NAME}_find_potential_libraries
+
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 848daa16746..e68d1e69f17 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -183,7 +183,7 @@ static int is_underscoring (void)
 
 
 static void
-gld_${EMULATION_NAME}_before_parse (void)
+gld${EMULATION_NAME}_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
@@ -417,7 +417,7 @@ static definfo init[] =
 
 
 static void
-gld_${EMULATION_NAME}_list_options (FILE *file)
+gld${EMULATION_NAME}_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -945,7 +945,7 @@ compute_dll_image_base (const char *ofile)
    read.  */
 
 static void
-gld_${EMULATION_NAME}_set_symbols (void)
+gld${EMULATION_NAME}_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -1012,7 +1012,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
    have been read.  */
 
 static void
-gld_${EMULATION_NAME}_after_parse (void)
+gld${EMULATION_NAME}_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE+.  */
@@ -1366,7 +1366,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_${EMULATION_NAME}_after_open (void)
+gld${EMULATION_NAME}_after_open (void)
 {
   after_open_default ();
 
@@ -1694,7 +1694,7 @@ gld_${EMULATION_NAME}_after_open (void)
 }
 \f
 static void
-gld_${EMULATION_NAME}_before_allocation (void)
+gld${EMULATION_NAME}_before_allocation (void)
 {
   is_underscoring ();
   before_allocation_default ();
@@ -1719,7 +1719,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1800,7 +1800,7 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
 }
 
 static bool
-gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gld${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
   is_underscoring ();
 #ifdef DLL_SUPPORT
@@ -1814,7 +1814,7 @@ gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUT
 }
 
 static void
-gld_${EMULATION_NAME}_finish (void)
+gld${EMULATION_NAME}_finish (void)
 {
   is_underscoring ();
   finish_default ();
@@ -1864,7 +1864,7 @@ gld_${EMULATION_NAME}_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_${EMULATION_NAME}_place_orphan (asection *s,
+gld${EMULATION_NAME}_place_orphan (asection *s,
 				    const char *secname,
 				    int constraint)
 {
@@ -2063,7 +2063,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
 }
 
 static bool
-gld_${EMULATION_NAME}_open_dynamic_archive
+gld${EMULATION_NAME}_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2169,14 +2169,14 @@ gld_${EMULATION_NAME}_open_dynamic_archive
 }
 
 static int
-gld_${EMULATION_NAME}_find_potential_libraries
+gld${EMULATION_NAME}_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_${EMULATION_NAME}_get_script (int *isfile)
+gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 
 if test x"$COMPILE_IN" = xyes
@@ -2238,42 +2238,18 @@ fragment <<EOF
 EOF
 fi
 
-fragment <<EOF
-
-
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  gld_${EMULATION_NAME}_before_parse,
-  syslib_default,
-  hll_default,
-  gld_${EMULATION_NAME}_after_parse,
-  gld_${EMULATION_NAME}_after_open,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  set_output_arch_default,
-  ldemul_default_target,
-  gld_${EMULATION_NAME}_before_allocation,
-  gld_${EMULATION_NAME}_get_script,
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  gld_${EMULATION_NAME}_finish,
-  NULL, /* Create output section statements.  */
-  gld_${EMULATION_NAME}_open_dynamic_archive,
-  gld_${EMULATION_NAME}_place_orphan,
-  gld_${EMULATION_NAME}_set_symbols,
-  NULL, /* parse_args */
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  gld_${EMULATION_NAME}_unrecognized_file,
-  gld_${EMULATION_NAME}_list_options,
-  gld_${EMULATION_NAME}_recognized_file,
-  gld_${EMULATION_NAME}_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text */
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
+LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
+LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
+LDEMUL_FINISH=gld${EMULATION_NAME}_finish
+LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
+LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
+LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
+LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
+LDEMUL_RECOGNIZED_FILE=gld${EMULATION_NAME}_recognized_file
+LDEMUL_FIND_POTENTIAL_LIBRARIES=gld${EMULATION_NAME}_find_potential_libraries
+
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 1ac483b9c7f..a57e73bc5c3 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -64,7 +64,7 @@ gld${EMULATION_NAME}_add_options
 }
 
 static void
-gld_${EMULATION_NAME}_list_options (FILE * file)
+gld${EMULATION_NAME}_list_options (FILE * file)
 {
   fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
 }
@@ -96,7 +96,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
 }
 
 static void
-gld_${EMULATION_NAME}_before_parse(void)
+gld${EMULATION_NAME}_before_parse(void)
 {
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
@@ -104,7 +104,7 @@ gld_${EMULATION_NAME}_before_parse(void)
 }
 
 static char *
-gld_${EMULATION_NAME}_get_script (int *isfile)
+gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 if test x"$COMPILE_IN" = xyes
 then
@@ -154,40 +154,8 @@ EOF
 
 fi
 
-fragment <<EOF
-struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
-{
-  gld_${EMULATION_NAME}_before_parse,
-  syslib_default,
-  hll_default,
-  after_parse_default,
-  after_open_default,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  set_output_arch_default,
-  ldemul_default_target,
-  before_allocation_default,
-  gld_${EMULATION_NAME}_get_script,
-  "${EMULATION_NAME}",
-  "${OUTPUT_FORMAT}",
-  finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL, /* parse_args */
-  gld${EMULATION_NAME}_add_options,
-  gld${EMULATION_NAME}_handle_option,
-  NULL, /* unrecognized_file */
-  gld_${EMULATION_NAME}_list_options,
-  NULL, /* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,  /* extra_map_file_text */
-  ${LDEMUL_EMIT_CTF_EARLY-NULL},
-  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
-  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
-  ${LDEMUL_PRINT_SYMBOL-NULL}
-};
-EOF
+LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
+LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
+LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
+
+source_em ${srcdir}/emultempl/emulation.em
diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
index dc47ca13efb..c9aef37742f 100644
--- a/ld/emultempl/vanilla.em
+++ b/ld/emultempl/vanilla.em
@@ -55,40 +55,12 @@ vanilla_get_script (int *isfile)
   *isfile = 0;
   return "";
 }
-
-struct ld_emulation_xfer_struct ld_vanilla_emulation =
-{
-  vanilla_before_parse,
-  syslib_default,
-  hll_default,
-  after_parse_default,
-  after_open_default,
-  after_check_relocs_default,
-  before_place_orphans_default,
-  after_allocation_default,
-  vanilla_set_output_arch,
-  ldemul_default_target,
-  before_allocation_default,
-  vanilla_get_script,
-  "vanilla",
-  "a.out-sunos-big",
-  finish_default,
-  NULL,	/* create output section statements */
-  NULL,	/* open dynamic archive */
-  NULL,	/* place orphan */
-  NULL,	/* set symbols */
-  NULL,	/* parse args */
-  NULL,	/* add_options */
-  NULL,	/* handle_option */
-  NULL,	/* unrecognized file */
-  NULL,	/* list options */
-  NULL,	/* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,	/* extra_map_file_text */
-  NULL, /* emit_ctf_early */
-  NULL, /* acquire_strings_for_ctf */
-  NULL, /* new_dynsym_for_ctf */
-  NULL  /* print_symbol */
-};
 EOF
+
+LDEMUL_BEFORE_PARSE=vanilla_before_parse
+LDEMUL_SET_OUTPUT_ARCH=vanilla_set_output_arch
+LDEMUL_GET_SCRIPT=vanilla_get_script
+EMULATION_NAME=vanilla
+OUTPUT_FORMAT=a.out-sunos-big
+
+source_em ${srcdir}/emultempl/emulation.em
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ld: Ad emultempl/emulation.em
  2022-02-04 21:05 [PATCH] ld: Ad emultempl/emulation.em H.J. Lu
@ 2022-02-06 14:25 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2022-02-06 14:25 UTC (permalink / raw)
  To: Binutils

[-- Attachment #1: Type: text/plain, Size: 40211 bytes --]

On Fri, Feb 4, 2022 at 1:05 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Add emultempl/emulation.em to define ld_${EMULATION_NAME}_emulation so
> that new emulation hooks can be added easily.
>
>         * emultempl/aix.em (LDEMUL_AFTER_OPEN): New.
>         (LDEMUL_SET_OUTPUT_ARCH): Likewise.
>         (LDEMUL_CHOOSE_TARGET): Likewise.
>         (LDEMUL_BEFORE_ALLOCATION): Likewise.
>         (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Likewise.
>         (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
>         (LDEMUL_PARSE_ARGS): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_UNRECOGNIZED_FILE): Likewise.
>         (LDEMUL_PRINT_SYMBOL): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/beos.em (gld_${EMULATION_NAME}_before_parse):
>         Renamed to ...
>         (gld${EMULATION_NAME}_before_parse): This.
>         (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
>         (gld${EMULATION_NAME}_set_symbols): This.
>         (gld_${EMULATION_NAME}_after_open): Renamed to ...
>         (gld${EMULATION_NAME}_after_open): This.
>         (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
>         (gld${EMULATION_NAME}_before_allocation): This.
>         (gld_${EMULATION_NAME}_get_script): Renamed to ...
>         (gld${EMULATION_NAME}_get_script): This.
>         (LDEMUL_AFTER_OPEN): New.
>         (LDEMUL_BEFORE_ALLOCATION): Likewise.
>         (LDEMUL_PLACE_ORPHAN): Likewise.
>         (LDEMUL_SET_SYMBOLS): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/elf.em (LDEMUL_AFTER_PARSE): New.
>         (LDEMUL_AFTER_OPEN): Likewise.
>         (LDEMUL_BEFORE_PLACE_ORPHANS): Likewise.
>         (LDEMUL_AFTER_ALLOCATION): Likewise.
>         (LDEMUL_SET_OUTPUT_ARCH): Likewise.
>         (LDEMUL_BEFORE_ALLOCATION): Likewise.
>         (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
>         (LDEMUL_PLACE_ORPHAN): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_LIST_OPTIONS): Likewise.
>         (LDEMUL_UNRECOGNIZED_FILE): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/emulation.em: New file.
>         * emultempl/generic.em (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/msp430.em (LDEMUL_AFTER_OPEN): New.
>         (LDEMUL_AFTER_ALLOCATION): Likewise.
>         (LDEMUL_PLACE_ORPHAN): Likewise.
>         (LDEMUL_FINISH): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_LIST_OPTIONS): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/pe.em (gld_${EMULATION_NAME}_before_parse): Renamed
>         to ...
>         (gld${EMULATION_NAME}_before_parse): This.
>         (gld_${EMULATION_NAME}_list_options): Renamed to ...
>         (gld${EMULATION_NAME}_list_options): This.
>         (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
>         (gld${EMULATION_NAME}_set_symbols): This.
>         (gld_${EMULATION_NAME}_after_parse): Renamed to ...
>         (gld${EMULATION_NAME}_after_parse): This.
>         (gld_${EMULATION_NAME}_after_open): Renamed to ...
>         (gld${EMULATION_NAME}_after_open): This.
>         (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
>         (gld${EMULATION_NAME}_before_allocation): This.
>         (gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
>         (gld${EMULATION_NAME}_unrecognized_file): This.
>         (gld_${EMULATION_NAME}_recognized_file): Renamed to ...
>         (gld${EMULATION_NAME}_recognized_file): This.
>         (gld_${EMULATION_NAME}_finish): Renamed to ...
>         (gld${EMULATION_NAME}_finish): This.
>         (gld_${EMULATION_NAME}_place_orphan): Renamed to ...
>         (gld${EMULATION_NAME}_place_orphan): This.
>         (gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
>         (gld${EMULATION_NAME}_open_dynamic_archive): This.
>         (gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
>         (gld${EMULATION_NAME}_find_potential_libraries): This.
>         (gld_${EMULATION_NAME}_get_script): Renamed to ...
>         (gld${EMULATION_NAME}_get_script): This.
>         (LDEMUL_AFTER_PARSE): New.
>         (LDEMUL_AFTER_OPEN): Likewise.
>         (LDEMUL_BEFORE_ALLOCATION): Likewise.
>         (LDEMUL_FINISH=): Likewise.
>         (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
>         (LDEMUL_PLACE_ORPHAN): Likewise.
>         (LDEMUL_SET_SYMBOLS): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_UNRECOGNIZED_FILE): Likewise.
>         (LDEMUL_LIST_OPTIONS): Likewise.
>         (LDEMUL_RECOGNIZED_FILE): Likewise.
>         (LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/pep.em (gld_${EMULATION_NAME}_before_parse): Renamed
>         to ...
>         (gld${EMULATION_NAME}_before_parse): This.
>         (gld_${EMULATION_NAME}_list_options): Renamed to ...
>         (gld${EMULATION_NAME}_list_options): This.
>         (gld_${EMULATION_NAME}_set_symbols): Renamed to ...
>         (gld${EMULATION_NAME}_set_symbols): This.
>         (gld_${EMULATION_NAME}_after_parse): Renamed to ...
>         (gld${EMULATION_NAME}_after_parse): This.
>         (gld_${EMULATION_NAME}_after_open): Renamed to ...
>         (gld${EMULATION_NAME}_after_open): This.
>         (gld_${EMULATION_NAME}_before_allocation): Renamed to ...
>         (gld${EMULATION_NAME}_before_allocation): This.
>         (gld_${EMULATION_NAME}_unrecognized_file): Renamed to ...
>         (gld${EMULATION_NAME}_unrecognized_file): This.
>         (gld_${EMULATION_NAME}_recognized_file): Renamed to ...
>         (gld${EMULATION_NAME}_recognized_file): This.
>         (gld_${EMULATION_NAME}_finish): Renamed to ...
>         (gld${EMULATION_NAME}_finish): This.
>         (gld_${EMULATION_NAME}_place_orphan): Renamed to ...
>         (gld${EMULATION_NAME}_place_orphan): This.
>         (gld_${EMULATION_NAME}_open_dynamic_archive): Renamed to ...
>         (gld${EMULATION_NAME}_open_dynamic_archive): This.
>         (gld_${EMULATION_NAME}_find_potential_libraries): Renamed to ...
>         (gld${EMULATION_NAME}_find_potential_libraries): This.
>         (gld_${EMULATION_NAME}_get_script): Renamed to ...
>         (gld${EMULATION_NAME}_get_script): This.
>         (LDEMUL_AFTER_PARSE): New.
>         (LDEMUL_AFTER_OPEN): Likewise.
>         (LDEMUL_BEFORE_ALLOCATION): Likewise.
>         (LDEMUL_FINISH=): Likewise.
>         (LDEMUL_OPEN_DYNAMIC_ARCHIVE): Likewise.
>         (LDEMUL_PLACE_ORPHAN): Likewise.
>         (LDEMUL_SET_SYMBOLS): Likewise.
>         (LDEMUL_ADD_OPTIONS): Likewise.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_UNRECOGNIZED_FILE): Likewise.
>         (LDEMUL_LIST_OPTIONS): Likewise.
>         (LDEMUL_RECOGNIZED_FILE): Likewise.
>         (LDEMUL_FIND_POTENTIAL_LIBRARIES): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/ticoff.em (gld_${EMULATION_NAME}_list_options):
>         Renamed to ...
>         (gld${EMULATION_NAME}_list_options): This.
>         (gld_${EMULATION_NAME}_before_parse): Renamed to ...
>         (gld_${EMULATION_NAME}_get_script): Renamed to ...
>         (gld${EMULATION_NAME}_get_script): This.
>         (LDEMUL_ADD_OPTIONS): New.
>         (LDEMUL_HANDLE_OPTION): Likewise.
>         (LDEMUL_LIST_OPTIONS): Likewise.
>         (ld_${EMULATION_NAME}_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
>         * emultempl/vanilla.em (LDEMUL_BEFORE_PARSE): New.
>         (LDEMUL_SET_OUTPUT_ARCH): Likewise.
>         (LDEMUL_GET_SCRIPT): Likewise.
>         (EMULATION_NAME): Likewise.
>         (OUTPUT_FORMAT): Likewise.
>         (ld_vanilla_emulation): Removed.
>         Source ${srcdir}/emultempl/emulation.em.
> ---
>  ld/emultempl/aix.em       | 49 +++++++----------------
>  ld/emultempl/beos.em      | 55 ++++++-------------------
>  ld/emultempl/elf.em       | 52 +++++++-----------------
>  ld/emultempl/emulation.em | 40 +++++++++++++++++++
>  ld/emultempl/generic.em   | 39 +-----------------
>  ld/emultempl/msp430.em    | 46 +++++----------------
>  ld/emultempl/pe.em        | 84 ++++++++++++++-------------------------
>  ld/emultempl/pep.em       | 80 +++++++++++++------------------------
>  ld/emultempl/ticoff.em    | 48 ++++------------------
>  ld/emultempl/vanilla.em   | 44 ++++----------------
>  10 files changed, 165 insertions(+), 372 deletions(-)
>  create mode 100644 ld/emultempl/emulation.em
>
> diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
> index b82305dc09e..6807aaee1c8 100644
> --- a/ld/emultempl/aix.em
> +++ b/ld/emultempl/aix.em
> @@ -1601,39 +1601,18 @@ gld${EMULATION_NAME}_print_symbol (struct bfd_link_hash_entry *hash_entry,
>
>    return true;
>  }
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
> -  gld${EMULATION_NAME}_before_parse,
> -  syslib_default,
> -  hll_default,
> -  after_parse_default,
> -  gld${EMULATION_NAME}_after_open,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  gld${EMULATION_NAME}_set_output_arch,
> -  gld${EMULATION_NAME}_choose_target,
> -  gld${EMULATION_NAME}_before_allocation,
> -  gld${EMULATION_NAME}_get_script,
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  finish_default,
> -  gld${EMULATION_NAME}_create_output_section_statements,
> -  gld${EMULATION_NAME}_open_dynamic_archive,
> -  0,                           /* place_orphan */
> -  0,                           /* set_symbols */
> -  gld${EMULATION_NAME}_parse_args,
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  gld${EMULATION_NAME}_unrecognized_file,
> -  NULL,                                /* list_options */
> -  NULL,                                /* recognized_file */
> -  NULL,                                /* find potential_libraries */
> -  NULL,                                /* new_vers_pattern */
> -  NULL,                                /* extra_map_file_text */
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  gld${EMULATION_NAME}_print_symbol
> -};
>  EOF
> +
> +LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
> +LDEMUL_SET_OUTPUT_ARCH=gld${EMULATION_NAME}_set_output_arch
> +LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
> +LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
> +LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=gld${EMULATION_NAME}_create_output_section_statements
> +LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
> +LDEMUL_PARSE_ARGS=gld${EMULATION_NAME}_parse_args
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
> +LDEMUL_PRINT_SYMBOL=gld${EMULATION_NAME}_print_symbol
> +
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
> index bebad8af2f7..93e85a792a3 100644
> --- a/ld/emultempl/beos.em
> +++ b/ld/emultempl/beos.em
> @@ -62,7 +62,7 @@ static int dll;
>  extern const char *output_filename;
>
>  static void
> -gld_${EMULATION_NAME}_before_parse (void)
> +gld${EMULATION_NAME}_before_parse (void)
>  {
>    ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
>    output_filename = "a.exe";
> @@ -322,7 +322,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
>     read.  */
>
>  static void
> -gld_${EMULATION_NAME}_set_symbols (void)
> +gld${EMULATION_NAME}_set_symbols (void)
>  {
>    /* Run through and invent symbols for all the
>       names and insert the defaults. */
> @@ -372,7 +372,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_after_open (void)
> +gld${EMULATION_NAME}_after_open (void)
>  {
>    after_open_default ();
>
> @@ -606,7 +606,7 @@ sort_sections (lang_statement_union_type *s)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_before_allocation (void)
> +gld${EMULATION_NAME}_before_allocation (void)
>  {
>  #ifdef TARGET_IS_armpe
>    /* FIXME: we should be able to set the size of the interworking stub
> @@ -710,7 +710,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
>  }
>
>  static char *
> -gld_${EMULATION_NAME}_get_script (int *isfile)
> +gld${EMULATION_NAME}_get_script (int *isfile)
>  EOF
>
>  if test x"$COMPILE_IN" = xyes
> @@ -759,42 +759,11 @@ fragment <<EOF
>  EOF
>  fi
>
> -fragment <<EOF
> -
> +LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
> +LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
> +LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
> +LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
>
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  gld_${EMULATION_NAME}_before_parse,
> -  syslib_default,
> -  hll_default,
> -  after_parse_default,
> -  gld_${EMULATION_NAME}_after_open,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  set_output_arch_default,
> -  ldemul_default_target,
> -  gld_${EMULATION_NAME}_before_allocation,
> -  gld_${EMULATION_NAME}_get_script,
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  finish_default,
> -  NULL, /* create output section statements */
> -  NULL, /* open dynamic archive */
> -  gld${EMULATION_NAME}_place_orphan,
> -  gld_${EMULATION_NAME}_set_symbols,
> -  NULL, /* parse_args */
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  NULL,        /* unrecognized file */
> -  NULL,        /* list options */
> -  NULL,        /* recognized file */
> -  NULL,        /* find_potential_libraries */
> -  NULL,        /* new_vers_pattern */
> -  NULL,        /* extra_map_file_text */
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
> index 7325872e1d9..55dd20f0b02 100644
> --- a/ld/emultempl/elf.em
> +++ b/ld/emultempl/elf.em
> @@ -909,41 +909,17 @@ EOF
>  fi
>  fi
>
> -fragment <<EOF
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
> -  ${LDEMUL_SYSLIB-syslib_default},
> -  ${LDEMUL_HLL-hll_default},
> -  ${LDEMUL_AFTER_PARSE-ldelf_after_parse},
> -  ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open},
> -  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
> -  ${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans},
> -  ${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation},
> -  ${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch},
> -  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
> -  ${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation},
> -  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  ${LDEMUL_FINISH-finish_default},
> -  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
> -  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive},
> -  ${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan},
> -  ${LDEMUL_SET_SYMBOLS-NULL},
> -  ${LDEMUL_PARSE_ARGS-NULL},
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
> -  ${LDEMUL_LIST_OPTIONS-${gld_list_options}},
> -  ${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols},
> -  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
> -  ${LDEMUL_NEW_VERS_PATTERN-NULL},
> -  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +LDEMUL_AFTER_PARSE=${LDEMUL_AFTER_PARSE-ldelf_after_parse}
> +LDEMUL_AFTER_OPEN=${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open}
> +LDEMUL_BEFORE_PLACE_ORPHANS=${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans}
> +LDEMUL_AFTER_ALLOCATION=${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}
> +LDEMUL_SET_OUTPUT_ARCH=${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch}
> +LDEMUL_BEFORE_ALLOCATION=${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}
> +LDEMUL_OPEN_DYNAMIC_ARCHIVE=${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}
> +LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_LIST_OPTIONS=${LDEMUL_LIST_OPTIONS-${gld_list_options}}
> +LDEMUL_RECOGNIZED_FILE=${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols}
> +
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/emulation.em b/ld/emultempl/emulation.em
> new file mode 100644
> index 00000000000..cfa6567ac2b
> --- /dev/null
> +++ b/ld/emultempl/emulation.em
> @@ -0,0 +1,40 @@
> +# This shell script emits a C file. -*- C -*-
> +# It does some substitutions.
> +fragment <<EOF
> +
> +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> +{
> +  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
> +  ${LDEMUL_SYSLIB-syslib_default},
> +  ${LDEMUL_HLL-hll_default},
> +  ${LDEMUL_AFTER_PARSE-after_parse_default},
> +  ${LDEMUL_AFTER_OPEN-after_open_default},
> +  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
> +  ${LDEMUL_BEFORE_PLACE_ORPHANS-before_place_orphans_default},
> +  ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
> +  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
> +  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
> +  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
> +  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
> +  "${EMULATION_NAME}",
> +  "${OUTPUT_FORMAT}",
> +  ${LDEMUL_FINISH-finish_default},
> +  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
> +  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
> +  ${LDEMUL_PLACE_ORPHAN-NULL},
> +  ${LDEMUL_SET_SYMBOLS-NULL},
> +  ${LDEMUL_PARSE_ARGS-NULL},
> +  ${LDEMUL_ADD_OPTIONS-NULL},
> +  ${LDEMUL_HANDLE_OPTION-NULL},
> +  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
> +  ${LDEMUL_LIST_OPTIONS-NULL},
> +  ${LDEMUL_RECOGNIZED_FILE-NULL},
> +  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
> +  ${LDEMUL_NEW_VERS_PATTERN-NULL},
> +  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
> +  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> +  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> +  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> +  ${LDEMUL_PRINT_SYMBOL-NULL}
> +};
> +EOF
> diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
> index e7c990e7260..cecbb1c2728 100644
> --- a/ld/emultempl/generic.em
> +++ b/ld/emultempl/generic.em
> @@ -128,41 +128,4 @@ EOF
>  fi
>  fi
>
> -fragment <<EOF
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
> -  ${LDEMUL_SYSLIB-syslib_default},
> -  ${LDEMUL_HLL-hll_default},
> -  ${LDEMUL_AFTER_PARSE-after_parse_default},
> -  ${LDEMUL_AFTER_OPEN-after_open_default},
> -  ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
> -  ${LDEMUL_BEFORE_PLACE_ORPHANS-before_place_orphans_default},
> -  ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
> -  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
> -  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
> -  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
> -  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  ${LDEMUL_FINISH-finish_default},
> -  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
> -  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
> -  ${LDEMUL_PLACE_ORPHAN-NULL},
> -  ${LDEMUL_SET_SYMBOLS-NULL},
> -  ${LDEMUL_PARSE_ARGS-NULL},
> -  ${LDEMUL_ADD_OPTIONS-NULL},
> -  ${LDEMUL_HANDLE_OPTION-NULL},
> -  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
> -  ${LDEMUL_LIST_OPTIONS-NULL},
> -  ${LDEMUL_RECOGNIZED_FILE-NULL},
> -  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
> -  ${LDEMUL_NEW_VERS_PATTERN-NULL},
> -  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em
> index abfbdcb64a8..f188b46b4aa 100644
> --- a/ld/emultempl/msp430.em
> +++ b/ld/emultempl/msp430.em
> @@ -905,43 +905,17 @@ gld${EMULATION_NAME}_finish (void)
>    finish_default ();
>    check_array_section_alignment ();
>  }
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
> -  ${LDEMUL_SYSLIB-syslib_default},
> -  ${LDEMUL_HLL-hll_default},
> -  ${LDEMUL_AFTER_PARSE-after_parse_default},
> -  msp430_elf_after_open,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  msp430_elf_after_allocation,
> -  ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
> -  ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
> -  ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
> -  ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  gld${EMULATION_NAME}_finish,
> -  ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
> -  ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
> -  ${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan},
> -  ${LDEMUL_SET_SYMBOLS-NULL},
> -  ${LDEMUL_PARSE_ARGS-NULL},
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  ${LDEMUL_UNRECOGNIZED_FILE-NULL},
> -  gld${EMULATION_NAME}_list_options,
> -  ${LDEMUL_RECOGNIZED_FILE-NULL},
> -  ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
> -  ${LDEMUL_NEW_VERS_PATTERN-NULL},
> -  ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
>  EOF
> +
> +LDEMUL_AFTER_OPEN=msp430_elf_after_open
> +LDEMUL_AFTER_ALLOCATION=msp430_elf_after_allocation
> +LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-gld${EMULATION_NAME}_place_orphan}
> +LDEMUL_FINISH=gld${EMULATION_NAME}_finish
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
> +
> +source_em ${srcdir}/emultempl/emulation.em
>  #
>  # Local Variables:
>  # mode: c
> diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
> index 3c6a07e8e86..892bf70b7a6 100644
> --- a/ld/emultempl/pe.em
> +++ b/ld/emultempl/pe.em
> @@ -172,7 +172,7 @@ static int is_underscoring (void)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_before_parse (void)
> +gld${EMULATION_NAME}_before_parse (void)
>  {
>    is_underscoring ();
>    ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
> @@ -454,7 +454,7 @@ static definfo init[] =
>
>
>  static void
> -gld_${EMULATION_NAME}_list_options (FILE *file)
> +gld${EMULATION_NAME}_list_options (FILE *file)
>  {
>    fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
>    fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
> @@ -1002,7 +1002,7 @@ compute_dll_image_base (const char *ofile)
>     read.  */
>
>  static void
> -gld_${EMULATION_NAME}_set_symbols (void)
> +gld${EMULATION_NAME}_set_symbols (void)
>  {
>    /* Run through and invent symbols for all the
>       names and insert the defaults.  */
> @@ -1069,7 +1069,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
>     have been read.  */
>
>  static void
> -gld_${EMULATION_NAME}_after_parse (void)
> +gld${EMULATION_NAME}_after_parse (void)
>  {
>    /* PR ld/6744:  Warn the user if they have used an ELF-only
>       option hoping it will work on PE.  */
> @@ -1382,7 +1382,7 @@ setup_build_id (bfd *ibfd)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_after_open (void)
> +gld${EMULATION_NAME}_after_open (void)
>  {
>    after_open_default ();
>
> @@ -1803,7 +1803,7 @@ gld_${EMULATION_NAME}_after_open (void)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_before_allocation (void)
> +gld${EMULATION_NAME}_before_allocation (void)
>  {
>  #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
>    /* FIXME: we should be able to set the size of the interworking stub
> @@ -1849,7 +1849,7 @@ saw_option (char *option)
>  #endif /* DLL_SUPPORT */
>
>  static bool
> -gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
> +gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
>  {
>  #ifdef DLL_SUPPORT
>    const char *ext = entry->filename + strlen (entry->filename) - 4;
> @@ -1930,7 +1930,7 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
>  }
>
>  static bool
> -gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
> +gld${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
>  {
>  #ifdef DLL_SUPPORT
>  #ifdef TARGET_IS_i386pe
> @@ -1952,7 +1952,7 @@ gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUT
>  }
>
>  static void
> -gld_${EMULATION_NAME}_finish (void)
> +gld${EMULATION_NAME}_finish (void)
>  {
>  #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
>    struct bfd_link_hash_entry * h;
> @@ -2052,9 +2052,9 @@ gld_${EMULATION_NAME}_finish (void)
>     sort_sections.  */
>
>  static lang_output_section_statement_type *
> -gld_${EMULATION_NAME}_place_orphan (asection *s,
> -                                   const char *secname,
> -                                   int constraint)
> +gld${EMULATION_NAME}_place_orphan (asection *s,
> +                                  const char *secname,
> +                                  int constraint)
>  {
>    const char *orig_secname = secname;
>    char *dollar = NULL;
> @@ -2251,7 +2251,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
>  }
>
>  static bool
> -gld_${EMULATION_NAME}_open_dynamic_archive
> +gld${EMULATION_NAME}_open_dynamic_archive
>    (const char *arch ATTRIBUTE_UNUSED,
>     search_dirs_type *search,
>     lang_input_statement_type *entry)
> @@ -2357,14 +2357,14 @@ gld_${EMULATION_NAME}_open_dynamic_archive
>  }
>
>  static int
> -gld_${EMULATION_NAME}_find_potential_libraries
> +gld${EMULATION_NAME}_find_potential_libraries
>    (char *name, lang_input_statement_type *entry)
>  {
>    return ldfile_open_file_search (name, entry, "", ".lib");
>  }
>
>  static char *
> -gld_${EMULATION_NAME}_get_script (int *isfile)
> +gld${EMULATION_NAME}_get_script (int *isfile)
>  EOF
>
>  if test x"$COMPILE_IN" = xyes
> @@ -2426,42 +2426,18 @@ fragment <<EOF
>  EOF
>  fi
>
> -fragment <<EOF
> -
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  gld_${EMULATION_NAME}_before_parse,
> -  syslib_default,
> -  hll_default,
> -  gld_${EMULATION_NAME}_after_parse,
> -  gld_${EMULATION_NAME}_after_open,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  set_output_arch_default,
> -  ldemul_default_target,
> -  gld_${EMULATION_NAME}_before_allocation,
> -  gld_${EMULATION_NAME}_get_script,
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  gld_${EMULATION_NAME}_finish,
> -  NULL, /* Create output section statements.  */
> -  gld_${EMULATION_NAME}_open_dynamic_archive,
> -  gld_${EMULATION_NAME}_place_orphan,
> -  gld_${EMULATION_NAME}_set_symbols,
> -  NULL, /* parse_args */
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  gld_${EMULATION_NAME}_unrecognized_file,
> -  gld_${EMULATION_NAME}_list_options,
> -  gld_${EMULATION_NAME}_recognized_file,
> -  gld_${EMULATION_NAME}_find_potential_libraries,
> -  NULL,        /* new_vers_pattern.  */
> -  NULL,        /* extra_map_file_text.  */
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
> +LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
> +LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
> +LDEMUL_FINISH=gld${EMULATION_NAME}_finish
> +LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
> +LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
> +LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
> +LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
> +LDEMUL_RECOGNIZED_FILE=gld${EMULATION_NAME}_recognized_file
> +LDEMUL_FIND_POTENTIAL_LIBRARIES=gld${EMULATION_NAME}_find_potential_libraries
> +
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
> index 848daa16746..e68d1e69f17 100644
> --- a/ld/emultempl/pep.em
> +++ b/ld/emultempl/pep.em
> @@ -183,7 +183,7 @@ static int is_underscoring (void)
>
>
>  static void
> -gld_${EMULATION_NAME}_before_parse (void)
> +gld${EMULATION_NAME}_before_parse (void)
>  {
>    is_underscoring ();
>    ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
> @@ -417,7 +417,7 @@ static definfo init[] =
>
>
>  static void
> -gld_${EMULATION_NAME}_list_options (FILE *file)
> +gld${EMULATION_NAME}_list_options (FILE *file)
>  {
>    fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
>    fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
> @@ -945,7 +945,7 @@ compute_dll_image_base (const char *ofile)
>     read.  */
>
>  static void
> -gld_${EMULATION_NAME}_set_symbols (void)
> +gld${EMULATION_NAME}_set_symbols (void)
>  {
>    /* Run through and invent symbols for all the
>       names and insert the defaults.  */
> @@ -1012,7 +1012,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
>     have been read.  */
>
>  static void
> -gld_${EMULATION_NAME}_after_parse (void)
> +gld${EMULATION_NAME}_after_parse (void)
>  {
>    /* PR ld/6744:  Warn the user if they have used an ELF-only
>       option hoping it will work on PE+.  */
> @@ -1366,7 +1366,7 @@ setup_build_id (bfd *ibfd)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_after_open (void)
> +gld${EMULATION_NAME}_after_open (void)
>  {
>    after_open_default ();
>
> @@ -1694,7 +1694,7 @@ gld_${EMULATION_NAME}_after_open (void)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_before_allocation (void)
> +gld${EMULATION_NAME}_before_allocation (void)
>  {
>    is_underscoring ();
>    before_allocation_default ();
> @@ -1719,7 +1719,7 @@ saw_option (char *option)
>  #endif /* DLL_SUPPORT */
>
>  static bool
> -gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
> +gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
>  {
>  #ifdef DLL_SUPPORT
>    const char *ext = entry->filename + strlen (entry->filename) - 4;
> @@ -1800,7 +1800,7 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
>  }
>
>  static bool
> -gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
> +gld${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
>  {
>    is_underscoring ();
>  #ifdef DLL_SUPPORT
> @@ -1814,7 +1814,7 @@ gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUT
>  }
>
>  static void
> -gld_${EMULATION_NAME}_finish (void)
> +gld${EMULATION_NAME}_finish (void)
>  {
>    is_underscoring ();
>    finish_default ();
> @@ -1864,7 +1864,7 @@ gld_${EMULATION_NAME}_finish (void)
>     sort_sections.  */
>
>  static lang_output_section_statement_type *
> -gld_${EMULATION_NAME}_place_orphan (asection *s,
> +gld${EMULATION_NAME}_place_orphan (asection *s,
>                                     const char *secname,
>                                     int constraint)
>  {
> @@ -2063,7 +2063,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
>  }
>
>  static bool
> -gld_${EMULATION_NAME}_open_dynamic_archive
> +gld${EMULATION_NAME}_open_dynamic_archive
>    (const char *arch ATTRIBUTE_UNUSED,
>     search_dirs_type *search,
>     lang_input_statement_type *entry)
> @@ -2169,14 +2169,14 @@ gld_${EMULATION_NAME}_open_dynamic_archive
>  }
>
>  static int
> -gld_${EMULATION_NAME}_find_potential_libraries
> +gld${EMULATION_NAME}_find_potential_libraries
>    (char *name, lang_input_statement_type *entry)
>  {
>    return ldfile_open_file_search (name, entry, "", ".lib");
>  }
>
>  static char *
> -gld_${EMULATION_NAME}_get_script (int *isfile)
> +gld${EMULATION_NAME}_get_script (int *isfile)
>  EOF
>
>  if test x"$COMPILE_IN" = xyes
> @@ -2238,42 +2238,18 @@ fragment <<EOF
>  EOF
>  fi
>
> -fragment <<EOF
> -
> -
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  gld_${EMULATION_NAME}_before_parse,
> -  syslib_default,
> -  hll_default,
> -  gld_${EMULATION_NAME}_after_parse,
> -  gld_${EMULATION_NAME}_after_open,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  set_output_arch_default,
> -  ldemul_default_target,
> -  gld_${EMULATION_NAME}_before_allocation,
> -  gld_${EMULATION_NAME}_get_script,
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  gld_${EMULATION_NAME}_finish,
> -  NULL, /* Create output section statements.  */
> -  gld_${EMULATION_NAME}_open_dynamic_archive,
> -  gld_${EMULATION_NAME}_place_orphan,
> -  gld_${EMULATION_NAME}_set_symbols,
> -  NULL, /* parse_args */
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  gld_${EMULATION_NAME}_unrecognized_file,
> -  gld_${EMULATION_NAME}_list_options,
> -  gld_${EMULATION_NAME}_recognized_file,
> -  gld_${EMULATION_NAME}_find_potential_libraries,
> -  NULL,        /* new_vers_pattern.  */
> -  NULL,        /* extra_map_file_text */
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
> +LDEMUL_AFTER_OPEN=gld${EMULATION_NAME}_after_open
> +LDEMUL_BEFORE_ALLOCATION=gld${EMULATION_NAME}_before_allocation
> +LDEMUL_FINISH=gld${EMULATION_NAME}_finish
> +LDEMUL_OPEN_DYNAMIC_ARCHIVE=gld${EMULATION_NAME}_open_dynamic_archive
> +LDEMUL_PLACE_ORPHAN=gld${EMULATION_NAME}_place_orphan
> +LDEMUL_SET_SYMBOLS=gld${EMULATION_NAME}_set_symbols
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_UNRECOGNIZED_FILE=gld${EMULATION_NAME}_unrecognized_file
> +LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
> +LDEMUL_RECOGNIZED_FILE=gld${EMULATION_NAME}_recognized_file
> +LDEMUL_FIND_POTENTIAL_LIBRARIES=gld${EMULATION_NAME}_find_potential_libraries
> +
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
> index 1ac483b9c7f..a57e73bc5c3 100644
> --- a/ld/emultempl/ticoff.em
> +++ b/ld/emultempl/ticoff.em
> @@ -64,7 +64,7 @@ gld${EMULATION_NAME}_add_options
>  }
>
>  static void
> -gld_${EMULATION_NAME}_list_options (FILE * file)
> +gld${EMULATION_NAME}_list_options (FILE * file)
>  {
>    fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
>  }
> @@ -96,7 +96,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
>  }
>
>  static void
> -gld_${EMULATION_NAME}_before_parse(void)
> +gld${EMULATION_NAME}_before_parse(void)
>  {
>  #ifndef TARGET_                        /* I.e., if not generic.  */
>    ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
> @@ -104,7 +104,7 @@ gld_${EMULATION_NAME}_before_parse(void)
>  }
>
>  static char *
> -gld_${EMULATION_NAME}_get_script (int *isfile)
> +gld${EMULATION_NAME}_get_script (int *isfile)
>  EOF
>  if test x"$COMPILE_IN" = xyes
>  then
> @@ -154,40 +154,8 @@ EOF
>
>  fi
>
> -fragment <<EOF
> -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
> -{
> -  gld_${EMULATION_NAME}_before_parse,
> -  syslib_default,
> -  hll_default,
> -  after_parse_default,
> -  after_open_default,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  set_output_arch_default,
> -  ldemul_default_target,
> -  before_allocation_default,
> -  gld_${EMULATION_NAME}_get_script,
> -  "${EMULATION_NAME}",
> -  "${OUTPUT_FORMAT}",
> -  finish_default,
> -  NULL, /* create output section statements */
> -  NULL, /* open dynamic archive */
> -  NULL, /* place orphan */
> -  NULL, /* set_symbols */
> -  NULL, /* parse_args */
> -  gld${EMULATION_NAME}_add_options,
> -  gld${EMULATION_NAME}_handle_option,
> -  NULL, /* unrecognized_file */
> -  gld_${EMULATION_NAME}_list_options,
> -  NULL, /* recognized file */
> -  NULL,        /* find_potential_libraries */
> -  NULL,        /* new_vers_pattern */
> -  NULL,  /* extra_map_file_text */
> -  ${LDEMUL_EMIT_CTF_EARLY-NULL},
> -  ${LDEMUL_ACQUIRE_STRINGS_FOR_CTF-NULL},
> -  ${LDEMUL_NEW_DYNSYM_FOR_CTF-NULL},
> -  ${LDEMUL_PRINT_SYMBOL-NULL}
> -};
> -EOF
> +LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
> +LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
> +LDEMUL_LIST_OPTIONS=gld${EMULATION_NAME}_list_options
> +
> +source_em ${srcdir}/emultempl/emulation.em
> diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
> index dc47ca13efb..c9aef37742f 100644
> --- a/ld/emultempl/vanilla.em
> +++ b/ld/emultempl/vanilla.em
> @@ -55,40 +55,12 @@ vanilla_get_script (int *isfile)
>    *isfile = 0;
>    return "";
>  }
> -
> -struct ld_emulation_xfer_struct ld_vanilla_emulation =
> -{
> -  vanilla_before_parse,
> -  syslib_default,
> -  hll_default,
> -  after_parse_default,
> -  after_open_default,
> -  after_check_relocs_default,
> -  before_place_orphans_default,
> -  after_allocation_default,
> -  vanilla_set_output_arch,
> -  ldemul_default_target,
> -  before_allocation_default,
> -  vanilla_get_script,
> -  "vanilla",
> -  "a.out-sunos-big",
> -  finish_default,
> -  NULL,        /* create output section statements */
> -  NULL,        /* open dynamic archive */
> -  NULL,        /* place orphan */
> -  NULL,        /* set symbols */
> -  NULL,        /* parse args */
> -  NULL,        /* add_options */
> -  NULL,        /* handle_option */
> -  NULL,        /* unrecognized file */
> -  NULL,        /* list options */
> -  NULL,        /* recognized file */
> -  NULL,        /* find_potential_libraries */
> -  NULL,        /* new_vers_pattern */
> -  NULL,        /* extra_map_file_text */
> -  NULL, /* emit_ctf_early */
> -  NULL, /* acquire_strings_for_ctf */
> -  NULL, /* new_dynsym_for_ctf */
> -  NULL  /* print_symbol */
> -};
>  EOF
> +
> +LDEMUL_BEFORE_PARSE=vanilla_before_parse
> +LDEMUL_SET_OUTPUT_ARCH=vanilla_set_output_arch
> +LDEMUL_GET_SCRIPT=vanilla_get_script
> +EMULATION_NAME=vanilla
> +OUTPUT_FORMAT=a.out-sunos-big
> +
> +source_em ${srcdir}/emultempl/emulation.em
> --
> 2.34.1
>

Here are diffs of generated emulation files.  All changes
are cosmetic.  It passed all cross binutils tests.   I am
checking it in.

-- 
H.J.

[-- Attachment #2: ld.diff --]
[-- Type: text/x-patch, Size: 51169 bytes --]

--- ../../binutils-all/build-x86_64-linux/ld/eaix5ppc.c	2022-02-04 11:33:01.285821309 -0800
+++ ld/eaix5ppc.c	2022-02-06 06:19:31.562802906 -0800
@@ -1558,7 +1558,8 @@ gldaix5ppc_print_symbol (struct bfd_link
   return true;
 }
 
-struct ld_emulation_xfer_struct ld_aix5ppc_emulation = {
+struct ld_emulation_xfer_struct ld_aix5ppc_emulation =
+{
   gldaix5ppc_before_parse,
   syslib_default,
   hll_default,
@@ -1576,17 +1577,17 @@ struct ld_emulation_xfer_struct ld_aix5p
   finish_default,
   gldaix5ppc_create_output_section_statements,
   gldaix5ppc_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
+  NULL,
+  NULL,
   gldaix5ppc_parse_args,
   gldaix5ppc_add_options,
   gldaix5ppc_handle_option,
   gldaix5ppc_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/eaix5rs6.c	2022-02-04 11:33:01.315821222 -0800
+++ ld/eaix5rs6.c	2022-02-06 06:19:31.563802901 -0800
@@ -1558,7 +1558,8 @@ gldaix5rs6_print_symbol (struct bfd_link
   return true;
 }
 
-struct ld_emulation_xfer_struct ld_aix5rs6_emulation = {
+struct ld_emulation_xfer_struct ld_aix5rs6_emulation =
+{
   gldaix5rs6_before_parse,
   syslib_default,
   hll_default,
@@ -1576,17 +1577,17 @@ struct ld_emulation_xfer_struct ld_aix5r
   finish_default,
   gldaix5rs6_create_output_section_statements,
   gldaix5rs6_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
+  NULL,
+  NULL,
   gldaix5rs6_parse_args,
   gldaix5rs6_add_options,
   gldaix5rs6_handle_option,
   gldaix5rs6_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/eaixppc.c	2022-02-04 11:33:01.326821190 -0800
+++ ld/eaixppc.c	2022-02-06 06:19:31.559802921 -0800
@@ -1558,7 +1558,8 @@ gldaixppc_print_symbol (struct bfd_link_
   return true;
 }
 
-struct ld_emulation_xfer_struct ld_aixppc_emulation = {
+struct ld_emulation_xfer_struct ld_aixppc_emulation =
+{
   gldaixppc_before_parse,
   syslib_default,
   hll_default,
@@ -1576,17 +1577,17 @@ struct ld_emulation_xfer_struct ld_aixpp
   finish_default,
   gldaixppc_create_output_section_statements,
   gldaixppc_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
+  NULL,
+  NULL,
   gldaixppc_parse_args,
   gldaixppc_add_options,
   gldaixppc_handle_option,
   gldaixppc_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/eaixrs6.c	2022-02-04 11:33:01.425820902 -0800
+++ ld/eaixrs6.c	2022-02-06 06:19:31.563802901 -0800
@@ -1558,7 +1558,8 @@ gldaixrs6_print_symbol (struct bfd_link_
   return true;
 }
 
-struct ld_emulation_xfer_struct ld_aixrs6_emulation = {
+struct ld_emulation_xfer_struct ld_aixrs6_emulation =
+{
   gldaixrs6_before_parse,
   syslib_default,
   hll_default,
@@ -1576,17 +1577,17 @@ struct ld_emulation_xfer_struct ld_aixrs
   finish_default,
   gldaixrs6_create_output_section_statements,
   gldaixrs6_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
+  NULL,
+  NULL,
   gldaixrs6_parse_args,
   gldaixrs6_add_options,
   gldaixrs6_handle_option,
   gldaixrs6_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/earmpe.c	2022-02-04 11:33:03.284815497 -0800
+++ ld/earmpe.c	2022-02-06 06:19:33.604792831 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_armpe_before_parse (void)
+gldarmpe_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("arm", bfd_arch_arm);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_armpe_list_options (FILE *file)
+gldarmpe_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_armpe_set_symbols (void)
+gldarmpe_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_armpe_set_symbols (void)
    have been read.  */
 
 static void
-gld_armpe_after_parse (void)
+gldarmpe_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_armpe_after_open (void)
+gldarmpe_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_armpe_after_open (void)
 }
 \f
 static void
-gld_armpe_before_allocation (void)
+gldarmpe_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_armpe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldarmpe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_armpe_unrecognized_file (lang_input_
 }
 
 static bool
-gld_armpe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldarmpe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_armpe_recognized_file (lang_input_st
 }
 
 static void
-gld_armpe_finish (void)
+gldarmpe_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_armpe_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_armpe_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldarmpe_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_armpe_place_orphan (asection *s,
 }
 
 static bool
-gld_armpe_open_dynamic_archive
+gldarmpe_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_armpe_open_dynamic_archive
 }
 
 static int
-gld_armpe_find_potential_libraries
+gldarmpe_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_armpe_get_script (int *isfile)
+gldarmpe_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2300,37 +2300,36 @@ gld_armpe_get_script (int *isfile)
     return "ldscripts/armpe.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_armpe_emulation =
 {
-  gld_armpe_before_parse,
+  gldarmpe_before_parse,
   syslib_default,
   hll_default,
-  gld_armpe_after_parse,
-  gld_armpe_after_open,
+  gldarmpe_after_parse,
+  gldarmpe_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_armpe_before_allocation,
-  gld_armpe_get_script,
+  gldarmpe_before_allocation,
+  gldarmpe_get_script,
   "armpe",
   "pei-arm-little",
-  gld_armpe_finish,
-  NULL, /* Create output section statements.  */
-  gld_armpe_open_dynamic_archive,
-  gld_armpe_place_orphan,
-  gld_armpe_set_symbols,
-  NULL, /* parse_args */
+  gldarmpe_finish,
+  NULL,
+  gldarmpe_open_dynamic_archive,
+  gldarmpe_place_orphan,
+  gldarmpe_set_symbols,
+  NULL,
   gldarmpe_add_options,
   gldarmpe_handle_option,
-  gld_armpe_unrecognized_file,
-  gld_armpe_list_options,
-  gld_armpe_recognized_file,
-  gld_armpe_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldarmpe_unrecognized_file,
+  gldarmpe_list_options,
+  gldarmpe_recognized_file,
+  gldarmpe_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/earm_wince_pe.c	2022-02-04 11:33:01.756819939 -0800
+++ ld/earm_wince_pe.c	2022-02-06 06:19:31.794801761 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_arm_wince_pe_before_parse (void)
+gldarm_wince_pe_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("arm", bfd_arch_arm);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_arm_wince_pe_list_options (FILE *file)
+gldarm_wince_pe_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_arm_wince_pe_set_symbols (void)
+gldarm_wince_pe_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_arm_wince_pe_set_symbols (void)
    have been read.  */
 
 static void
-gld_arm_wince_pe_after_parse (void)
+gldarm_wince_pe_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_arm_wince_pe_after_open (void)
+gldarm_wince_pe_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_arm_wince_pe_after_open (void)
 }
 \f
 static void
-gld_arm_wince_pe_before_allocation (void)
+gldarm_wince_pe_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_arm_wince_pe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldarm_wince_pe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_arm_wince_pe_unrecognized_file (lang
 }
 
 static bool
-gld_arm_wince_pe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldarm_wince_pe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_arm_wince_pe_recognized_file (lang_i
 }
 
 static void
-gld_arm_wince_pe_finish (void)
+gldarm_wince_pe_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_arm_wince_pe_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_arm_wince_pe_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldarm_wince_pe_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_arm_wince_pe_place_orphan (asection
 }
 
 static bool
-gld_arm_wince_pe_open_dynamic_archive
+gldarm_wince_pe_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_arm_wince_pe_open_dynamic_archive
 }
 
 static int
-gld_arm_wince_pe_find_potential_libraries
+gldarm_wince_pe_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_arm_wince_pe_get_script (int *isfile)
+gldarm_wince_pe_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2300,37 +2300,36 @@ gld_arm_wince_pe_get_script (int *isfile
     return "ldscripts/arm_wince_pe.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_arm_wince_pe_emulation =
 {
-  gld_arm_wince_pe_before_parse,
+  gldarm_wince_pe_before_parse,
   syslib_default,
   hll_default,
-  gld_arm_wince_pe_after_parse,
-  gld_arm_wince_pe_after_open,
+  gldarm_wince_pe_after_parse,
+  gldarm_wince_pe_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_arm_wince_pe_before_allocation,
-  gld_arm_wince_pe_get_script,
+  gldarm_wince_pe_before_allocation,
+  gldarm_wince_pe_get_script,
   "arm_wince_pe",
   "pei-arm-wince-little",
-  gld_arm_wince_pe_finish,
-  NULL, /* Create output section statements.  */
-  gld_arm_wince_pe_open_dynamic_archive,
-  gld_arm_wince_pe_place_orphan,
-  gld_arm_wince_pe_set_symbols,
-  NULL, /* parse_args */
+  gldarm_wince_pe_finish,
+  NULL,
+  gldarm_wince_pe_open_dynamic_archive,
+  gldarm_wince_pe_place_orphan,
+  gldarm_wince_pe_set_symbols,
+  NULL,
   gldarm_wince_pe_add_options,
   gldarm_wince_pe_handle_option,
-  gld_arm_wince_pe_unrecognized_file,
-  gld_arm_wince_pe_list_options,
-  gld_arm_wince_pe_recognized_file,
-  gld_arm_wince_pe_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldarm_wince_pe_unrecognized_file,
+  gldarm_wince_pe_list_options,
+  gldarm_wince_pe_recognized_file,
+  gldarm_wince_pe_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/ei386beos.c	2022-02-04 11:33:09.211798264 -0800
+++ ld/ei386beos.c	2022-02-06 06:19:41.735752715 -0800
@@ -54,7 +54,7 @@ static int dll;
 extern const char *output_filename;
 
 static void
-gld_i386beos_before_parse (void)
+gldi386beos_before_parse (void)
 {
   ldfile_set_output_arch ("i386", bfd_arch_i386);
   output_filename = "a.exe";
@@ -314,7 +314,7 @@ gldi386beos_handle_option (int optc)
    read.  */
 
 static void
-gld_i386beos_set_symbols (void)
+gldi386beos_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults. */
@@ -364,7 +364,7 @@ gld_i386beos_set_symbols (void)
 }
 
 static void
-gld_i386beos_after_open (void)
+gldi386beos_after_open (void)
 {
   after_open_default ();
 
@@ -598,7 +598,7 @@ sort_sections (lang_statement_union_type
 }
 
 static void
-gld_i386beos_before_allocation (void)
+gldi386beos_before_allocation (void)
 {
 #ifdef TARGET_IS_armpe
   /* FIXME: we should be able to set the size of the interworking stub
@@ -702,7 +702,7 @@ gldi386beos_place_orphan (asection *s,
 }
 \f
 static char *
-gld_i386beos_get_script (int *isfile)
+gldi386beos_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -718,37 +718,36 @@ gld_i386beos_get_script (int *isfile)
     return "ldscripts/i386beos.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_i386beos_emulation =
 {
-  gld_i386beos_before_parse,
+  gldi386beos_before_parse,
   syslib_default,
   hll_default,
   after_parse_default,
-  gld_i386beos_after_open,
+  gldi386beos_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_i386beos_before_allocation,
-  gld_i386beos_get_script,
+  gldi386beos_before_allocation,
+  gldi386beos_get_script,
   "i386beos",
   "pei-i386",
   finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
+  NULL,
+  NULL,
   gldi386beos_place_orphan,
-  gld_i386beos_set_symbols,
-  NULL, /* parse_args */
+  gldi386beos_set_symbols,
+  NULL,
   gldi386beos_add_options,
   gldi386beos_handle_option,
-  NULL,	/* unrecognized file */
-  NULL,	/* list options */
-  NULL,	/* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,	/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/ei386pe.c	2022-02-04 11:33:09.447797578 -0800
+++ ld/ei386pe.c	2022-02-06 06:19:42.063751097 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_i386pe_before_parse (void)
+gldi386pe_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("i386", bfd_arch_i386);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_i386pe_list_options (FILE *file)
+gldi386pe_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_i386pe_set_symbols (void)
+gldi386pe_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_i386pe_set_symbols (void)
    have been read.  */
 
 static void
-gld_i386pe_after_parse (void)
+gldi386pe_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_i386pe_after_open (void)
+gldi386pe_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_i386pe_after_open (void)
 }
 \f
 static void
-gld_i386pe_before_allocation (void)
+gldi386pe_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_i386pe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_i386pe_unrecognized_file (lang_input
 }
 
 static bool
-gld_i386pe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_i386pe_recognized_file (lang_input_s
 }
 
 static void
-gld_i386pe_finish (void)
+gldi386pe_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_i386pe_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_i386pe_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldi386pe_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_i386pe_place_orphan (asection *s,
 }
 
 static bool
-gld_i386pe_open_dynamic_archive
+gldi386pe_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_i386pe_open_dynamic_archive
 }
 
 static int
-gld_i386pe_find_potential_libraries
+gldi386pe_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_i386pe_get_script (int *isfile)
+gldi386pe_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2303,37 +2303,36 @@ gld_i386pe_get_script (int *isfile)
     return "ldscripts/i386pe.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_i386pe_emulation =
 {
-  gld_i386pe_before_parse,
+  gldi386pe_before_parse,
   syslib_default,
   hll_default,
-  gld_i386pe_after_parse,
-  gld_i386pe_after_open,
+  gldi386pe_after_parse,
+  gldi386pe_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_i386pe_before_allocation,
-  gld_i386pe_get_script,
+  gldi386pe_before_allocation,
+  gldi386pe_get_script,
   "i386pe",
   "pei-i386",
-  gld_i386pe_finish,
-  NULL, /* Create output section statements.  */
-  gld_i386pe_open_dynamic_archive,
-  gld_i386pe_place_orphan,
-  gld_i386pe_set_symbols,
-  NULL, /* parse_args */
+  gldi386pe_finish,
+  NULL,
+  gldi386pe_open_dynamic_archive,
+  gldi386pe_place_orphan,
+  gldi386pe_set_symbols,
+  NULL,
   gldi386pe_add_options,
   gldi386pe_handle_option,
-  gld_i386pe_unrecognized_file,
-  gld_i386pe_list_options,
-  gld_i386pe_recognized_file,
-  gld_i386pe_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldi386pe_unrecognized_file,
+  gldi386pe_list_options,
+  gldi386pe_recognized_file,
+  gldi386pe_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/ei386pep.c	2022-02-04 11:33:19.797767485 -0800
+++ ld/ei386pep.c	2022-02-06 06:19:54.466689904 -0800
@@ -147,7 +147,7 @@ static int is_underscoring (void)
 
 
 static void
-gld_i386pep_before_parse (void)
+gldi386pep_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("i386:x86-64", bfd_arch_i386);
@@ -378,7 +378,7 @@ static definfo init[] =
 
 
 static void
-gld_i386pep_list_options (FILE *file)
+gldi386pep_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -890,7 +890,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_i386pep_set_symbols (void)
+gldi386pep_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -957,7 +957,7 @@ gld_i386pep_set_symbols (void)
    have been read.  */
 
 static void
-gld_i386pep_after_parse (void)
+gldi386pep_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE+.  */
@@ -1311,7 +1311,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_i386pep_after_open (void)
+gldi386pep_after_open (void)
 {
   after_open_default ();
 
@@ -1639,7 +1639,7 @@ gld_i386pep_after_open (void)
 }
 \f
 static void
-gld_i386pep_before_allocation (void)
+gldi386pep_before_allocation (void)
 {
   is_underscoring ();
   before_allocation_default ();
@@ -1664,7 +1664,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_i386pep_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pep_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1745,7 +1745,7 @@ gld_i386pep_unrecognized_file (lang_inpu
 }
 
 static bool
-gld_i386pep_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pep_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
   is_underscoring ();
 #ifdef DLL_SUPPORT
@@ -1759,7 +1759,7 @@ gld_i386pep_recognized_file (lang_input_
 }
 
 static void
-gld_i386pep_finish (void)
+gldi386pep_finish (void)
 {
   is_underscoring ();
   finish_default ();
@@ -1809,7 +1809,7 @@ gld_i386pep_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_i386pep_place_orphan (asection *s,
+gldi386pep_place_orphan (asection *s,
 				    const char *secname,
 				    int constraint)
 {
@@ -2008,7 +2008,7 @@ gld_i386pep_place_orphan (asection *s,
 }
 
 static bool
-gld_i386pep_open_dynamic_archive
+gldi386pep_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2114,14 +2114,14 @@ gld_i386pep_open_dynamic_archive
 }
 
 static int
-gld_i386pep_find_potential_libraries
+gldi386pep_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_i386pep_get_script (int *isfile)
+gldi386pep_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2140,37 +2140,36 @@ gld_i386pep_get_script (int *isfile)
     return "ldscripts/i386pep.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_i386pep_emulation =
 {
-  gld_i386pep_before_parse,
+  gldi386pep_before_parse,
   syslib_default,
   hll_default,
-  gld_i386pep_after_parse,
-  gld_i386pep_after_open,
+  gldi386pep_after_parse,
+  gldi386pep_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_i386pep_before_allocation,
-  gld_i386pep_get_script,
+  gldi386pep_before_allocation,
+  gldi386pep_get_script,
   "i386pep",
   "pei-x86-64",
-  gld_i386pep_finish,
-  NULL, /* Create output section statements.  */
-  gld_i386pep_open_dynamic_archive,
-  gld_i386pep_place_orphan,
-  gld_i386pep_set_symbols,
-  NULL, /* parse_args */
+  gldi386pep_finish,
+  NULL,
+  gldi386pep_open_dynamic_archive,
+  gldi386pep_place_orphan,
+  gldi386pep_set_symbols,
+  NULL,
   gldi386pep_add_options,
   gldi386pep_handle_option,
-  gld_i386pep_unrecognized_file,
-  gld_i386pep_list_options,
-  gld_i386pep_recognized_file,
-  gld_i386pep_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text */
+  gldi386pep_unrecognized_file,
+  gldi386pep_list_options,
+  gldi386pep_recognized_file,
+  gldi386pep_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/ei386pe_posix.c	2022-02-04 11:33:09.470797511 -0800
+++ ld/ei386pe_posix.c	2022-02-06 06:19:42.191750465 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_i386pe_posix_before_parse (void)
+gldi386pe_posix_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("i386", bfd_arch_i386);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_i386pe_posix_list_options (FILE *file)
+gldi386pe_posix_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_i386pe_posix_set_symbols (void)
+gldi386pe_posix_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_i386pe_posix_set_symbols (void)
    have been read.  */
 
 static void
-gld_i386pe_posix_after_parse (void)
+gldi386pe_posix_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_i386pe_posix_after_open (void)
+gldi386pe_posix_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_i386pe_posix_after_open (void)
 }
 \f
 static void
-gld_i386pe_posix_before_allocation (void)
+gldi386pe_posix_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_i386pe_posix_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pe_posix_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_i386pe_posix_unrecognized_file (lang
 }
 
 static bool
-gld_i386pe_posix_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldi386pe_posix_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_i386pe_posix_recognized_file (lang_i
 }
 
 static void
-gld_i386pe_posix_finish (void)
+gldi386pe_posix_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_i386pe_posix_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_i386pe_posix_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldi386pe_posix_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_i386pe_posix_place_orphan (asection
 }
 
 static bool
-gld_i386pe_posix_open_dynamic_archive
+gldi386pe_posix_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_i386pe_posix_open_dynamic_archive
 }
 
 static int
-gld_i386pe_posix_find_potential_libraries
+gldi386pe_posix_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_i386pe_posix_get_script (int *isfile)
+gldi386pe_posix_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2303,37 +2303,36 @@ gld_i386pe_posix_get_script (int *isfile
     return "ldscripts/i386pe_posix.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_i386pe_posix_emulation =
 {
-  gld_i386pe_posix_before_parse,
+  gldi386pe_posix_before_parse,
   syslib_default,
   hll_default,
-  gld_i386pe_posix_after_parse,
-  gld_i386pe_posix_after_open,
+  gldi386pe_posix_after_parse,
+  gldi386pe_posix_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_i386pe_posix_before_allocation,
-  gld_i386pe_posix_get_script,
+  gldi386pe_posix_before_allocation,
+  gldi386pe_posix_get_script,
   "i386pe_posix",
   "pei-i386",
-  gld_i386pe_posix_finish,
-  NULL, /* Create output section statements.  */
-  gld_i386pe_posix_open_dynamic_archive,
-  gld_i386pe_posix_place_orphan,
-  gld_i386pe_posix_set_symbols,
-  NULL, /* parse_args */
+  gldi386pe_posix_finish,
+  NULL,
+  gldi386pe_posix_open_dynamic_archive,
+  gldi386pe_posix_place_orphan,
+  gldi386pe_posix_set_symbols,
+  NULL,
   gldi386pe_posix_add_options,
   gldi386pe_posix_handle_option,
-  gld_i386pe_posix_unrecognized_file,
-  gld_i386pe_posix_list_options,
-  gld_i386pe_posix_recognized_file,
-  gld_i386pe_posix_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldi386pe_posix_unrecognized_file,
+  gldi386pe_posix_list_options,
+  gldi386pe_posix_recognized_file,
+  gldi386pe_posix_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/emcorepe.c	2022-02-04 11:33:10.003795961 -0800
+++ ld/emcorepe.c	2022-02-06 06:19:42.798747471 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_mcorepe_before_parse (void)
+gldmcorepe_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("mcore", bfd_arch_mcore);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_mcorepe_list_options (FILE *file)
+gldmcorepe_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_mcorepe_set_symbols (void)
+gldmcorepe_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_mcorepe_set_symbols (void)
    have been read.  */
 
 static void
-gld_mcorepe_after_parse (void)
+gldmcorepe_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_mcorepe_after_open (void)
+gldmcorepe_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_mcorepe_after_open (void)
 }
 \f
 static void
-gld_mcorepe_before_allocation (void)
+gldmcorepe_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_mcorepe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldmcorepe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_mcorepe_unrecognized_file (lang_inpu
 }
 
 static bool
-gld_mcorepe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldmcorepe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_mcorepe_recognized_file (lang_input_
 }
 
 static void
-gld_mcorepe_finish (void)
+gldmcorepe_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_mcorepe_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_mcorepe_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldmcorepe_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_mcorepe_place_orphan (asection *s,
 }
 
 static bool
-gld_mcorepe_open_dynamic_archive
+gldmcorepe_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_mcorepe_open_dynamic_archive
 }
 
 static int
-gld_mcorepe_find_potential_libraries
+gldmcorepe_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_mcorepe_get_script (int *isfile)
+gldmcorepe_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2300,37 +2300,36 @@ gld_mcorepe_get_script (int *isfile)
     return "ldscripts/mcorepe.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_mcorepe_emulation =
 {
-  gld_mcorepe_before_parse,
+  gldmcorepe_before_parse,
   syslib_default,
   hll_default,
-  gld_mcorepe_after_parse,
-  gld_mcorepe_after_open,
+  gldmcorepe_after_parse,
+  gldmcorepe_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_mcorepe_before_allocation,
-  gld_mcorepe_get_script,
+  gldmcorepe_before_allocation,
+  gldmcorepe_get_script,
   "mcorepe",
   "pei-mcore-little",
-  gld_mcorepe_finish,
-  NULL, /* Create output section statements.  */
-  gld_mcorepe_open_dynamic_archive,
-  gld_mcorepe_place_orphan,
-  gld_mcorepe_set_symbols,
-  NULL, /* parse_args */
+  gldmcorepe_finish,
+  NULL,
+  gldmcorepe_open_dynamic_archive,
+  gldmcorepe_place_orphan,
+  gldmcorepe_set_symbols,
+  NULL,
   gldmcorepe_add_options,
   gldmcorepe_handle_option,
-  gld_mcorepe_unrecognized_file,
-  gld_mcorepe_list_options,
-  gld_mcorepe_recognized_file,
-  gld_mcorepe_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldmcorepe_unrecognized_file,
+  gldmcorepe_list_options,
+  gldmcorepe_recognized_file,
+  gldmcorepe_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/eppcmacos.c	2022-02-04 11:33:10.684793981 -0800
+++ ld/eppcmacos.c	2022-02-06 06:19:43.832742369 -0800
@@ -1558,7 +1558,8 @@ gldppcmacos_print_symbol (struct bfd_lin
   return true;
 }
 
-struct ld_emulation_xfer_struct ld_ppcmacos_emulation = {
+struct ld_emulation_xfer_struct ld_ppcmacos_emulation =
+{
   gldppcmacos_before_parse,
   syslib_default,
   hll_default,
@@ -1576,17 +1577,17 @@ struct ld_emulation_xfer_struct ld_ppcma
   finish_default,
   gldppcmacos_create_output_section_statements,
   gldppcmacos_open_dynamic_archive,
-  0,				/* place_orphan */
-  0,				/* set_symbols */
+  NULL,
+  NULL,
   gldppcmacos_parse_args,
   gldppcmacos_add_options,
   gldppcmacos_handle_option,
   gldppcmacos_unrecognized_file,
-  NULL,				/* list_options */
-  NULL,				/* recognized_file */
-  NULL,				/* find potential_libraries */
-  NULL,				/* new_vers_pattern */
-  NULL,				/* extra_map_file_text */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/eshpe.c	2022-02-04 11:33:11.695791042 -0800
+++ ld/eshpe.c	2022-02-06 06:19:45.016736528 -0800
@@ -148,7 +148,7 @@ static int is_underscoring (void)
 }
 
 static void
-gld_shpe_before_parse (void)
+gldshpe_before_parse (void)
 {
   is_underscoring ();
   ldfile_set_output_arch ("sh", bfd_arch_sh);
@@ -394,7 +394,7 @@ static definfo init[] =
 
 
 static void
-gld_shpe_list_options (FILE *file)
+gldshpe_list_options (FILE *file)
 {
   fprintf (file, _("  --base_file <basefile>             Generate a base file for relocatable DLLs\n"));
   fprintf (file, _("  --dll                              Set image base to the default for DLLs\n"));
@@ -924,7 +924,7 @@ compute_dll_image_base (const char *ofil
    read.  */
 
 static void
-gld_shpe_set_symbols (void)
+gldshpe_set_symbols (void)
 {
   /* Run through and invent symbols for all the
      names and insert the defaults.  */
@@ -991,7 +991,7 @@ gld_shpe_set_symbols (void)
    have been read.  */
 
 static void
-gld_shpe_after_parse (void)
+gldshpe_after_parse (void)
 {
   /* PR ld/6744:  Warn the user if they have used an ELF-only
      option hoping it will work on PE.  */
@@ -1304,7 +1304,7 @@ setup_build_id (bfd *ibfd)
 }
 
 static void
-gld_shpe_after_open (void)
+gldshpe_after_open (void)
 {
   after_open_default ();
 
@@ -1723,7 +1723,7 @@ gld_shpe_after_open (void)
 }
 \f
 static void
-gld_shpe_before_allocation (void)
+gldshpe_before_allocation (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   /* FIXME: we should be able to set the size of the interworking stub
@@ -1769,7 +1769,7 @@ saw_option (char *option)
 #endif /* DLL_SUPPORT */
 
 static bool
-gld_shpe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldshpe_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
   const char *ext = entry->filename + strlen (entry->filename) - 4;
@@ -1850,7 +1850,7 @@ gld_shpe_unrecognized_file (lang_input_s
 }
 
 static bool
-gld_shpe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
+gldshpe_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
 {
 #ifdef DLL_SUPPORT
 #ifdef TARGET_IS_i386pe
@@ -1872,7 +1872,7 @@ gld_shpe_recognized_file (lang_input_sta
 }
 
 static void
-gld_shpe_finish (void)
+gldshpe_finish (void)
 {
 #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
   struct bfd_link_hash_entry * h;
@@ -1972,9 +1972,9 @@ gld_shpe_finish (void)
    sort_sections.  */
 
 static lang_output_section_statement_type *
-gld_shpe_place_orphan (asection *s,
-				    const char *secname,
-				    int constraint)
+gldshpe_place_orphan (asection *s,
+				   const char *secname,
+				   int constraint)
 {
   const char *orig_secname = secname;
   char *dollar = NULL;
@@ -2171,7 +2171,7 @@ gld_shpe_place_orphan (asection *s,
 }
 
 static bool
-gld_shpe_open_dynamic_archive
+gldshpe_open_dynamic_archive
   (const char *arch ATTRIBUTE_UNUSED,
    search_dirs_type *search,
    lang_input_statement_type *entry)
@@ -2277,14 +2277,14 @@ gld_shpe_open_dynamic_archive
 }
 
 static int
-gld_shpe_find_potential_libraries
+gldshpe_find_potential_libraries
   (char *name, lang_input_statement_type *entry)
 {
   return ldfile_open_file_search (name, entry, "", ".lib");
 }
 \f
 static char *
-gld_shpe_get_script (int *isfile)
+gldshpe_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -2300,37 +2300,36 @@ gld_shpe_get_script (int *isfile)
     return "ldscripts/shpe.x";
 }
 
-
 struct ld_emulation_xfer_struct ld_shpe_emulation =
 {
-  gld_shpe_before_parse,
+  gldshpe_before_parse,
   syslib_default,
   hll_default,
-  gld_shpe_after_parse,
-  gld_shpe_after_open,
+  gldshpe_after_parse,
+  gldshpe_after_open,
   after_check_relocs_default,
   before_place_orphans_default,
   after_allocation_default,
   set_output_arch_default,
   ldemul_default_target,
-  gld_shpe_before_allocation,
-  gld_shpe_get_script,
+  gldshpe_before_allocation,
+  gldshpe_get_script,
   "shpe",
   "pei-shl",
-  gld_shpe_finish,
-  NULL, /* Create output section statements.  */
-  gld_shpe_open_dynamic_archive,
-  gld_shpe_place_orphan,
-  gld_shpe_set_symbols,
-  NULL, /* parse_args */
+  gldshpe_finish,
+  NULL,
+  gldshpe_open_dynamic_archive,
+  gldshpe_place_orphan,
+  gldshpe_set_symbols,
+  NULL,
   gldshpe_add_options,
   gldshpe_handle_option,
-  gld_shpe_unrecognized_file,
-  gld_shpe_list_options,
-  gld_shpe_recognized_file,
-  gld_shpe_find_potential_libraries,
-  NULL,	/* new_vers_pattern.  */
-  NULL,	/* extra_map_file_text.  */
+  gldshpe_unrecognized_file,
+  gldshpe_list_options,
+  gldshpe_recognized_file,
+  gldshpe_find_potential_libraries,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/etic3xcoff.c	2022-02-04 11:33:11.814790696 -0800
+++ ld/etic3xcoff.c	2022-02-06 06:19:45.254735353 -0800
@@ -64,7 +64,7 @@ gldtic3xcoff_add_options
 }
 
 static void
-gld_tic3xcoff_list_options (FILE * file)
+gldtic3xcoff_list_options (FILE * file)
 {
   fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
 }
@@ -96,7 +96,7 @@ gldtic3xcoff_handle_option (int optc)
 }
 
 static void
-gld_tic3xcoff_before_parse(void)
+gldtic3xcoff_before_parse(void)
 {
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("tic3x", bfd_arch_unknown);
@@ -104,7 +104,7 @@ gld_tic3xcoff_before_parse(void)
 }
 
 static char *
-gld_tic3xcoff_get_script (int *isfile)
+gldtic3xcoff_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -119,9 +119,10 @@ gld_tic3xcoff_get_script (int *isfile)
   else
     return "ldscripts/tic3xcoff.x";
 }
+
 struct ld_emulation_xfer_struct ld_tic3xcoff_emulation =
 {
-  gld_tic3xcoff_before_parse,
+  gldtic3xcoff_before_parse,
   syslib_default,
   hll_default,
   after_parse_default,
@@ -132,23 +133,23 @@ struct ld_emulation_xfer_struct ld_tic3x
   set_output_arch_default,
   ldemul_default_target,
   before_allocation_default,
-  gld_tic3xcoff_get_script,
+  gldtic3xcoff_get_script,
   "tic3xcoff",
   "coff2-tic4x",
   finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL, /* parse_args */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   gldtic3xcoff_add_options,
   gldtic3xcoff_handle_option,
-  NULL, /* unrecognized_file */
-  gld_tic3xcoff_list_options,
-  NULL, /* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,  /* extra_map_file_text */
+  NULL,
+  gldtic3xcoff_list_options,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/etic3xcoff_onchip.c	2022-02-04 11:33:11.858790568 -0800
+++ ld/etic3xcoff_onchip.c	2022-02-06 06:19:45.400734633 -0800
@@ -64,7 +64,7 @@ gldtic3xcoff_onchip_add_options
 }
 
 static void
-gld_tic3xcoff_onchip_list_options (FILE * file)
+gldtic3xcoff_onchip_list_options (FILE * file)
 {
   fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
 }
@@ -96,7 +96,7 @@ gldtic3xcoff_onchip_handle_option (int o
 }
 
 static void
-gld_tic3xcoff_onchip_before_parse(void)
+gldtic3xcoff_onchip_before_parse(void)
 {
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("tic3x", bfd_arch_unknown);
@@ -104,7 +104,7 @@ gld_tic3xcoff_onchip_before_parse(void)
 }
 
 static char *
-gld_tic3xcoff_onchip_get_script (int *isfile)
+gldtic3xcoff_onchip_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -119,9 +119,10 @@ gld_tic3xcoff_onchip_get_script (int *is
   else
     return "ldscripts/tic3xcoff_onchip.x";
 }
+
 struct ld_emulation_xfer_struct ld_tic3xcoff_onchip_emulation =
 {
-  gld_tic3xcoff_onchip_before_parse,
+  gldtic3xcoff_onchip_before_parse,
   syslib_default,
   hll_default,
   after_parse_default,
@@ -132,23 +133,23 @@ struct ld_emulation_xfer_struct ld_tic3x
   set_output_arch_default,
   ldemul_default_target,
   before_allocation_default,
-  gld_tic3xcoff_onchip_get_script,
+  gldtic3xcoff_onchip_get_script,
   "tic3xcoff_onchip",
   "coff2-tic4x",
   finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL, /* parse_args */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   gldtic3xcoff_onchip_add_options,
   gldtic3xcoff_onchip_handle_option,
-  NULL, /* unrecognized_file */
-  gld_tic3xcoff_onchip_list_options,
-  NULL, /* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,  /* extra_map_file_text */
+  NULL,
+  gldtic3xcoff_onchip_list_options,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/etic4xcoff.c	2022-02-04 11:33:11.885790489 -0800
+++ ld/etic4xcoff.c	2022-02-06 06:19:45.405734608 -0800
@@ -64,7 +64,7 @@ gldtic4xcoff_add_options
 }
 
 static void
-gld_tic4xcoff_list_options (FILE * file)
+gldtic4xcoff_list_options (FILE * file)
 {
   fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
 }
@@ -96,7 +96,7 @@ gldtic4xcoff_handle_option (int optc)
 }
 
 static void
-gld_tic4xcoff_before_parse(void)
+gldtic4xcoff_before_parse(void)
 {
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("tic4x", bfd_arch_unknown);
@@ -104,7 +104,7 @@ gld_tic4xcoff_before_parse(void)
 }
 
 static char *
-gld_tic4xcoff_get_script (int *isfile)
+gldtic4xcoff_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -119,9 +119,10 @@ gld_tic4xcoff_get_script (int *isfile)
   else
     return "ldscripts/tic4xcoff.x";
 }
+
 struct ld_emulation_xfer_struct ld_tic4xcoff_emulation =
 {
-  gld_tic4xcoff_before_parse,
+  gldtic4xcoff_before_parse,
   syslib_default,
   hll_default,
   after_parse_default,
@@ -132,23 +133,23 @@ struct ld_emulation_xfer_struct ld_tic4x
   set_output_arch_default,
   ldemul_default_target,
   before_allocation_default,
-  gld_tic4xcoff_get_script,
+  gldtic4xcoff_get_script,
   "tic4xcoff",
   "coff2-tic4x",
   finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL, /* parse_args */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   gldtic4xcoff_add_options,
   gldtic4xcoff_handle_option,
-  NULL, /* unrecognized_file */
-  gld_tic4xcoff_list_options,
-  NULL, /* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,  /* extra_map_file_text */
+  NULL,
+  gldtic4xcoff_list_options,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/etic54xcoff.c	2022-02-04 11:33:11.939790332 -0800
+++ ld/etic54xcoff.c	2022-02-06 06:19:45.494734169 -0800
@@ -64,7 +64,7 @@ gldtic54xcoff_add_options
 }
 
 static void
-gld_tic54xcoff_list_options (FILE * file)
+gldtic54xcoff_list_options (FILE * file)
 {
   fprintf (file, _("  --format 0|1|2              Specify which COFF version to use\n"));
 }
@@ -96,7 +96,7 @@ gldtic54xcoff_handle_option (int optc)
 }
 
 static void
-gld_tic54xcoff_before_parse(void)
+gldtic54xcoff_before_parse(void)
 {
 #ifndef TARGET_			/* I.e., if not generic.  */
   ldfile_set_output_arch ("tic54x", bfd_arch_unknown);
@@ -104,7 +104,7 @@ gld_tic54xcoff_before_parse(void)
 }
 
 static char *
-gld_tic54xcoff_get_script (int *isfile)
+gldtic54xcoff_get_script (int *isfile)
 {
   *isfile = 1;
 
@@ -119,9 +119,10 @@ gld_tic54xcoff_get_script (int *isfile)
   else
     return "ldscripts/tic54xcoff.x";
 }
+
 struct ld_emulation_xfer_struct ld_tic54xcoff_emulation =
 {
-  gld_tic54xcoff_before_parse,
+  gldtic54xcoff_before_parse,
   syslib_default,
   hll_default,
   after_parse_default,
@@ -132,23 +133,23 @@ struct ld_emulation_xfer_struct ld_tic54
   set_output_arch_default,
   ldemul_default_target,
   before_allocation_default,
-  gld_tic54xcoff_get_script,
+  gldtic54xcoff_get_script,
   "tic54xcoff",
   "coff1-c54x",
   finish_default,
-  NULL, /* create output section statements */
-  NULL, /* open dynamic archive */
-  NULL, /* place orphan */
-  NULL, /* set_symbols */
-  NULL, /* parse_args */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   gldtic54xcoff_add_options,
   gldtic54xcoff_handle_option,
-  NULL, /* unrecognized_file */
-  gld_tic54xcoff_list_options,
-  NULL, /* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,  /* extra_map_file_text */
+  NULL,
+  gldtic54xcoff_list_options,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
   NULL,
   NULL,
   NULL,
--- ../../binutils-all/build-x86_64-linux/ld/evanilla.c	2022-02-04 11:33:12.002790149 -0800
+++ ld/evanilla.c	2022-02-06 06:19:45.599733651 -0800
@@ -70,21 +70,21 @@ struct ld_emulation_xfer_struct ld_vanil
   "vanilla",
   "a.out-sunos-big",
   finish_default,
-  NULL,	/* create output section statements */
-  NULL,	/* open dynamic archive */
-  NULL,	/* place orphan */
-  NULL,	/* set symbols */
-  NULL,	/* parse args */
-  NULL,	/* add_options */
-  NULL,	/* handle_option */
-  NULL,	/* unrecognized file */
-  NULL,	/* list options */
-  NULL,	/* recognized file */
-  NULL,	/* find_potential_libraries */
-  NULL,	/* new_vers_pattern */
-  NULL,	/* extra_map_file_text */
-  NULL, /* emit_ctf_early */
-  NULL, /* acquire_strings_for_ctf */
-  NULL, /* new_dynsym_for_ctf */
-  NULL  /* print_symbol */
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  NULL
 };

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-06 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 21:05 [PATCH] ld: Ad emultempl/emulation.em H.J. Lu
2022-02-06 14:25 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).