keep everything that's present now
[deliverable/binutils-gdb.git] / ld / generic.em
1 # This shell script that emits a C file.
2 # It does some substitutions.
3 cat >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}
7 Copyright (C) 1991 Free Software Foundation, Inc.
8 Written by Steve Chamberlain steve@cygnus.com
9
10 This file is part of GLD, the Gnu Linker.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
25
26 #define TARGET_IS_${EMULATION_NAME}
27
28 #include "bfd.h"
29 #include "sysdep.h"
30 #include "ld.h"
31 #include "config.h"
32 #include "ldemul.h"
33 #include "ldfile.h"
34 #include "ldmisc.h"
35
36 extern boolean lang_float_flag;
37
38
39 extern enum bfd_architecture ldfile_output_architecture;
40 extern unsigned long ldfile_output_machine;
41 extern char *ldfile_output_machine_name;
42
43 static void gld${EMULATION_NAME}_before_parse()
44 {
45 #ifdef TARGET_IS_m88kbcs
46 extern char lprefix;
47 lprefix = '@';
48 #else
49 #ifndef TARGET_ /* I.e., if not generic */
50 ldfile_output_architecture = bfd_arch_${ARCH};
51 #endif
52 #endif
53 }
54
55
56 static char *gld${EMULATION_NAME}_script =
57 #include "${EMULATION_NAME}.x"
58 ;
59 static char *gld${EMULATION_NAME}_script_option_Ur =
60 #include "${EMULATION_NAME}.xu"
61 ;
62 static char *gld${EMULATION_NAME}_script_option_r =
63 #include "${EMULATION_NAME}.xr"
64 ;
65 static char *gld${EMULATION_NAME}_script_option_n = /* Used with -n flag. */
66 #include "${EMULATION_NAME}.xn"
67 ;
68 static char *gld${EMULATION_NAME}_script_option_N = /* Used with -N flag. */
69 #include "${EMULATION_NAME}.xbn"
70 ;
71
72 static char *gld${EMULATION_NAME}_get_script()
73 {
74 extern ld_config_type config;
75 if (config.relocateable_output == true &&
76 config.build_constructors == true) {
77 return gld${EMULATION_NAME}_script_option_Ur;
78 }
79 if (config.relocateable_output == true) {
80 return gld${EMULATION_NAME}_script_option_r;
81 }
82 if (!config.text_read_only)
83 return gld${EMULATION_NAME}_script_option_N;
84 if (!config.magic_demand_paged)
85 return gld${EMULATION_NAME}_script_option_n;
86 return gld${EMULATION_NAME}_script;
87 }
88 struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
89 {
90 gld${EMULATION_NAME}_before_parse,
91 syslib_default,
92 hll_default,
93 after_parse_default,
94 after_allocation_default,
95 set_output_arch_default,
96 ldemul_default_target,
97 before_allocation_default,
98 gld${EMULATION_NAME}_get_script,
99 "${EMULATION_NAME}",
100 "${OUTPUT_FORMAT}"
101 };
102 EOF
This page took 0.030878 seconds and 4 git commands to generate.