1 # This shell script that emits a C file.
2 # It does some substitutions.
3 cat >em_${EMULATION_NAME}.c <<EOF
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 Free Software Foundation, Inc.
10 This file is part of GLD, the Gnu Linker.
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 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
26 #define TARGET_IS_${EMULATION_NAME}
36 extern boolean lang_float_flag;
39 extern enum bfd_architecture ldfile_output_architecture;
40 extern unsigned long ldfile_output_machine;
41 extern char *ldfile_output_machine_name;
43 static void gld${EMULATION_NAME}_before_parse()
45 #ifdef TARGET_IS_m88kbcs
49 #ifndef TARGET_ /* I.e., if not generic */
50 ldfile_output_architecture = bfd_arch_${ARCH};
56 static char *gld${EMULATION_NAME}_script =
57 #include "${EMULATION_NAME}.x"
59 static char *gld${EMULATION_NAME}_script_option_Ur =
60 #include "${EMULATION_NAME}.xu"
62 static char *gld${EMULATION_NAME}_script_option_r =
63 #include "${EMULATION_NAME}.xr"
65 static char *gld${EMULATION_NAME}_script_option_n = /* Used with -n flag. */
66 #include "${EMULATION_NAME}.xn"
68 static char *gld${EMULATION_NAME}_script_option_N = /* Used with -N flag. */
69 #include "${EMULATION_NAME}.xbn"
72 static char *gld${EMULATION_NAME}_get_script()
74 extern ld_config_type config;
75 if (config.relocateable_output == true &&
76 config.build_constructors == true) {
77 return gld${EMULATION_NAME}_script_option_Ur;
79 if (config.relocateable_output == true) {
80 return gld${EMULATION_NAME}_script_option_r;
82 if (!config.text_read_only)
83 return gld${EMULATION_NAME}_script_option_N;
84 if (!config.magic_demand_paged)
85 return gld${EMULATION_NAME}_script_option_n;
86 return gld${EMULATION_NAME}_script;
88 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
90 gld${EMULATION_NAME}_before_parse,
94 after_allocation_default,
95 set_output_arch_default,
96 ldemul_default_target,
97 before_allocation_default,
98 gld${EMULATION_NAME}_get_script,