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. */
23 * Revision 1.1.1.1 1991/03/21 21:28:25 gumby
24 * Back from Intel with Steve
26 * Revision 1.1 1991/03/21 21:28:24 gumby
29 * Revision 1.2 1991/03/15 18:45:55 rich
32 * Revision 1.1 1991/03/13 00:48:11 chrisb
35 * Revision 1.7 1991/03/10 09:31:18 rich
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
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.
46 * Revision 1.6 1991/03/09 03:23:12 sac
47 * Added -Ur loader script.
49 * Revision 1.5 1991/03/06 21:59:29 sac
50 * Completed G++ support
52 * Revision 1.4 1991/03/06 02:23:34 sac
53 * Added support for partial linking.
55 * Revision 1.3 1991/02/22 17:14:56 sac
56 * Added RCS keywords and copyrights
61 * emulate the original gld
63 * Written by Steve Chamberlain steve@cygnus.com
77 extern boolean lang_float_flag
;
80 extern enum bfd_architecture ldfile_output_architecture
;
81 extern unsigned long ldfile_output_machine
;
82 extern char *ldfile_output_machine_name
;
84 extern bfd
*output_bfd
;
88 static void gld_before_parse()
90 ldfile_add_library_path("/lib");
91 ldfile_add_library_path("/usr/lib");
92 ldfile_add_library_path("/usr/local/lib/lib");
93 ldfile_output_architecture
= bfd_arch_sparc
;
104 gld_after_allocation()
110 gld_before_allocation()
117 gld_set_output_arch()
119 /* Set the output architecture and machine if possible */
120 unsigned long machine
= 0;
121 bfd_set_arch_mach(output_bfd
, ldfile_output_architecture
, machine
);
127 char *from_outside
= getenv(TARGET_ENVIRON
);
128 if (from_outside
!= (char *)NULL
)
136 info("%S SYSLIB ignored\n");
143 info("%S HLL ignored\n");
146 static char *gld_script
= " \
148 SEARCH_DIR(/usr/lib) \
149 SEARCH_DIR(/usr/local/lib) \
153 .text 0x2020 BLOCK(0x2000): \
155 CREATE_OBJECT_SYMBOLS \
157 _etext = ALIGN( 0x2000); \
159 .data ALIGN(0x2000) : \
163 LONG((___CTOR_LIST__ - .)/4 -2) \
167 LONG((_edata - .)/4 -2) \
172 .bss SIZEOF(.data) + ADDR(.data) : \
181 static char *gld_script_option_Ur
= "\
183 SEARCH_DIR(/usr/lib) \
184 SEARCH_DIR(/usr/local/lib) \
189 CREATE_OBJECT_SYMBOLS \
192 .data SIZEOF(.text) + ADDR(.text) : \
196 LONG((___CTOR_LIST__ - .)/4 -2) \
200 LONG((___end_list__ - .)/4 -2) \
203 ___end_list__ = . ; \
205 .bss SIZEOF(.data) + ADDR(.data) : \
213 static char *gld_script_option_r
= "\
215 SEARCH_DIR(/usr/lib) \
216 SEARCH_DIR(/usr/local/lib) \
221 CREATE_OBJECT_SYMBOLS \
224 .data SIZEOF(.text) + ADDR(.text) : \
228 .bss SIZEOF(.data) + ADDR(.data) : \
236 static char *gld_get_script()
238 extern ld_config_type config
;
239 if (config
.relocateable_output
== true &&
240 config
.build_constructors
== true) {
241 return gld_script_option_Ur
;
243 if (config
.relocateable_output
) {
244 return gld_script_option_r
;
249 struct ld_emulation_xfer_struct ld_gld_emulation
=
255 gld_after_allocation
,
258 gld_before_allocation
,