aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1995-06-29 00:21:00 +0000
committerSteve Chamberlain <sac@cygnus>1995-06-29 00:21:00 +0000
commitde71eb7786da1170ae4b4acabeb4c62513c19602 (patch)
treef50c70017dfe024bdec70297d164e8f34c00edcf /ld/emultempl
parent1a9924d8b3ff8222fd6bb774990455337a70a4af (diff)
downloadgdb-de71eb7786da1170ae4b4acabeb4c62513c19602.zip
gdb-de71eb7786da1170ae4b4acabeb4c62513c19602.tar.gz
gdb-de71eb7786da1170ae4b4acabeb4c62513c19602.tar.bz2
Wed Jun 28 17:11:25 1995 Steve Chamberlain <sac@slash.cygnus.com>
* ldmain.c (main): Always initialize PE info in link_info. * lexsup.c (OPTION_BASE_FILE): New option. (parse_args): Handle new option. * emulparams/armpe.sh: Output pei. * emultempl/i386pe.em: Add newline to end. * scripttempl/armpe.sc: Change output and quote the $s. * scripttempl/i386pe.sc: Change output and quote the $s.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/.Sanitize1
-rw-r--r--ld/emultempl/armpe.em230
-rw-r--r--ld/emultempl/i386pe.em3
3 files changed, 233 insertions, 1 deletions
diff --git a/ld/emultempl/.Sanitize b/ld/emultempl/.Sanitize
index e86e204..c4c059f 100644
--- a/ld/emultempl/.Sanitize
+++ b/ld/emultempl/.Sanitize
@@ -25,6 +25,7 @@ Do-first:
Things-to-keep:
README
+armpe.em
elf32.em
generic.em
gld960.em
diff --git a/ld/emultempl/armpe.em b/ld/emultempl/armpe.em
new file mode 100644
index 0000000..bd9dfaa
--- /dev/null
+++ b/ld/emultempl/armpe.em
@@ -0,0 +1,230 @@
+# This shell script emits a C file. -*- C -*-
+# It does some substitutions.
+cat >e${EMULATION_NAME}.c <<EOF
+/* For WINDOWS_NT */
+/* This file is a copy of ei385coff which was originally generated on a Linux
+ system. It has been modified to provide a decent default script file
+ for the NT PE format. */
+
+/* The original file generated returned different default scripts depending
+ on whether certain switches were set, but these switches pertain to the
+ Linux system and that particular version of coff. In the NT case, we
+ only determine if the subsystem is console or windows in order to select
+ the correct entry point by default. */
+
+
+/* emulate the original gld for the given armpe
+ Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+ Written by Steve Chamberlain steve@cygnus.com
+
+This file is part of GLD, the Gnu Linker.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define TARGET_IS_armpe
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+
+#include "ld.h"
+#include "config.h"
+#include "ldmain.h"
+#include "ldemul.h"
+#include "ldfile.h"
+#include "ldmisc.h"
+
+static void gldarmpe_before_parse PARAMS ((void));
+static char *gldarmpe_get_script PARAMS ((int *isfile));
+
+static void
+gldarmpe_before_parse()
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_output_architecture = bfd_arch_arm;
+#endif /* not TARGET_ */
+}
+
+static char *
+gldarmpe_get_script(isfile)
+ int *isfile;
+{
+ *isfile = 0;
+
+ if (link_info.subsystem == windows)
+ return
+"OUTPUT_FORMAT(\"coff-arm\")\n\
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/arm-coff/lib);\n\
+ENTRY(_WinMainCRTStartup)\n\
+SECTIONS\n\
+{\n\
+ .text 0x401000 : {\n\
+ *(.text)\n\
+ ;\n\
+ }\n\
+ .bss BLOCK(0x1000) :\n\
+ { \n\
+ *(.bss)\n\
+ *(COMMON)\n\
+ ;\n\
+ }\n\
+ .rdata BLOCK(0x1000) :\n\
+ { \n\
+ *(.rdata)\n\
+ ;\n\
+ }\n\
+ .data BLOCK(0x1000) : {\n\
+ *(.data)\n\
+ *(.data2)\n\
+ ;\n\
+ }\n\
+ .idata BLOCK(0x1000) :\n\
+ { \n\
+ *(.idata\$\2)\n\
+ *(.idata\$\3)\n\
+ *(.idata\$\4)\n\
+ *(.idata\$\5)\n\
+ *(.idata\$\6)\n\
+ *(.idata\$\7)\n\
+ ;\n\
+ }\n\
+ .CRT BLOCK(0x1000) :\n\
+ { \n\
+ *(".CRT\$XCA")\n\
+ *(fucl .CRT\$XCC)\n\
+ *(.CRT\$XCZ)\n\
+ *(.CRT\$XIA)\n\
+ *(.CRT\$XIC)\n\
+ *(.CRT\$XIZ)\n\
+ *(.CRT\$XLA)\n\
+ *(.CRT\$XLZ)\n\
+ *(.CRT\$XPA)\n\
+ *(.CRT\$XPX)\n\
+ *(.CRT\$XPZ)\n\
+ *(.CRT\$XTA)\n\
+ *(.CRT\$XTZ)\n\
+ ;\n\
+ }\n\
+ .rsrc BLOCK(0x1000) :\n\
+ { \n\
+ *(.rsrc\$01)\n\
+ *(.rsrc\$02)\n\
+ ;\n\
+ }\n\
+ .reloc BLOCK(0x1000) :\n\
+ { \n\
+ *(.reloc)\n\
+ ;\n\
+ }\n\
+ .junk BLOCK(0x1000) :\n\
+ { \n\
+ *(.debug\$S)\n\
+ *(.debug\$T)\n\
+ *(.debug\$F)\n\
+ *(.drectve)\n\
+ ;\n\
+ }\n\
+}\n\n"
+ ; else return
+"OUTPUT_FORMAT(\"coff-arm\")\n\
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/arm-coff/lib);\n\
+ENTRY(_mainCRTStartup)\n\
+SECTIONS\n\
+{\n\
+ .text 0x401000 : {\n\
+ *(.text)\n\
+ ;\n\
+ }\n\
+ .bss BLOCK(0x1000) :\n\
+ { \n\
+ *(.bss)\n\
+ *(COMMON)\n\
+ ;\n\
+ }\n\
+ .rdata BLOCK(0x1000) :\n\
+ { \n\
+ *(.rdata)\n\
+ ;\n\
+ }\n\
+ .data BLOCK(0x1000) : {\n\
+ *(.data)\n\
+ *(.data2)\n\
+ ;\n\
+ }\n\
+ .idata BLOCK(0x1000) :\n\
+ { \n\
+ *(.idata\$\2)\n\
+ *(.idata\$\3)\n\
+ *(.idata\$\4)\n\
+ *(.idata\$\5)\n\
+ *(.idata\$\6)\n\
+ *(.idata\$\7)\n\
+ ;\n\
+ }\n\
+ .CRT BLOCK(0x1000) :\n\
+ { \n\
+ *(.CRT\$XCA)\n\
+ *(.CRT\$XCC)\n\
+ *(.CRT\$XCZ)\n\
+ *(.CRT\$XIA)\n\
+ *(.CRT\$XIC)\n\
+ *(.CRT\$XIZ)\n\
+ *(.CRT\$XLA)\n\
+ *(.CRT\$XLZ)\n\
+ *(.CRT\$XPA)\n\
+ *(.CRT\$XPX)\n\
+ *(.CRT\$XPZ)\n\
+ *(.CRT\$XTA)\n\
+ *(.CRT\$XTZ)\n\
+ ;\n\
+ }\n\
+ .rsrc BLOCK(0x1000) :\n\
+ { \n\
+ *(.rsrc\$01)\n\
+ *(.rsrc\$02)\n\
+ ;\n\
+ }\n\
+ .reloc BLOCK(0x1000) :\n\
+ { \n\
+ *(.reloc)\n\
+ ;\n\
+ }\n\
+ .junk BLOCK(0x1000) :\n\
+ { \n\
+ *(.debug\$S)\n\
+ *(.debug\$T)\n\
+ *(.debug\$F)\n\
+ *(.drectve)\n\
+ ;\n\
+ }\n\
+}\n\n"
+ ;
+}
+
+struct ld_emulation_xfer_struct ld_armpe_emulation =
+{
+ gldarmpe_before_parse,
+ syslib_default,
+ hll_default,
+ after_parse_default,
+ after_allocation_default,
+ set_output_arch_default,
+ ldemul_default_target,
+ before_allocation_default,
+ gldarmpe_get_script,
+ "armpe",
+ "pei-arm"
+};
+EOF \ No newline at end of file
diff --git a/ld/emultempl/i386pe.em b/ld/emultempl/i386pe.em
index a27ed40..9095ca5 100644
--- a/ld/emultempl/i386pe.em
+++ b/ld/emultempl/i386pe.em
@@ -227,4 +227,5 @@ struct ld_emulation_xfer_struct ld_i386pe_emulation =
"i386pe",
"pe-i386"
};
-EOF \ No newline at end of file
+EOF
+