A major rewrite to move the bulk of the linker into BFD so that
[deliverable/binutils-gdb.git] / ld / emultempl / m88kbcs.em
CommitLineData
a6152e39
DM
1# This shell script emits a C file. -*- C -*-
2# It does some substitutions.
3cat >em_${EMULATION_NAME}.c <<EOF
4/* This file is is generated by a shell script. DO NOT EDIT! */
5
6/* emulate the original gld for the given ${EMULATION_NAME}
4a6afc88 7 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
a6152e39
DM
8 Written by Steve Chamberlain steve@cygnus.com
9
10This file is part of GLD, the Gnu Linker.
11
12This program is free software; you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation; either version 2 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25
26#define TARGET_IS_${EMULATION_NAME}
27
28#include "bfd.h"
29#include "sysdep.h"
4a6afc88
ILT
30#include "bfdlink.h"
31
a6152e39
DM
32#include "ld.h"
33#include "config.h"
34#include "ldemul.h"
35#include "ldfile.h"
36#include "ldmisc.h"
4a6afc88 37#include "ldmain.h"
a6152e39
DM
38
39static void
40gld${EMULATION_NAME}_before_parse()
41{
4a6afc88
ILT
42 link_info.lprefix = "@";
43 link_info.lprefix_len = 1;
a6152e39
DM
44
45 ldfile_output_architecture = bfd_arch_${ARCH};
46}
47
48static char *
49gld${EMULATION_NAME}_get_script(isfile)
50 int *isfile;
51EOF
52
d59e5a47 53if test -n "$COMPILE_IN"
a6152e39
DM
54then
55# Scripts compiled in.
56
57# sed commands to quote an ld script as a C string.
58sc='s/["\\]/\\&/g
59s/$/\\n\\/
601s/^/"{/
61$s/$/n}"/
62'
63
64cat >>em_${EMULATION_NAME}.c <<EOF
65{
a6152e39
DM
66 *isfile = 0;
67
4a6afc88 68 if (link_info.relocateable == true && config.build_constructors == true)
a6152e39 69 return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
4a6afc88 70 else if (link_info.relocateable == true)
a6152e39
DM
71 return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
72 else if (!config.text_read_only)
73 return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
74 else if (!config.magic_demand_paged)
75 return `sed "$sc" ldscripts/${EMULATION_NAME}.xn`;
76 else
77 return `sed "$sc" ldscripts/${EMULATION_NAME}.x`;
78}
79EOF
80
81else
82# Scripts read from the filesystem.
83
84cat >>em_${EMULATION_NAME}.c <<EOF
85{
a6152e39
DM
86 *isfile = 1;
87
4a6afc88 88 if (link_info.relocateable == true && config.build_constructors == true)
a6152e39 89 return "ldscripts/${EMULATION_NAME}.xu";
4a6afc88 90 else if (link_info.relocateable == true)
a6152e39
DM
91 return "ldscripts/${EMULATION_NAME}.xr";
92 else if (!config.text_read_only)
93 return "ldscripts/${EMULATION_NAME}.xbn";
94 else if (!config.magic_demand_paged)
95 return "ldscripts/${EMULATION_NAME}.xn";
96 else
97 return "ldscripts/${EMULATION_NAME}.x";
98}
99EOF
100
101fi
102
103cat >>em_${EMULATION_NAME}.c <<EOF
104
105struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
106{
107 gld${EMULATION_NAME}_before_parse,
108 syslib_default,
109 hll_default,
110 after_parse_default,
111 after_allocation_default,
112 set_output_arch_default,
113 ldemul_default_target,
114 before_allocation_default,
115 gld${EMULATION_NAME}_get_script,
116 "${EMULATION_NAME}",
117 "${OUTPUT_FORMAT}"
118};
119EOF
This page took 0.043851 seconds and 4 git commands to generate.