1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 cat >e${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, 1993 Free Software Foundation, Inc.
8 Written by Steve Chamberlain steve@cygnus.com
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #define TARGET_IS_${EMULATION_NAME}
39 gld${EMULATION_NAME}_before_parse()
41 link_info.lprefix = "@";
42 link_info.lprefix_len = 1;
44 ldfile_output_architecture = bfd_arch_${ARCH};
48 gld${EMULATION_NAME}_get_script(isfile)
52 if test -n "$COMPILE_IN"
54 # Scripts compiled in.
56 # sed commands to quote an ld script as a C string.
63 cat >>e${EMULATION_NAME}.c <<EOF
67 if (link_info.relocateable == true && config.build_constructors == true)
68 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
69 else if (link_info.relocateable == true)
70 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
71 else if (!config.text_read_only)
72 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
73 else if (!config.magic_demand_paged)
74 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
76 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
81 # Scripts read from the filesystem.
83 cat >>e${EMULATION_NAME}.c <<EOF
87 if (link_info.relocateable == true && config.build_constructors == true)
88 return "ldscripts/${EMULATION_NAME}.xu";
89 else if (link_info.relocateable == true)
90 return "ldscripts/${EMULATION_NAME}.xr";
91 else if (!config.text_read_only)
92 return "ldscripts/${EMULATION_NAME}.xbn";
93 else if (!config.magic_demand_paged)
94 return "ldscripts/${EMULATION_NAME}.xn";
96 return "ldscripts/${EMULATION_NAME}.x";
102 cat >>e${EMULATION_NAME}.c <<EOF
104 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
106 gld${EMULATION_NAME}_before_parse,
111 after_allocation_default,
112 set_output_arch_default,
113 ldemul_default_target,
114 before_allocation_default,
115 gld${EMULATION_NAME}_get_script,