aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorSteve Chamberlain <sac@cygnus>1995-10-28 07:26:10 +0000
committerSteve Chamberlain <sac@cygnus>1995-10-28 07:26:10 +0000
commit2543860d190706fb3e13812c02e9f68041a93e98 (patch)
treeca99aa573c07bc358b186bf295436b46ba64fc3d /ld/emultempl
parentab1cbc674288f381fd0a6352d3cf8f9c8991ed53 (diff)
downloadgdb-2543860d190706fb3e13812c02e9f68041a93e98.zip
gdb-2543860d190706fb3e13812c02e9f68041a93e98.tar.gz
gdb-2543860d190706fb3e13812c02e9f68041a93e98.tar.bz2
Sat Oct 28 00:10:03 1995 steve chamberlain <sac@slash.cygnus.com>
* 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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/pe.em38
1 files changed, 27 insertions, 11 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9e9a590..4fa9fad 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)
{