Initial revision
[deliverable/binutils-gdb.git] / ld / ld-gld960.c
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 $Log$
23 Revision 1.1 1991/03/21 21:28:26 gumby
24 Initial revision
25
26 * Revision 1.3 1991/03/16 22:27:24 rich
27 * fish
28 *
29 * Revision 1.2 1991/03/15 18:45:55 rich
30 * foo
31 *
32 * Revision 1.1 1991/03/13 00:48:12 chrisb
33 * Initial revision
34 *
35 * Revision 1.4 1991/03/10 09:31:19 rich
36 * Modified Files:
37 * Makefile config.h ld-emul.c ld-emul.h ld-gld.c ld-gld960.c
38 * ld-lnk960.c ld.h lddigest.c ldexp.c ldexp.h ldfile.c ldfile.h
39 * ldgram.y ldinfo.h ldlang.c ldlang.h ldlex.h ldlex.l ldmain.c
40 * ldmain.h ldmisc.c ldmisc.h ldsym.c ldsym.h ldversion.c
41 * ldversion.h ldwarn.h ldwrite.c ldwrite.h y.tab.h
42 *
43 * As of this round of changes, ld now builds on all hosts of (Intel960)
44 * interest and copy passes my copy test on big endian hosts again.
45 *
46 * Revision 1.3 1991/02/22 17:14:57 sac
47 * Added RCS keywords and copyrights
48 *
49 */
50
51 /*
52 * emulate the Intels port of gld
53 */
54
55
56 #include "sysdep.h"
57 #include "bfd.h"
58
59
60 #include "ld.h"
61 #include "config.h"
62 #include "ld-emul.h"
63 #include "ldfile.h"
64 #include "ldmisc.h"
65
66
67 /* IMPORTS */
68 extern char *output_filename;
69 extern boolean lang_float_flag;
70
71
72 extern enum bfd_architecture ldfile_output_architecture;
73 extern unsigned long ldfile_output_machine;
74 extern char *ldfile_output_machine_name;
75
76 extern bfd *output_bfd;
77
78
79
80 static void gld960_before_parse()
81 {
82 char *env ;
83 env = getenv("G960LIB");
84 if (env) {
85 ldfile_add_library_path(env);
86 }
87 env = getenv("G960BASE");
88 if (env) {
89 ldfile_add_library_path(concat(env,"/lib",""));
90 }
91 ldfile_output_architecture = bfd_arch_i960;
92 }
93
94
95 static void
96 gld960_after_parse()
97 {
98
99 }
100
101 static void
102 gld960_after_allocation()
103 {
104
105 }
106
107 static void
108 gld960_before_allocation()
109 {
110
111 }
112
113
114 static void
115 gld960_set_output_arch()
116 {
117 /* Set the output architecture and machine if possible */
118 unsigned long machine = 0;
119 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
120 }
121
122 static char *
123 gld960_choose_target()
124 {
125 char *from_outside = getenv(TARGET_ENVIRON);
126 output_filename = "b.out";
127
128 if (from_outside != (char *)NULL)
129 return from_outside;
130 return GLD960_TARGET;
131 }
132
133 static void
134 gld960_syslib()
135 {
136 info("%S SYSLIB ignored\n");
137 }
138
139 static void
140 gld960_hll()
141 {
142 info("%S HLL ignored\n");
143 }
144
145
146 static char *script = "\
147 \
148 SECTIONS \
149 { \
150 .text : \
151 { \
152 CREATE_OBJECT_SYMBOLS \
153 *(.text) \
154 _etext =.;\
155 } \
156 \
157 .data SIZEOF(.text) + ADDR(.text):\
158 { \
159 \
160 *(.data) \
161 _edata = .; \
162 } \
163 .bss SIZEOF(.data) + ADDR(.data) : \
164 { _bss_start = .;\
165 *(.bss) \
166 [COMMON] \
167 _end = . ; \
168 } \
169 } \
170 ";
171
172 static char *
173 gld960_get_script()
174 {
175 return script;
176 }
177
178 struct ld_emulation_xfer_struct ld_gld960_emulation =
179 {
180 gld960_before_parse,
181 gld960_syslib,
182 gld960_hll,
183 gld960_after_parse,
184 gld960_after_allocation,
185 gld960_set_output_arch,
186 gld960_choose_target,
187 gld960_before_allocation,
188 gld960_get_script,
189 };
This page took 0.034716 seconds and 4 git commands to generate.