From 2543860d190706fb3e13812c02e9f68041a93e98 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Sat, 28 Oct 1995 07:26:10 +0000 Subject: [PATCH] Sat Oct 28 00:10:03 1995 steve chamberlain * emultempl/pe.em (gld_${EMULATION_NAME}_parse_args): Don't hang if last option is unrecognised. (gld_${EMULATION_NAME}_set_symbols): Insert created symbols into ABS output section. --- ld/ChangeLog | 7 +++++++ ld/emultempl/pe.em | 38 +++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 754a575f0c4..5a5c20e78f9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +Sat Oct 28 00:10:03 1995 steve chamberlain + + * emultempl/pe.em (gld_${EMULATION_NAME}_parse_args): + Don't hang if last option is unrecognised. + (gld_${EMULATION_NAME}_set_symbols): Insert created + symbols into ABS output section. + Fri Oct 27 18:03:17 1995 Niklas Hallqvist * Makefile.in (ALL_EMULATIONS): Added support for the NetBSD diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 9e9a590e95f..4fa9fad08de 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfdlink.h" #include "getopt.h" #include "ld.h" -#include "config.h" #include "ld.h" #include "ldmain.h" #include "ldgram.h" @@ -166,11 +165,11 @@ set_pe_subsystem () } v[] = { - {"native", BFD_PE_NATIVE}, - {"windows",BFD_PE_WINDOWS}, - {"console",BFD_PE_CONSOLE}, - {"os2",BFD_PE_OS2}, - {"posix", BFD_PE_POSIX}, + {"native", 1}, + {"windows",2}, + {"console",3}, + {"os2",5}, + {"posix", 7}, {0,0} }; @@ -233,13 +232,24 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) int optc; int prevoptind = optind; int prevopterr = opterr; - opterr = 0; + int wanterror; + static int lastoptind = -1; + + if (lastoptind != optind) + opterr = 0; + wanterror = opterr; + + lastoptind = optind; + optc = getopt_long_only (argc, argv, "-", longopts, &longind); opterr = prevopterr; + switch (optc) { default: - optind = prevoptind; + if (wanterror) + xexit (1); + optind = prevoptind; return 0; case OPTION_BASE_FILE: @@ -272,7 +282,7 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) set_pe_value ("__major_subsystem_version__"); break; case OPTION_MINOR_SUBSYSTEM_VERSION: - set_pe_value ("__minor_subsytem_version__"); + set_pe_value ("__minor_subsystem_version__"); break; case OPTION_MAJOR_IMAGE_VERSION: set_pe_value ("__major_image_version__"); @@ -299,15 +309,19 @@ gld_${EMULATION_NAME}_parse_args(argc, argv) static void gld_${EMULATION_NAME}_set_symbols() { - /* Run through and invent symbols for all the names and insert the defaults. */ int j; + lang_statement_list_type *save; if (!init[IMAGEBASEOFF].inited) init[IMAGEBASEOFF].value = init[DLLOFF].value ? NT_DLL_IMAGE_BASE : NT_EXE_IMAGE_BASE; + /* Glue the assignments into the abs section */ + save=stat_ptr; + + stat_ptr = &(abs_output_section->children); for (j = 0; init[j].ptr; j++) { long val = init[j].value; @@ -320,7 +334,9 @@ gld_${EMULATION_NAME}_set_symbols() *(long *)init[j].ptr = val; else abort(); } - + /* Restore the pointer. */ + stat_ptr = save; + if (pe.FileAlignment > pe.SectionAlignment) { -- 2.30.2