]>
Commit | Line | Data |
---|---|---|
15ed1567 SC |
1 | /* Copyright (C) 1991 Free Software Foundation, Inc. |
2 | ||
3 | This file is part of GLD, the Gnu Linker. | |
4 | ||
5 | GLD is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 1, or (at your option) | |
8 | any later version. | |
9 | ||
10 | GLD is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with GLD; see the file COPYING. If not, write to | |
17 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 | ||
19 | /* | |
20 | $Id$ | |
21 | */ | |
22 | ||
23 | /* | |
24 | * emulate the Intels port of gld | |
25 | */ | |
26 | ||
27 | ||
15ed1567 | 28 | #include "bfd.h" |
f177a611 | 29 | #include "sysdep.h" |
15ed1567 SC |
30 | |
31 | ||
32 | #include "ld.h" | |
33 | #include "config.h" | |
34 | #include "ldemul.h" | |
35 | #include "ldfile.h" | |
36 | #include "ldmisc.h" | |
37 | ||
38 | ||
39 | /* IMPORTS */ | |
40 | extern char *output_filename; | |
41 | extern boolean lang_float_flag; | |
42 | ||
43 | ||
44 | extern enum bfd_architecture ldfile_output_architecture; | |
45 | extern unsigned long ldfile_output_machine; | |
46 | extern char *ldfile_output_machine_name; | |
47 | ||
48 | extern bfd *output_bfd; | |
49 | ||
50 | ||
51 | ||
52 | #ifdef GNU960 | |
53 | ||
54 | static void | |
55 | gld960_before_parse() | |
56 | { | |
57 | static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; | |
58 | char **p; | |
59 | char *env ; | |
60 | ||
61 | for ( p = env_variables; *p; p++ ){ | |
62 | env = (char *) getenv(*p); | |
63 | if (env) { | |
64 | ldfile_add_library_path(concat(env,"/lib/libbout","")); | |
65 | } | |
66 | } | |
67 | ldfile_output_architecture = bfd_arch_i960; | |
68 | } | |
69 | ||
70 | #else /* not GNU960 */ | |
71 | ||
72 | static void gld960_before_parse() | |
73 | { | |
74 | char *env ; | |
75 | env = getenv("G960LIB"); | |
76 | if (env) { | |
77 | ldfile_add_library_path(env); | |
78 | } | |
79 | env = getenv("G960BASE"); | |
80 | if (env) { | |
81 | ldfile_add_library_path(concat(env,"/lib","")); | |
82 | } | |
83 | ldfile_output_architecture = bfd_arch_i960; | |
84 | } | |
85 | ||
86 | #endif /* GNU960 */ | |
87 | ||
88 | ||
89 | static void | |
90 | gld960_after_parse() | |
91 | { | |
92 | ||
93 | } | |
94 | ||
95 | static void | |
96 | gld960_after_allocation() | |
97 | { | |
98 | ||
99 | } | |
100 | ||
101 | static void | |
102 | gld960_before_allocation() | |
103 | { | |
104 | ||
105 | } | |
106 | ||
107 | ||
108 | static void | |
109 | gld960_set_output_arch() | |
110 | { | |
19b03b7a | 111 | bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core); |
15ed1567 SC |
112 | } |
113 | ||
114 | static char * | |
115 | gld960_choose_target() | |
116 | { | |
117 | #ifdef GNU960 | |
118 | ||
119 | output_filename = "b.out"; | |
19b03b7a | 120 | return bfd_make_targ_name(BFD_BOUT_FORMAT, 0); |
15ed1567 SC |
121 | |
122 | #else | |
123 | ||
124 | char *from_outside = getenv(TARGET_ENVIRON); | |
125 | output_filename = "b.out"; | |
126 | ||
127 | if (from_outside != (char *)NULL) | |
128 | return from_outside; | |
129 | return GLD960_TARGET; | |
130 | ||
131 | #endif | |
132 | } | |
133 | ||
134 | static void | |
135 | gld960_syslib() | |
136 | { | |
137 | info("%S SYSLIB ignored\n"); | |
138 | } | |
139 | ||
140 | static void | |
141 | gld960_hll() | |
142 | { | |
143 | info("%S HLL ignored\n"); | |
144 | } | |
145 | ||
146 | ||
147 | static char *script = | |
148 | #include "ldgld960.x" | |
149 | ; | |
150 | ||
151 | ||
152 | static char * | |
153 | gld960_get_script() | |
154 | { | |
155 | return script; | |
156 | } | |
157 | ||
158 | struct ld_emulation_xfer_struct ld_gld960_emulation = | |
159 | { | |
160 | gld960_before_parse, | |
161 | gld960_syslib, | |
162 | gld960_hll, | |
163 | gld960_after_parse, | |
164 | gld960_after_allocation, | |
165 | gld960_set_output_arch, | |
166 | gld960_choose_target, | |
167 | gld960_before_allocation, | |
168 | gld960_get_script, | |
169 | }; |