1 /* NOTE: If there are angle brackets here: <TARGET> then this is a
2 * template file (ldtemplate), intended for processing by sed.
3 * Otherwise, this file has already been processed by sed,
4 * and customized for a particular emulation target.
5 * In that DO NOT EDIT the file; edit ldtemplate instead.
8 /* emulate the original gld for the given <TARGET>
9 Copyright (C) 1991 Free Software Foundation, Inc.
10 Written by Steve Chamberlain steve@cygnus.com
12 This file is part of GLD, the Gnu Linker.
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
32 #define TARGET_IS_<TARGET>
43 extern boolean lang_float_flag;
46 extern enum bfd_architecture ldfile_output_architecture;
47 extern unsigned long ldfile_output_machine;
48 extern char *ldfile_output_machine_name;
50 extern bfd *output_bfd;
54 static void gld<target>_before_parse()
56 #ifdef TARGET_IS_M88KBCS
60 #ifndef TARGET_ /* I.e., if not generic */
61 ldfile_output_architecture = bfd_arch_<arch>;
68 gld<target>_after_parse()
74 gld<target>_after_allocation()
80 gld<target>_before_allocation()
87 gld<target>_set_output_arch()
89 /* Set the output architecture and machine if possible */
90 bfd_set_arch_mach(output_bfd,
91 ldfile_output_architecture, ldfile_output_machine);
95 gld<target>_choose_target()
97 char *from_outside = getenv(TARGET_ENVIRON);
98 if (from_outside != (char *)NULL)
100 return GLD<TARGET>_TARGET;
106 info("%S SYSLIB ignored\n");
110 gld<target>_hll(ignore)
113 info("%S HLL ignored\n");
116 static char *gld<target>_script =
117 #include "<ldtarget>.x"
119 static char *gld<target>_script_option_Ur =
120 #include "<ldtarget>.xu"
122 static char *gld<target>_script_option_r =
123 #include "<ldtarget>.xr"
125 static char *gld<target>_script_option_n = /* Used with -n flag. */
126 #include "<ldtarget>.xn"
128 static char *gld<target>_script_option_N = /* Used with -N flag. */
129 #include "<ldtarget>.xN"
132 static char *gld<target>_get_script()
134 extern ld_config_type config;
135 if (config.relocateable_output == true &&
136 config.build_constructors == true) {
137 return gld<target>_script_option_Ur;
139 if (config.relocateable_output == true) {
140 return gld<target>_script_option_r;
142 if (!config.text_read_only)
143 return gld<target>_script_option_N;
144 if (!config.magic_demand_paged)
145 return gld<target>_script_option_n;
146 return gld<target>_script;
148 struct ld_emulation_xfer_struct ld_gld<target>_emulation =
150 gld<target>_before_parse,
153 gld<target>_after_parse,
154 gld<target>_after_allocation,
155 gld<target>_set_output_arch,
156 gld<target>_choose_target,
157 gld<target>_before_allocation,
158 gld<target>_get_script,