1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
4 /* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007
5 Free Software Foundation, Inc.
7 This file is part of the GNU Binutils.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 MA 02110-1301, USA. */
25 /* Emulate the Intel's port of gld. */
29 #include "libiberty.h"
41 static void gld960_before_parse (void)
44 env = getenv("G960LIB");
46 ldfile_add_library_path(env, FALSE);
48 env = getenv("G960BASE");
50 ldfile_add_library_path (concat (env, "/lib", (const char *) NULL), FALSE);
51 ldfile_output_architecture = bfd_arch_i960;
55 gld960_set_output_arch (void)
57 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
61 gld960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
63 char *from_outside = getenv(TARGET_ENVIRON);
64 output_filename = "b.out";
66 if (from_outside != (char *)NULL)
69 return "b.out.little";
73 gld960_get_script (int *isfile)
76 if test -n "$COMPILE_IN"
78 # Scripts compiled in.
80 # sed commands to quote an ld script as a C string.
87 if (link_info.relocatable && config.build_constructors)
90 sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
91 echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
92 sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
93 echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
94 sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
95 echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
96 sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
97 echo ' ; else return' >> e${EMULATION_NAME}.c
98 sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
99 echo '; }' >> e${EMULATION_NAME}.c
102 # Scripts read from the filesystem.
108 if (link_info.relocatable && config.build_constructors)
109 return "ldscripts/${EMULATION_NAME}.xu";
110 else if (link_info.relocatable)
111 return "ldscripts/${EMULATION_NAME}.xr";
112 else if (!config.text_read_only)
113 return "ldscripts/${EMULATION_NAME}.xbn";
114 else if (!config.magic_demand_paged)
115 return "ldscripts/${EMULATION_NAME}.xn";
117 return "ldscripts/${EMULATION_NAME}.x";
125 struct ld_emulation_xfer_struct ld_gld960_emulation =
132 after_allocation_default,
133 gld960_set_output_arch,
134 gld960_choose_target,
135 before_allocation_default,
140 NULL, /* create output section statements */
141 NULL, /* open dynamic archive */
142 NULL, /* place orphan */
143 NULL, /* set symbols */
144 NULL, /* parse args */
145 NULL, /* add_options */
146 NULL, /* handle_option */
147 NULL, /* unrecognized file */
148 NULL, /* list options */
149 NULL, /* recognized file */
150 NULL, /* find_potential_libraries */
151 NULL /* new_vers_pattern */