* aoutx.h (translate_to_native_sym_flags): Set the type of a
[deliverable/binutils-gdb.git] / ld / ldemul.c
CommitLineData
4a6afc88
ILT
1/* ldemul.c -- clearing house for ld emulation states
2 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
f177a611
JG
3
4This file is part of GLD, the Gnu Linker.
5
6GLD is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
4a6afc88 8the Free Software Foundation; either version 2, or (at your option)
f177a611
JG
9any later version.
10
11GLD is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GLD; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
f177a611
JG
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"
4a6afc88
ILT
27#include "ldfile.h"
28#include "ldmain.h"
29#include "ldemul-list.h"
f177a611
JG
30
31ld_emulation_xfer_type *ld_emulation;
32
33void
34ldemul_hll(name)
4a6afc88 35 char *name;
f177a611
JG
36{
37 ld_emulation->hll(name);
38}
39
40
41void ldemul_syslib(name)
4a6afc88 42 char *name;
f177a611
JG
43{
44 ld_emulation->syslib(name);
45}
46
47void
48ldemul_after_parse()
49{
50 ld_emulation->after_parse();
51}
52
53void
54ldemul_before_parse()
55{
56 ld_emulation->before_parse();
57}
58
59void
60ldemul_after_allocation()
61{
62 ld_emulation->after_allocation();
63}
64
65void
66ldemul_before_allocation()
67{
4a6afc88 68 if (ld_emulation->before_allocation)
f177a611 69 ld_emulation->before_allocation();
f177a611
JG
70}
71
72
73void
74ldemul_set_output_arch()
75{
76 ld_emulation->set_output_arch();
77}
78
4a6afc88
ILT
79void
80ldemul_finish()
81{
82 if (ld_emulation->finish)
83 ld_emulation->finish();
84}
85
86void
87ldemul_create_output_section_statements()
88{
89 if (ld_emulation->create_output_section_statements)
90 ld_emulation->create_output_section_statements();
91}
92
93char *
94ldemul_get_script(isfile)
95 int *isfile;
96{
97 return ld_emulation->get_script(isfile);
98}
99
f177a611
JG
100char *
101ldemul_choose_target()
102{
103 return ld_emulation->choose_target();
104}
105
4a6afc88
ILT
106/* The default choose_target function. */
107
f177a611 108char *
4a6afc88 109ldemul_default_target()
f177a611 110{
4a6afc88
ILT
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
117void
118after_parse_default()
119{
120
f177a611
JG
121}
122
123void
4a6afc88
ILT
124after_allocation_default()
125{
126
127}
128
129void
130before_allocation_default()
131{
132
133}
134
135void
136set_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);
f177a611
JG
141}
142
4a6afc88
ILT
143void
144syslib_default(ignore)
145 char *ignore;
146{
147 info_msg ("%S SYSLIB ignored\n");
148}
f177a611 149
4a6afc88
ILT
150void
151hll_default(ignore)
152 char *ignore;
153{
154 info_msg ("%S HLL ignored\n");
155}
f177a611 156
4a6afc88
ILT
157ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST };
158
159void
160ldemul_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.093217 seconds and 4 git commands to generate.