1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 cat >em_${EMULATION_NAME}.c <<EOF
4 /* Copyright (C) 1991 Free Software Foundation, Inc.
6 This file is part of GLD, the Gnu Linker.
8 GLD is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 1, or (at your option)
13 GLD is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GLD; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 * emulate the Intels port of gld
39 extern char *output_filename;
40 extern boolean lang_float_flag;
43 extern enum bfd_architecture ldfile_output_architecture;
44 extern unsigned long ldfile_output_machine;
45 extern char *ldfile_output_machine_name;
47 extern bfd *output_bfd;
56 static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
60 for ( p = env_variables; *p; p++ ){
61 env = (char *) getenv(*p);
63 ldfile_add_library_path(concat(env,"/lib/libbout",""));
66 ldfile_output_architecture = bfd_arch_i960;
69 #else /* not GNU960 */
71 static void gld960_before_parse()
74 env = getenv("G960LIB");
76 ldfile_add_library_path(env);
78 env = getenv("G960BASE");
80 ldfile_add_library_path(concat(env,"/lib",""));
82 ldfile_output_architecture = bfd_arch_i960;
89 gld960_set_output_arch()
91 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
95 gld960_choose_target()
99 output_filename = "b.out";
100 return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
104 char *from_outside = getenv(TARGET_ENVIRON);
105 output_filename = "b.out";
107 if (from_outside != (char *)NULL)
110 return "b.out.little";
116 gld960_get_script(isfile)
120 if test "$DEFAULT_EMULATION" = "$EMULATION_NAME"
122 # Scripts compiled in.
124 # sed commands to quote an ld script as a C string.
131 cat >>em_${EMULATION_NAME}.c <<EOF
133 extern ld_config_type config;
137 if (config.relocateable_output == true && config.build_constructors == true)
138 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
139 else if (config.relocateable_output == true)
140 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
141 else if (!config.text_read_only)
142 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
143 else if (!config.magic_demand_paged)
144 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
146 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
151 # Scripts read from the filesystem.
153 cat >>em_${EMULATION_NAME}.c <<EOF
155 extern ld_config_type config;
159 if (config.relocateable_output == true && config.build_constructors == true)
160 return "ldscripts/${EMULATION_NAME}.xu";
161 else if (config.relocateable_output == true)
162 return "ldscripts/${EMULATION_NAME}.xr";
163 else if (!config.text_read_only)
164 return "ldscripts/${EMULATION_NAME}.xbn";
165 else if (!config.magic_demand_paged)
166 return "ldscripts/${EMULATION_NAME}.xn";
168 return "ldscripts/${EMULATION_NAME}.x";
174 cat >>em_${EMULATION_NAME}.c <<EOF
176 struct ld_emulation_xfer_struct ld_gld960_emulation =
182 after_allocation_default,
183 gld960_set_output_arch,
184 gld960_choose_target,
185 before_allocation_default,