1 # This shell script emits a C file. -*- C -*-
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;
38 extern enum bfd_architecture ldfile_output_architecture;
39 extern unsigned long ldfile_output_machine;
40 extern char *ldfile_output_machine_name;
43 gld${EMULATION_NAME}_before_parse()
45 #ifndef TARGET_ /* I.e., if not generic. */
46 ldfile_output_architecture = bfd_arch_${ARCH};
47 #endif /* not TARGET_ */
51 gld${EMULATION_NAME}_get_script(isfile)
55 if test "$DEFAULT_EMULATION" = "$EMULATION_NAME"
57 # Scripts compiled in.
59 # sed commands to quote an ld script as a C string.
66 cat >>em_${EMULATION_NAME}.c <<EOF
68 extern ld_config_type config;
72 if (config.relocateable_output == true && config.build_constructors == true)
73 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
74 else if (config.relocateable_output == true)
75 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
76 else if (!config.text_read_only)
77 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
78 else if (!config.magic_demand_paged)
79 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
81 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
86 # Scripts read from the filesystem.
88 cat >>em_${EMULATION_NAME}.c <<EOF
90 extern ld_config_type config;
94 if (config.relocateable_output == true && config.build_constructors == true)
95 return "ldscripts/${EMULATION_NAME}.xu";
96 else if (config.relocateable_output == true)
97 return "ldscripts/${EMULATION_NAME}.xr";
98 else if (!config.text_read_only)
99 return "ldscripts/${EMULATION_NAME}.xbn";
100 else if (!config.magic_demand_paged)
101 return "ldscripts/${EMULATION_NAME}.xn";
103 return "ldscripts/${EMULATION_NAME}.x";
109 cat >>em_${EMULATION_NAME}.c <<EOF
111 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
113 gld${EMULATION_NAME}_before_parse,
117 after_allocation_default,
118 set_output_arch_default,
119 ldemul_default_target,
120 before_allocation_default,
121 gld${EMULATION_NAME}_get_script,