Thu May 7 17:01:12 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
[deliverable/binutils-gdb.git] / ld / gld960.em
CommitLineData
6ecb2b74
PB
1cat >ld__${EMULATION_NAME}.c <<EOF
2/* Copyright (C) 1991 Free Software Foundation, Inc.
3
4This file is part of GLD, the Gnu Linker.
5
6GLD is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option)
9any later version.
10
11GLD is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GLD; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/*
21 * emulate the Intels port of gld
22 */
23
24
25#include "bfd.h"
26#include "sysdep.h"
27
28
29#include "ld.h"
30#include "config.h"
31#include "ldemul.h"
32#include "ldfile.h"
33#include "ldmisc.h"
34
35
36/* IMPORTS */
37extern char *output_filename;
38extern boolean lang_float_flag;
39
40
41extern enum bfd_architecture ldfile_output_architecture;
42extern unsigned long ldfile_output_machine;
43extern char *ldfile_output_machine_name;
44
45extern bfd *output_bfd;
46
47
48
49#ifdef GNU960
50
51static void
52gld960_before_parse()
53{
54 static char *env_variables[] = { "G960LIB", "G960BASE", 0 };
55 char **p;
56 char *env ;
57
58 for ( p = env_variables; *p; p++ ){
59 env = (char *) getenv(*p);
60 if (env) {
61 ldfile_add_library_path(concat(env,"/lib/libbout",""));
62 }
63 }
64 ldfile_output_architecture = bfd_arch_i960;
65}
66
67#else /* not GNU960 */
68
69static void gld960_before_parse()
70{
71 char *env ;
72 env = getenv("G960LIB");
73 if (env) {
74 ldfile_add_library_path(env);
75 }
76 env = getenv("G960BASE");
77 if (env) {
78 ldfile_add_library_path(concat(env,"/lib",""));
79 }
80 ldfile_output_architecture = bfd_arch_i960;
81}
82
83#endif /* GNU960 */
84
85
86static void
87gld960_set_output_arch()
88{
89 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
90}
91
92static char *
93gld960_choose_target()
94{
95#ifdef GNU960
96
97 output_filename = "b.out";
98 return bfd_make_targ_name(BFD_BOUT_FORMAT, 0);
99
100#else
101
102 char *from_outside = getenv(TARGET_ENVIRON);
103 output_filename = "b.out";
104
105 if (from_outside != (char *)NULL)
106 return from_outside;
107 return "b.out.big";
108
109#endif
110}
111
112static char *script =
113#include "gld960.x"
114;
115
3d2b83ea
SC
116
117static char *script_reloc =
118#include "gld960.xr"
119 ;
120
6ecb2b74
PB
121
122static char *
123gld960_get_script()
124{
3d2b83ea
SC
125 extern ld_config_type config;
126 if (config.relocateable_output)
127 return script_reloc;
128 return script;
129
6ecb2b74
PB
130}
131
132struct ld_emulation_xfer_struct ld_gld960_emulation =
133{
134 gld960_before_parse,
135 syslib_default,
136 hll_default,
137 after_parse_default,
138 after_allocation_default,
139 gld960_set_output_arch,
140 gld960_choose_target,
141 before_allocation_default,
142 gld960_get_script,
d5a13d8e 143 "960",
6ecb2b74
PB
144 ""
145};
146EOF
This page took 0.031391 seconds and 4 git commands to generate.