keep riscix, pc532mach files
[deliverable/binutils-gdb.git] / ld / ldemul.c
1 /* ldemul.c -- clearing house for ld emulation states
2 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
3
4 This file is part of GLD, the Gnu Linker.
5
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GLD; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #include "bfd.h"
21 #include "sysdep.h"
22
23 #include "config.h"
24 #include "ld.h"
25 #include "ldemul.h"
26 #include "ldmisc.h"
27 #include "ldfile.h"
28 #include "ldmain.h"
29 #include "ldemul-list.h"
30
31 ld_emulation_xfer_type *ld_emulation;
32
33 void
34 ldemul_hll(name)
35 char *name;
36 {
37 ld_emulation->hll(name);
38 }
39
40
41 void ldemul_syslib(name)
42 char *name;
43 {
44 ld_emulation->syslib(name);
45 }
46
47 void
48 ldemul_after_parse()
49 {
50 ld_emulation->after_parse();
51 }
52
53 void
54 ldemul_before_parse()
55 {
56 ld_emulation->before_parse();
57 }
58
59 void
60 ldemul_after_allocation()
61 {
62 ld_emulation->after_allocation();
63 }
64
65 void
66 ldemul_before_allocation()
67 {
68 if (ld_emulation->before_allocation)
69 ld_emulation->before_allocation();
70 }
71
72
73 void
74 ldemul_set_output_arch()
75 {
76 ld_emulation->set_output_arch();
77 }
78
79 void
80 ldemul_finish()
81 {
82 if (ld_emulation->finish)
83 ld_emulation->finish();
84 }
85
86 void
87 ldemul_create_output_section_statements()
88 {
89 if (ld_emulation->create_output_section_statements)
90 ld_emulation->create_output_section_statements();
91 }
92
93 char *
94 ldemul_get_script(isfile)
95 int *isfile;
96 {
97 return ld_emulation->get_script(isfile);
98 }
99
100 char *
101 ldemul_choose_target()
102 {
103 return ld_emulation->choose_target();
104 }
105
106 /* The default choose_target function. */
107
108 char *
109 ldemul_default_target()
110 {
111 char *from_outside = getenv(TARGET_ENVIRON);
112 if (from_outside != (char *)NULL)
113 return from_outside;
114 return ld_emulation->target_name;
115 }
116
117 void
118 after_parse_default()
119 {
120
121 }
122
123 void
124 after_allocation_default()
125 {
126
127 }
128
129 void
130 before_allocation_default()
131 {
132
133 }
134
135 void
136 set_output_arch_default()
137 {
138 /* Set the output architecture and machine if possible */
139 bfd_set_arch_mach(output_bfd,
140 ldfile_output_architecture, ldfile_output_machine);
141 }
142
143 void
144 syslib_default(ignore)
145 char *ignore;
146 {
147 info_msg ("%S SYSLIB ignored\n");
148 }
149
150 void
151 hll_default(ignore)
152 char *ignore;
153 {
154 info_msg ("%S HLL ignored\n");
155 }
156
157 ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
158
159 void
160 ldemul_choose_mode(target)
161 char *target;
162 {
163 ld_emulation_xfer_type **eptr = ld_emulations;
164 /* Ignore "gld" prefix. */
165 if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd')
166 target += 3;
167 for (; *eptr; eptr++)
168 {
169 if (strcmp(target, (*eptr)->emulation_name) == 0)
170 {
171 ld_emulation = *eptr;
172 return;
173 }
174 }
175 einfo("%P%F: unrecognised emulation mode: %s\n",target);
176 }
This page took 0.032244 seconds and 4 git commands to generate.