diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-02-04 11:04:15 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-02-06 06:25:41 -0800 |
commit | a92613915ec2f38e1ab62ab254dde2a1ad4ad408 (patch) | |
tree | 053d8739de7d55b88c7eea6e80656eddbfadedac /ld/emultempl/pe.em | |
parent | 026fbfa60eb7e94b4c7a6f340d433acb1eb7b7ad (diff) | |
download | gdb-a92613915ec2f38e1ab62ab254dde2a1ad4ad408.zip gdb-a92613915ec2f38e1ab62ab254dde2a1ad4ad408.tar.gz gdb-a92613915ec2f38e1ab62ab254dde2a1ad4ad408.tar.bz2 |
ld: Add emultempl/emulation.em
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.
Diffstat (limited to 'ld/emultempl/pe.em')
-rw-r--r-- | ld/emultempl/pe.em | 84 |
1 files changed, 30 insertions, 54 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 3c6a07e..892bf70 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 |