This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / ld / ld-gld68k.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
23 /*
24 * emulate the original gld running on a 68k system
25 *
26 * Written by Steve Chamberlain steve@cygnus.com
27 */
28
29
30 #include "sysdep.h"
31 #include "bfd.h"
32
33 #include "ld.h"
34 #include "config.h"
35 #include "ld-emul.h"
36 #include "ldfile.h"
37 #include "ldmisc.h"
38
39 extern boolean lang_float_flag;
40
41
42 extern enum bfd_architecture ldfile_output_architecture;
43 extern unsigned long ldfile_output_machine;
44 extern char *ldfile_output_machine_name;
45
46 extern bfd *output_bfd;
47
48
49
50 static void gld68k_before_parse()
51 {
52 ldfile_add_library_path("/lib");
53 ldfile_add_library_path("/usr/lib");
54 ldfile_add_library_path("/usr/local/lib/lib");
55 ldfile_output_architecture = bfd_arch_m68k;
56 }
57
58
59 static void
60 gld68k_after_parse()
61 {
62
63 }
64
65 static void
66 gld68k_after_allocation()
67 {
68
69 }
70
71 static void
72 gld68k_before_allocation()
73 {
74
75 }
76
77
78 static void
79 gld68k_set_output_arch()
80 {
81 /* Set the output architecture and machine if possible */
82 unsigned long machine = 0;
83 bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
84 }
85
86 static char *
87 gld68k_choose_target()
88 {
89 char *from_outside = getenv(TARGET_ENVIRON);
90 if (from_outside != (char *)NULL)
91 return from_outside;
92 return GLD68K_TARGET;
93 }
94
95 static void
96 gld68k_syslib()
97 {
98 info("%S SYSLIB ignored\n");
99 }
100
101 static void
102 gld68k_hll(ignore)
103 char *ignore;
104 {
105 info("%S HLL ignored\n");
106 }
107
108 static char *gld68k_script = " \
109 SEARCH_DIR(/lib) \
110 SEARCH_DIR(/usr/lib) \
111 SEARCH_DIR(/usr/local/lib) \
112 __DYNAMIC = 0; \
113 SECTIONS \
114 { \
115 .text 0x2020 BLOCK(0x2000): \
116 { \
117 CREATE_OBJECT_SYMBOLS \
118 *(.text) \
119 _etext = ALIGN( 0x2000); \
120 } \
121 .data ALIGN(0x20000) : \
122 { \
123 *(.data) \
124 ___DTOR_LIST__=. ; \
125 LONG((___CTOR_LIST__ - .)/4 -2) \
126 *(___DTOR_LIST__) \
127 LONG(0) \
128 ___CTOR_LIST__=. ; \
129 LONG((_edata - .)/4 -2) \
130 *(___CTOR_LIST__) \
131 LONG(0) \
132 _edata = .; \
133 } \
134 .bss SIZEOF(.data) + ADDR(.data) : \
135 { \
136 *(.bss) \
137 [COMMON] \
138 _end=.; \
139 } \
140 }";
141
142
143 static char *gld68k_script_option_Ur = "\
144 SEARCH_DIR(/lib) \
145 SEARCH_DIR(/usr/lib) \
146 SEARCH_DIR(/usr/local/lib) \
147 SECTIONS \
148 { \
149 .text 0: \
150 { \
151 CREATE_OBJECT_SYMBOLS \
152 *(.text) \
153 } \
154 .data SIZEOF(.text) + ADDR(.text) : \
155 { \
156 *(.data) \
157 ___DTOR_LIST__=. ; \
158 LONG((___CTOR_LIST__ - .)/4 -2) \
159 *(___DTOR_LIST__) \
160 LONG(0) \
161 ___CTOR_LIST__=. ; \
162 LONG((___end_list__ - .)/4 -2) \
163 *(___CTOR_LIST__) \
164 LONG(0) \
165 ___end_list__ = . ; \
166 } \
167 .bss SIZEOF(.data) + ADDR(.data) : \
168 { \
169 *(.bss) \
170 [COMMON] \
171 } \
172 } \
173 ";
174
175 static char *gld68k_script_option_r = "\
176 SEARCH_DIR(/lib) \
177 SEARCH_DIR(/usr/lib) \
178 SEARCH_DIR(/usr/local/lib) \
179 SECTIONS \
180 { \
181 .text 0: \
182 { \
183 CREATE_OBJECT_SYMBOLS \
184 *(.text) \
185 } \
186 .data SIZEOF(.text) + ADDR(.text) : \
187 { \
188 *(.data) \
189 } \
190 .bss SIZEOF(.data) + ADDR(.data) : \
191 { \
192 *(.bss) \
193 [COMMON] \
194 } \
195 } \
196 ";
197
198 static char *gld68k_get_script()
199 {
200 extern ld_config_type config;
201 if (config.relocateable_output == true &&
202 config.build_constructors == true) {
203 return gld68k_script_option_Ur;
204 }
205 if (config.relocateable_output) {
206 return gld68k_script_option_r;
207 }
208
209 return gld68k_script;
210 }
211 struct ld_emulation_xfer_struct ld_gld68k_emulation =
212 {
213 gld68k_before_parse,
214 gld68k_syslib,
215 gld68k_hll,
216 gld68k_after_parse,
217 gld68k_after_allocation,
218 gld68k_set_output_arch,
219 gld68k_choose_target,
220 gld68k_before_allocation,
221 gld68k_get_script,
222 };
223
This page took 0.03428 seconds and 5 git commands to generate.