1 /* Copyright (C) 1991 Free Software Foundation, Inc.
3 This file is part of GLD, the Gnu Linker.
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)
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.
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. */
24 * emulate the original gld running on a 68k system
26 * Written by Steve Chamberlain steve@cygnus.com
39 extern boolean lang_float_flag
;
42 extern enum bfd_architecture ldfile_output_architecture
;
43 extern unsigned long ldfile_output_machine
;
44 extern char *ldfile_output_machine_name
;
46 extern bfd
*output_bfd
;
50 static void gld68k_before_parse()
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
;
66 gld68k_after_allocation()
72 gld68k_before_allocation()
79 gld68k_set_output_arch()
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
);
87 gld68k_choose_target()
89 char *from_outside
= getenv(TARGET_ENVIRON
);
90 if (from_outside
!= (char *)NULL
)
98 info("%S SYSLIB ignored\n");
105 info("%S HLL ignored\n");
108 static char *gld68k_script
= " \
110 SEARCH_DIR(/usr/lib) \
111 SEARCH_DIR(/usr/local/lib) \
115 .text 0x2020 BLOCK(0x2000): \
117 CREATE_OBJECT_SYMBOLS \
119 _etext = ALIGN( 0x2000); \
121 .data ALIGN(0x20000) : \
125 LONG((___CTOR_LIST__ - .)/4 -2) \
129 LONG((_edata - .)/4 -2) \
134 .bss SIZEOF(.data) + ADDR(.data) : \
143 static char *gld68k_script_option_Ur
= "\
145 SEARCH_DIR(/usr/lib) \
146 SEARCH_DIR(/usr/local/lib) \
151 CREATE_OBJECT_SYMBOLS \
154 .data SIZEOF(.text) + ADDR(.text) : \
158 LONG((___CTOR_LIST__ - .)/4 -2) \
162 LONG((___end_list__ - .)/4 -2) \
165 ___end_list__ = . ; \
167 .bss SIZEOF(.data) + ADDR(.data) : \
175 static char *gld68k_script_option_r
= "\
177 SEARCH_DIR(/usr/lib) \
178 SEARCH_DIR(/usr/local/lib) \
183 CREATE_OBJECT_SYMBOLS \
186 .data SIZEOF(.text) + ADDR(.text) : \
190 .bss SIZEOF(.data) + ADDR(.data) : \
198 static char *gld68k_get_script()
200 extern ld_config_type config
;
201 if (config
.relocateable_output
== true &&
202 config
.build_constructors
== true) {
203 return gld68k_script_option_Ur
;
205 if (config
.relocateable_output
) {
206 return gld68k_script_option_r
;
209 return gld68k_script
;
211 struct ld_emulation_xfer_struct ld_gld68k_emulation
=
217 gld68k_after_allocation
,
218 gld68k_set_output_arch
,
219 gld68k_choose_target
,
220 gld68k_before_allocation
,