Commit | Line | Data |
---|---|---|
82e643ec SC |
1 | /* NOTE: If there are angle brackets here: I386AOUT then this is a |
2 | * template file (ldtemplate), intended for processing by sed. | |
3 | * Otherwise, this file has already been processed by sed, | |
4 | * and customized for a particular emulation target. | |
5 | * In that DO NOT EDIT the file; edit ldtemplate instead. | |
6 | */ | |
7 | ||
8 | /* emulate the original gld for the given I386AOUT | |
9 | Copyright (C) 1991 Free Software Foundation, Inc. | |
10 | Written by Steve Chamberlain steve@cygnus.com | |
11 | ||
12 | This file is part of GLD, the Gnu Linker. | |
13 | ||
14 | This program is free software; you can redistribute it and/or modify | |
15 | it under the terms of the GNU General Public License as published by | |
16 | the Free Software Foundation; either version 2 of the License, or | |
17 | (at your option) any later version. | |
18 | ||
19 | This program is distributed in the hope that it will be useful, | |
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | GNU General Public License for more details. | |
23 | ||
24 | You should have received a copy of the GNU General Public License | |
25 | along with this program; if not, write to the Free Software | |
26 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
27 | ||
28 | /* | |
29 | * $Id:# | |
30 | */ | |
31 | ||
32 | #define TARGET_IS_I386AOUT | |
33 | ||
34 | ||
35 | #include "bfd.h" | |
36 | #include "sysdep.h" | |
37 | #include "ld.h" | |
38 | #include "config.h" | |
39 | #include "ldemul.h" | |
40 | #include "ldfile.h" | |
41 | #include "ldmisc.h" | |
42 | ||
43 | extern boolean lang_float_flag; | |
44 | ||
45 | ||
46 | extern enum bfd_architecture ldfile_output_architecture; | |
47 | extern unsigned long ldfile_output_machine; | |
48 | extern char *ldfile_output_machine_name; | |
49 | ||
50 | extern bfd *output_bfd; | |
51 | ||
52 | ||
53 | ||
54 | static void gldi386aout_before_parse() | |
55 | { | |
56 | #ifdef TARGET_IS_M88KBCS | |
57 | extern char lprefix; | |
58 | lprefix = '@'; | |
59 | #else | |
60 | #ifndef TARGET_ /* I.e., if not generic */ | |
61 | ldfile_output_architecture = bfd_arch_i386; | |
62 | #endif | |
63 | #endif | |
64 | } | |
65 | ||
66 | ||
67 | static void | |
68 | gldi386aout_after_parse() | |
69 | { | |
70 | ||
71 | } | |
72 | ||
73 | static void | |
74 | gldi386aout_after_allocation() | |
75 | { | |
76 | ||
77 | } | |
78 | ||
79 | static void | |
80 | gldi386aout_before_allocation() | |
81 | { | |
82 | ||
83 | } | |
84 | ||
85 | ||
86 | static void | |
87 | gldi386aout_set_output_arch() | |
88 | { | |
89 | /* Set the output architecture and machine if possible */ | |
90 | bfd_set_arch_mach(output_bfd, | |
91 | ldfile_output_architecture, ldfile_output_machine); | |
92 | } | |
93 | ||
94 | static char * | |
95 | gldi386aout_choose_target() | |
96 | { | |
97 | char *from_outside = getenv(TARGET_ENVIRON); | |
98 | if (from_outside != (char *)NULL) | |
99 | return from_outside; | |
100 | return GLDI386AOUT_TARGET; | |
101 | } | |
102 | ||
103 | static void | |
104 | gldi386aout_syslib() | |
105 | { | |
106 | info("%S SYSLIB ignored\n"); | |
107 | } | |
108 | ||
109 | static void | |
110 | gldi386aout_hll(ignore) | |
111 | char *ignore; | |
112 | { | |
113 | info("%S HLL ignored\n"); | |
114 | } | |
115 | ||
116 | static char *gldi386aout_script = | |
117 | #include "i386aout.x" | |
118 | ; | |
119 | static char *gldi386aout_script_option_Ur = | |
120 | #include "i386aout.xu" | |
121 | ; | |
122 | static char *gldi386aout_script_option_r = | |
123 | #include "i386aout.xr" | |
124 | ; | |
125 | static char *gldi386aout_script_option_n = /* Used with -n flag. */ | |
126 | #include "i386aout.xn" | |
127 | ; | |
128 | static char *gldi386aout_script_option_N = /* Used with -N flag. */ | |
129 | #include "i386aout.xN" | |
130 | ; | |
131 | ||
132 | static char *gldi386aout_get_script() | |
133 | { | |
134 | extern ld_config_type config; | |
135 | if (config.relocateable_output == true && | |
136 | config.build_constructors == true) { | |
137 | return gldi386aout_script_option_Ur; | |
138 | } | |
139 | if (config.relocateable_output == true) { | |
140 | return gldi386aout_script_option_r; | |
141 | } | |
142 | if (!config.text_read_only) | |
143 | return gldi386aout_script_option_N; | |
144 | if (!config.magic_demand_paged) | |
145 | return gldi386aout_script_option_n; | |
146 | return gldi386aout_script; | |
147 | } | |
148 | struct ld_emulation_xfer_struct ld_gldi386aout_emulation = | |
149 | { | |
150 | gldi386aout_before_parse, | |
151 | gldi386aout_syslib, | |
152 | gldi386aout_hll, | |
153 | gldi386aout_after_parse, | |
154 | gldi386aout_after_allocation, | |
155 | gldi386aout_set_output_arch, | |
156 | gldi386aout_choose_target, | |
157 | gldi386aout_before_allocation, | |
158 | gldi386aout_get_script, | |
159 | }; |