Tue Feb 9 08:18:07 1993 Ian Lance Taylor (ian@cygnus.com)
[deliverable/binutils-gdb.git] / ld / gld960.em
CommitLineData
d73812a1 1cat >em_${EMULATION_NAME}.c <<EOF
6ecb2b74
PB
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;
94cc1ee7 107
94cc1ee7 108 return "b.out.little";
6ecb2b74
PB
109
110#endif
111}
112
113static char *script =
114#include "gld960.x"
115;
116
3d2b83ea
SC
117
118static char *script_reloc =
119#include "gld960.xr"
120 ;
121
6ecb2b74
PB
122
123static char *
124gld960_get_script()
125{
3d2b83ea
SC
126 extern ld_config_type config;
127 if (config.relocateable_output)
128 return script_reloc;
129 return script;
130
6ecb2b74
PB
131}
132
133struct ld_emulation_xfer_struct ld_gld960_emulation =
134{
135 gld960_before_parse,
136 syslib_default,
137 hll_default,
138 after_parse_default,
139 after_allocation_default,
140 gld960_set_output_arch,
141 gld960_choose_target,
142 before_allocation_default,
143 gld960_get_script,
d5a13d8e 144 "960",
6ecb2b74
PB
145 ""
146};
147EOF
This page took 0.046531 seconds and 4 git commands to generate.