* Makefile.in: Added default definitions for HOSTING_CRT0,
[deliverable/binutils-gdb.git] / ld / ldtemplate
CommitLineData
9dcb30e3
PB
1/* NOTE: If there are angle brackets here: <TARGET> 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
2d1a2445
PB
8/* emulate the original gld for the given <TARGET>
9 Copyright (C) 1991 Free Software Foundation, Inc.
10 Written by Steve Chamberlain steve@cygnus.com
9dcb30e3
PB
11
12This file is part of GLD, the Gnu Linker.
13
2d1a2445 14This program is free software; you can redistribute it and/or modify
9dcb30e3 15it under the terms of the GNU General Public License as published by
2d1a2445
PB
16the Free Software Foundation; either version 2 of the License, or
17(at your option) any later version.
9dcb30e3 18
2d1a2445 19This program is distributed in the hope that it will be useful,
9dcb30e3
PB
20but WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22GNU General Public License for more details.
23
24You should have received a copy of the GNU General Public License
2d1a2445
PB
25along with this program; if not, write to the Free Software
26Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
9dcb30e3
PB
27
28/*
29 * $Id:#
9dcb30e3
PB
30 */
31
32#define TARGET_IS_<TARGET>
33
9dcb30e3 34
8e10cea1
SC
35#include "bfd.h"
36#include "sysdep.h"
9dcb30e3
PB
37#include "ld.h"
38#include "config.h"
39#include "ldemul.h"
40#include "ldfile.h"
41#include "ldmisc.h"
42
43extern boolean lang_float_flag;
44
45
46extern enum bfd_architecture ldfile_output_architecture;
47extern unsigned long ldfile_output_machine;
48extern char *ldfile_output_machine_name;
49
50extern bfd *output_bfd;
51
52
53
54static void gld<target>_before_parse()
55{
56#ifdef TARGET_IS_M88KBCS
57 extern char lprefix;
58 lprefix = '@';
59#else
9dcb30e3
PB
60#ifndef TARGET_ /* I.e., if not generic */
61 ldfile_output_architecture = bfd_arch_<arch>;
62#endif
63#endif
64}
65
66
67static void
68gld<target>_after_parse()
69{
70
71}
72
73static void
74gld<target>_after_allocation()
75{
76
77}
78
79static void
80gld<target>_before_allocation()
81{
82
83}
84
85
86static void
87gld<target>_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
94static char *
95gld<target>_choose_target()
96{
97 char *from_outside = getenv(TARGET_ENVIRON);
98 if (from_outside != (char *)NULL)
99 return from_outside;
100 return GLD<TARGET>_TARGET;
101}
102
103static void
104gld<target>_syslib()
105{
106 info("%S SYSLIB ignored\n");
107}
108
109static void
110gld<target>_hll(ignore)
111char *ignore;
112{
113 info("%S HLL ignored\n");
114}
115
116static char *gld<target>_script =
117#include "<ldtarget>.x"
118;
119static char *gld<target>_script_option_Ur =
120#include "<ldtarget>.xu"
121;
122static char *gld<target>_script_option_r =
123#include "<ldtarget>.xr"
124;
972e7b4b 125static char *gld<target>_script_option_n = /* Used with -n flag. */
b7e24eef
PB
126#include "<ldtarget>.xn"
127;
972e7b4b
PB
128static char *gld<target>_script_option_N = /* Used with -N flag. */
129#include "<ldtarget>.xN"
130;
9dcb30e3
PB
131
132static char *gld<target>_get_script()
133{
134 extern ld_config_type config;
135 if (config.relocateable_output == true &&
136 config.build_constructors == true) {
137 return gld<target>_script_option_Ur;
138 }
6719c75b 139 if (config.relocateable_output == true) {
9dcb30e3
PB
140 return gld<target>_script_option_r;
141 }
972e7b4b
PB
142 if (!config.text_read_only)
143 return gld<target>_script_option_N;
144 if (!config.magic_demand_paged)
b7e24eef 145 return gld<target>_script_option_n;
9dcb30e3
PB
146 return gld<target>_script;
147}
148struct ld_emulation_xfer_struct ld_gld<target>_emulation =
149{
150 gld<target>_before_parse,
151 gld<target>_syslib,
152 gld<target>_hll,
153 gld<target>_after_parse,
154 gld<target>_after_allocation,
155 gld<target>_set_output_arch,
156 gld<target>_choose_target,
157 gld<target>_before_allocation,
158 gld<target>_get_script,
159};
This page took 0.044508 seconds and 4 git commands to generate.