]>
Commit | Line | Data |
---|---|---|
2fa0b342 DHW |
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 | * | |
2fa0b342 DHW |
22 | */ |
23 | ||
24 | /* | |
25 | * emulate the original gld | |
26 | * | |
27 | * Written by Steve Chamberlain [email protected] | |
28 | */ | |
29 | ||
30 | ||
31 | #include "sysdep.h" | |
32 | #include "bfd.h" | |
33 | ||
34 | ||
35 | #include "ld.h" | |
36 | #include "config.h" | |
37 | #include "ld-emul.h" | |
38 | #include "ldfile.h" | |
39 | #include "ldmisc.h" | |
40 | ||
41 | extern boolean lang_float_flag; | |
42 | ||
43 | ||
44 | extern enum bfd_architecture ldfile_output_architecture; | |
45 | extern unsigned long ldfile_output_machine; | |
46 | extern char *ldfile_output_machine_name; | |
47 | ||
48 | extern bfd *output_bfd; | |
49 | ||
50 | ||
51 | ||
52 | static void gld_before_parse() | |
53 | { | |
54 | ldfile_add_library_path("/lib"); | |
55 | ldfile_add_library_path("/usr/lib"); | |
56 | ldfile_add_library_path("/usr/local/lib/lib"); | |
2fa0b342 DHW |
57 | } |
58 | ||
59 | ||
60 | static void | |
61 | gld_after_parse() | |
62 | { | |
63 | ||
64 | } | |
65 | ||
66 | static void | |
67 | gld_after_allocation() | |
68 | { | |
69 | ||
70 | } | |
71 | ||
72 | static void | |
73 | gld_before_allocation() | |
74 | { | |
75 | ||
76 | } | |
77 | ||
78 | ||
79 | static void | |
80 | gld_set_output_arch() | |
81 | { | |
82 | /* Set the output architecture and machine if possible */ | |
a37cc0c0 | 83 | bfd_set_arch_mach(output_bfd, ldfile_output_architecture, ldfile_output_machine); |
2fa0b342 DHW |
84 | } |
85 | ||
86 | static char * | |
87 | gld_choose_target() | |
88 | { | |
89 | char *from_outside = getenv(TARGET_ENVIRON); | |
90 | if (from_outside != (char *)NULL) | |
91 | return from_outside; | |
92 | return GLD_TARGET; | |
93 | } | |
94 | ||
95 | static void | |
96 | gld_syslib() | |
97 | { | |
98 | info("%S SYSLIB ignored\n"); | |
99 | } | |
100 | ||
101 | static void | |
102 | gld_hll(ignore) | |
103 | char *ignore; | |
104 | { | |
105 | info("%S HLL ignored\n"); | |
106 | } | |
107 | ||
1418c83b SC |
108 | static char *gld_script = |
109 | #include "ld-gld.x" | |
110 | ; | |
111 | ||
112 | static char *gld_script_option_Ur = | |
113 | #include "ld-gld-Ur.x" | |
114 | ; | |
115 | ||
116 | static char *gld_script_option_r = | |
117 | #include "ld-gld-r.x" | |
118 | ; | |
2fa0b342 DHW |
119 | |
120 | static char *gld_get_script() | |
121 | { | |
122 | extern ld_config_type config; | |
123 | if (config.relocateable_output == true && | |
124 | config.build_constructors == true) { | |
125 | return gld_script_option_Ur; | |
126 | } | |
127 | if (config.relocateable_output) { | |
128 | return gld_script_option_r; | |
129 | } | |
130 | ||
131 | return gld_script; | |
132 | } | |
133 | struct ld_emulation_xfer_struct ld_gld_emulation = | |
134 | { | |
135 | gld_before_parse, | |
136 | gld_syslib, | |
137 | gld_hll, | |
138 | gld_after_parse, | |
139 | gld_after_allocation, | |
140 | gld_set_output_arch, | |
141 | gld_choose_target, | |
142 | gld_before_allocation, | |
143 | gld_get_script, | |
144 | }; | |
145 |