]>
Commit | Line | Data |
---|---|---|
d73812a1 | 1 | cat >em_${EMULATION_NAME}.c <<EOF |
6ecb2b74 PB |
2 | /* Copyright (C) 1991 Free Software Foundation, Inc. |
3 | ||
4 | This file is part of GLD, the Gnu Linker. | |
5 | ||
6 | GLD is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 1, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GLD is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GLD; see the file COPYING. If not, write to | |
18 | the 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 */ | |
37 | extern char *output_filename; | |
38 | extern boolean lang_float_flag; | |
39 | ||
40 | ||
41 | extern enum bfd_architecture ldfile_output_architecture; | |
42 | extern unsigned long ldfile_output_machine; | |
43 | extern char *ldfile_output_machine_name; | |
44 | ||
45 | extern bfd *output_bfd; | |
46 | ||
47 | ||
48 | ||
49 | #ifdef GNU960 | |
50 | ||
51 | static void | |
52 | gld960_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 | ||
69 | static 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 | ||
86 | static void | |
87 | gld960_set_output_arch() | |
88 | { | |
89 | bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core); | |
90 | } | |
91 | ||
92 | static char * | |
93 | gld960_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 | ||
113 | static char *script = | |
114 | #include "gld960.x" | |
115 | ; | |
116 | ||
3d2b83ea SC |
117 | |
118 | static char *script_reloc = | |
119 | #include "gld960.xr" | |
120 | ; | |
121 | ||
6ecb2b74 PB |
122 | |
123 | static char * | |
124 | gld960_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 | ||
133 | struct 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 | }; | |
147 | EOF |