1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
4 /* This file is is generated by a shell script. DO NOT EDIT! */
6 /* emulate the original gld for the given ${EMULATION_NAME}
7 Copyright (C) 1991-2018 Free Software Foundation, Inc.
8 Written by Steve Chamberlain steve@cygnus.com
10 This file is part of the GNU Binutils.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
25 MA 02110-1301, USA. */
27 #define TARGET_IS_${EMULATION_NAME}
44 # Import any needed special functions and/or overrides.
46 if test -n "$EXTRA_EM_FILE" ; then
47 source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
50 if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
54 gld${EMULATION_NAME}_before_parse (void)
56 #ifndef TARGET_ /* I.e., if not generic. */
57 ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
58 #endif /* not TARGET_ */
60 # The MSP430 port *needs* linker relaxtion in order to cope with large
61 # functions where conditional branches do not fit into a +/- 1024 byte range.
65 if (!bfd_link_relocatable (&link_info))
66 TARGET_ENABLE_RELAXATION;
76 if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
80 gld${EMULATION_NAME}_get_script (int *isfile)
83 if test x"$COMPILE_IN" = xyes
85 # Scripts compiled in.
87 # sed commands to quote an ld script as a C string.
94 if (bfd_link_relocatable (&link_info) && config.build_constructors)
97 sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
98 echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
99 sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
100 echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
101 sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
102 echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
103 sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
104 echo ' ; else return' >> e${EMULATION_NAME}.c
105 sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
106 echo '; }' >> e${EMULATION_NAME}.c
109 # Scripts read from the filesystem.
115 if (bfd_link_relocatable (&link_info) && config.build_constructors)
116 return "ldscripts/${EMULATION_NAME}.xu";
117 else if (bfd_link_relocatable (&link_info))
118 return "ldscripts/${EMULATION_NAME}.xr";
119 else if (!config.text_read_only)
120 return "ldscripts/${EMULATION_NAME}.xbn";
121 else if (!config.magic_demand_paged)
122 return "ldscripts/${EMULATION_NAME}.xn";
124 return "ldscripts/${EMULATION_NAME}.x";
132 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
134 ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse},
135 ${LDEMUL_SYSLIB-syslib_default},
136 ${LDEMUL_HLL-hll_default},
137 ${LDEMUL_AFTER_PARSE-after_parse_default},
138 ${LDEMUL_AFTER_OPEN-after_open_default},
139 ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default},
140 ${LDEMUL_AFTER_ALLOCATION-after_allocation_default},
141 ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default},
142 ${LDEMUL_CHOOSE_TARGET-ldemul_default_target},
143 ${LDEMUL_BEFORE_ALLOCATION-before_allocation_default},
144 ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script},
147 ${LDEMUL_FINISH-finish_default},
148 ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL},
149 ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-NULL},
150 ${LDEMUL_PLACE_ORPHAN-NULL},
151 ${LDEMUL_SET_SYMBOLS-NULL},
152 ${LDEMUL_PARSE_ARGS-NULL},
153 ${LDEMUL_ADD_OPTIONS-NULL},
154 ${LDEMUL_HANDLE_OPTION-NULL},
155 ${LDEMUL_UNRECOGNIZED_FILE-NULL},
156 ${LDEMUL_LIST_OPTIONS-NULL},
157 ${LDEMUL_RECOGNIZED_FILE-NULL},
158 ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
159 ${LDEMUL_NEW_VERS_PATTERN-NULL},
160 ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}