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, 93, 94, 95, 96, 1999 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 the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 * emulate the Intels port of gld
31 #include "libiberty.h"
45 static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
49 for ( p = env_variables; *p; p++ ){
50 env = (char *) getenv(*p);
52 ldfile_add_library_path (concat (env,
58 ldfile_output_architecture = bfd_arch_i960;
61 #else /* not GNU960 */
63 static void gld960_before_parse()
66 env = getenv("G960LIB");
68 ldfile_add_library_path(env, false);
70 env = getenv("G960BASE");
72 ldfile_add_library_path (concat (env, "/lib", (const char *) NULL),
74 ldfile_output_architecture = bfd_arch_i960;
81 gld960_set_output_arch()
83 if (ldfile_output_machine_name != NULL
84 && *ldfile_output_machine_name != '\0')
88 s = concat ("i960:", ldfile_output_machine_name, (char *) NULL);
89 for (s1 = s; *s1 != '\0'; s1++)
90 if (isupper ((unsigned char) *s1))
91 *s1 = tolower ((unsigned char) *s1);
92 ldfile_set_output_arch (s);
96 set_output_arch_default ();
100 gld960_choose_target()
104 output_filename = "b.out";
105 return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
109 char *from_outside = getenv(TARGET_ENVIRON);
110 output_filename = "b.out";
112 if (from_outside != (char *)NULL)
115 return "coff-Intel-little";
121 gld960_get_script(isfile)
125 if test -n "$COMPILE_IN"
127 # Scripts compiled in.
129 # sed commands to quote an ld script as a C string.
130 sc="-f stringify.sed"
132 cat >>e${EMULATION_NAME}.c <<EOF
136 if (link_info.relocateable == true && config.build_constructors == true)
139 sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
140 echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
141 sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
142 echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
143 sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
144 echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
145 sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
146 echo ' ; else return' >> e${EMULATION_NAME}.c
147 sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
148 echo '; }' >> e${EMULATION_NAME}.c
151 # Scripts read from the filesystem.
153 cat >>e${EMULATION_NAME}.c <<EOF
157 if (link_info.relocateable == true && config.build_constructors == true)
158 return "ldscripts/${EMULATION_NAME}.xu";
159 else if (link_info.relocateable == true)
160 return "ldscripts/${EMULATION_NAME}.xr";
161 else if (!config.text_read_only)
162 return "ldscripts/${EMULATION_NAME}.xbn";
163 else if (!config.magic_demand_paged)
164 return "ldscripts/${EMULATION_NAME}.xn";
166 return "ldscripts/${EMULATION_NAME}.x";
172 cat >>e${EMULATION_NAME}.c <<EOF
174 struct ld_emulation_xfer_struct ld_gld960coff_emulation =
181 after_allocation_default,
182 gld960_set_output_arch,
183 gld960_choose_target,
184 before_allocation_default,
189 NULL, /* create output section statements */
190 NULL, /* open dynamic archive */
191 NULL, /* place orphan */
192 NULL, /* set symbols */
193 NULL, /* parse args */
194 NULL, /* unrecognized file */
195 NULL, /* list options */
196 NULL, /* recognized file */
197 NULL /* find_potential_libraries */