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
29 #include "libiberty.h"
43 static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
47 for ( p = env_variables; *p; p++ ){
48 env = (char *) getenv(*p);
50 ldfile_add_library_path (concat (env,
56 ldfile_output_architecture = bfd_arch_i960;
59 #else /* not GNU960 */
61 static void gld960_before_parse()
64 env = getenv("G960LIB");
66 ldfile_add_library_path(env, false);
68 env = getenv("G960BASE");
70 ldfile_add_library_path (concat (env, "/lib", (const char *) NULL), false);
71 ldfile_output_architecture = bfd_arch_i960;
78 gld960_set_output_arch()
80 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
84 gld960_choose_target()
88 output_filename = "b.out";
89 return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
93 char *from_outside = getenv(TARGET_ENVIRON);
94 output_filename = "b.out";
96 if (from_outside != (char *)NULL)
99 return "b.out.little";
105 gld960_get_script(isfile)
109 if test -n "$COMPILE_IN"
111 # Scripts compiled in.
113 # sed commands to quote an ld script as a C string.
120 cat >>e${EMULATION_NAME}.c <<EOF
124 if (link_info.relocateable == true && config.build_constructors == true)
125 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
126 else if (link_info.relocateable == true)
127 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
128 else if (!config.text_read_only)
129 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
130 else if (!config.magic_demand_paged)
131 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
133 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
138 # Scripts read from the filesystem.
140 cat >>e${EMULATION_NAME}.c <<EOF
144 if (link_info.relocateable == true && config.build_constructors == true)
145 return "ldscripts/${EMULATION_NAME}.xu";
146 else if (link_info.relocateable == true)
147 return "ldscripts/${EMULATION_NAME}.xr";
148 else if (!config.text_read_only)
149 return "ldscripts/${EMULATION_NAME}.xbn";
150 else if (!config.magic_demand_paged)
151 return "ldscripts/${EMULATION_NAME}.xn";
153 return "ldscripts/${EMULATION_NAME}.x";
159 cat >>e${EMULATION_NAME}.c <<EOF
161 struct ld_emulation_xfer_struct ld_gld960_emulation =
168 after_allocation_default,
169 gld960_set_output_arch,
170 gld960_choose_target,
171 before_allocation_default,