1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 cat >e${EMULATION_NAME}.c <<EOF
5 /* This file is a copy of ei385coff which was originally generated on a Linux
6 system. It has been modified to provide a decent default script file
7 for the NT PE format. */
9 /* The original file generated returned different default scripts depending
10 on whether certain switches were set, but these switches pertain to the
11 Linux system and that particular version of coff. In the NT case, we
12 only determine if the subsystem is console or windows in order to select
13 the correct entry point by default. */
16 /* emulate the original gld for the given i386pe
17 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
18 Written by Steve Chamberlain steve@cygnus.com
20 This file is part of GLD, the Gnu Linker.
22 This program is free software; you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation; either version 2 of the License, or
25 (at your option) any later version.
27 This program is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
32 You should have received a copy of the GNU General Public License
33 along with this program; if not, write to the Free Software
34 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
36 #define TARGET_IS_i386pe
49 static void gldi386pe_before_parse PARAMS ((void));
50 static char *gldi386pe_get_script PARAMS ((int *isfile));
53 gldi386pe_before_parse()
55 #ifndef TARGET_ /* I.e., if not generic. */
56 ldfile_output_architecture = bfd_arch_i386;
57 #endif /* not TARGET_ */
61 gldi386pe_get_script(isfile)
66 if (link_info.subsystem == windows)
68 "OUTPUT_FORMAT(\"coff-i386\")\n\
69 SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/i386-coff/lib);\n\
70 ENTRY(_WinMainCRTStartup)\n\
77 .bss BLOCK(0x1000) :\n\
83 .rdata BLOCK(0x1000) :\n\
88 .data BLOCK(0x1000) : {\n\
93 .idata BLOCK(0x1000) :\n\
103 .CRT BLOCK(0x1000) :\n\
120 .rsrc BLOCK(0x1000) :\n\
126 .reloc BLOCK(0x1000) :\n\
131 .junk BLOCK(0x1000) :\n\
141 "OUTPUT_FORMAT(\"coff-i386\")\n\
142 SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/i386-coff/lib);\n\
143 ENTRY(_mainCRTStartup)\n\
146 .text 0x401000 : {\n\
150 .bss BLOCK(0x1000) :\n\
156 .rdata BLOCK(0x1000) :\n\
161 .data BLOCK(0x1000) : {\n\
166 .idata BLOCK(0x1000) :\n\
176 .CRT BLOCK(0x1000) :\n\
193 .rsrc BLOCK(0x1000) :\n\
199 .reloc BLOCK(0x1000) :\n\
204 .junk BLOCK(0x1000) :\n\
216 struct ld_emulation_xfer_struct ld_i386pe_emulation =
218 gldi386pe_before_parse,
222 after_allocation_default,
223 set_output_arch_default,
224 ldemul_default_target,
225 before_allocation_default,
226 gldi386pe_get_script,