1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 cat >e${EMULATION_NAME}.c <<EOF
4 /* Copyright (C) 1991, 1993 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 * emulate the Intels port of gld
30 #include "libiberty.h"
44 static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
48 for ( p = env_variables; *p; p++ ){
49 env = (char *) getenv(*p);
51 ldfile_add_library_path (concat (env,
57 ldfile_output_architecture = bfd_arch_i960;
60 #else /* not GNU960 */
62 static void gld960_before_parse()
65 env = getenv("G960LIB");
67 ldfile_add_library_path(env, false);
69 env = getenv("G960BASE");
71 ldfile_add_library_path (concat (env, "/lib", (const char *) NULL),
73 ldfile_output_architecture = bfd_arch_i960;
80 gld960_set_output_arch()
82 if (ldfile_output_machine_name != NULL
83 && *ldfile_output_machine_name != '\0')
87 s = concat ("i960:", ldfile_output_machine_name, (char *) NULL);
88 for (s1 = s; *s1 != '\0'; s1++)
89 if (isupper ((unsigned char) *s1))
90 *s1 = tolower ((unsigned char) *s1);
91 ldfile_set_output_arch (s);
95 set_output_arch_default ();
99 gld960_choose_target()
103 output_filename = "b.out";
104 return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
108 char *from_outside = getenv(TARGET_ENVIRON);
109 output_filename = "b.out";
111 if (from_outside != (char *)NULL)
114 return "coff-Intel-little";
120 gld960_get_script(isfile)
124 if test -n "$COMPILE_IN"
126 # Scripts compiled in.
128 # sed commands to quote an ld script as a C string.
135 cat >>e${EMULATION_NAME}.c <<EOF
139 if (link_info.relocateable == true && config.build_constructors == true)
140 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
141 else if (link_info.relocateable == true)
142 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
143 else if (!config.text_read_only)
144 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
145 else if (!config.magic_demand_paged)
146 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
148 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
153 # Scripts read from the filesystem.
155 cat >>e${EMULATION_NAME}.c <<EOF
159 if (link_info.relocateable == true && config.build_constructors == true)
160 return "ldscripts/${EMULATION_NAME}.xu";
161 else if (link_info.relocateable == 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 >>e${EMULATION_NAME}.c <<EOF
176 struct ld_emulation_xfer_struct ld_gld960coff_emulation =
183 after_allocation_default,
184 gld960_set_output_arch,
185 gld960_choose_target,
186 before_allocation_default,