Update FSF addresses
[deliverable/binutils-gdb.git] / ld / emultempl / gld960.em
CommitLineData
252b5132
RH
1# This shell script emits a C file. -*- C -*-
2# It does some substitutions.
3cat >e${EMULATION_NAME}.c <<EOF
aef6203b 4/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005
48f6162b 5 Free Software Foundation, Inc.
252b5132
RH
6
7This file is part of GLD, the Gnu Linker.
8
9GLD is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 1, or (at your option)
12any later version.
13
14GLD is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GLD; see the file COPYING. If not, write to
75be928b 21the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
252b5132 22
0c7a8e5a 23/*
252b5132
RH
24 * emulate the Intels port of gld
25 */
26
27
28#include "bfd.h"
29#include "sysdep.h"
30#include "libiberty.h"
31#include "bfdlink.h"
32
33#include "ld.h"
252b5132
RH
34#include "ldmisc.h"
35#include "ldmain.h"
36
b71e2778
AM
37#include "ldexp.h"
38#include "ldlang.h"
39#include "ldfile.h"
40#include "ldemul.h"
41
0c7a8e5a 42static void gld960_before_parse (void)
252b5132
RH
43{
44 char *env ;
45 env = getenv("G960LIB");
46 if (env) {
b34976b6 47 ldfile_add_library_path(env, FALSE);
252b5132
RH
48 }
49 env = getenv("G960BASE");
50 if (env)
b34976b6 51 ldfile_add_library_path (concat (env, "/lib", (const char *) NULL), FALSE);
252b5132
RH
52 ldfile_output_architecture = bfd_arch_i960;
53}
54
252b5132 55static void
0c7a8e5a 56gld960_set_output_arch (void)
252b5132
RH
57{
58 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
59}
60
61static char *
0c7a8e5a 62gld960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
252b5132 63{
252b5132
RH
64 char *from_outside = getenv(TARGET_ENVIRON);
65 output_filename = "b.out";
66
67 if (from_outside != (char *)NULL)
68 return from_outside;
69
70 return "b.out.little";
252b5132
RH
71}
72
73static char *
0c7a8e5a 74gld960_get_script (int *isfile)
252b5132
RH
75EOF
76
77if test -n "$COMPILE_IN"
78then
79# Scripts compiled in.
80
81# sed commands to quote an ld script as a C string.
597e2591 82sc="-f stringify.sed"
252b5132
RH
83
84cat >>e${EMULATION_NAME}.c <<EOF
0c7a8e5a 85{
252b5132
RH
86 *isfile = 0;
87
1049f94e 88 if (link_info.relocatable && config.build_constructors)
597e2591 89 return
252b5132 90EOF
b34976b6 91sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
1049f94e 92echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
b34976b6
AM
93sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
94echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
95sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
96echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
97sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
98echo ' ; else return' >> e${EMULATION_NAME}.c
99sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
100echo '; }' >> e${EMULATION_NAME}.c
252b5132
RH
101
102else
103# Scripts read from the filesystem.
104
105cat >>e${EMULATION_NAME}.c <<EOF
0c7a8e5a 106{
252b5132
RH
107 *isfile = 1;
108
1049f94e 109 if (link_info.relocatable && config.build_constructors)
252b5132 110 return "ldscripts/${EMULATION_NAME}.xu";
1049f94e 111 else if (link_info.relocatable)
252b5132
RH
112 return "ldscripts/${EMULATION_NAME}.xr";
113 else if (!config.text_read_only)
114 return "ldscripts/${EMULATION_NAME}.xbn";
115 else if (!config.magic_demand_paged)
116 return "ldscripts/${EMULATION_NAME}.xn";
117 else
118 return "ldscripts/${EMULATION_NAME}.x";
119}
120EOF
121
122fi
123
124cat >>e${EMULATION_NAME}.c <<EOF
125
0c7a8e5a 126struct ld_emulation_xfer_struct ld_gld960_emulation =
252b5132
RH
127{
128 gld960_before_parse,
129 syslib_default,
130 hll_default,
131 after_parse_default,
132 after_open_default,
133 after_allocation_default,
134 gld960_set_output_arch,
135 gld960_choose_target,
136 before_allocation_default,
137 gld960_get_script,
138 "960",
e1c47aa4
AM
139 "",
140 NULL, /* finish */
141 NULL, /* create output section statements */
142 NULL, /* open dynamic archive */
143 NULL, /* place orphan */
144 NULL, /* set symbols */
145 NULL, /* parse args */
3bcf5557
AM
146 NULL, /* add_options */
147 NULL, /* handle_option */
e1c47aa4
AM
148 NULL, /* unrecognized file */
149 NULL, /* list options */
40d109bf 150 NULL, /* recognized file */
fac1652d
AM
151 NULL, /* find_potential_libraries */
152 NULL /* new_vers_pattern */
252b5132
RH
153};
154EOF
This page took 0.342178 seconds and 4 git commands to generate.