summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-04-06 19:12:17 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-04-06 19:12:17 +0400
commita4f98b3aabcd202d9aedb72f86c4f40fd0102871 (patch)
tree1b9e48e54966abb05b166c3d11def0c54ade9780
parent2250195a1aea0e7ffcb329563acc1dde00c14452 (diff)
parenta4b1c5c68e05e210780481a48eddf54b73289c21 (diff)
downloadnasm-a4f98b3aabcd202d9aedb72f86c4f40fd0102871.tar.gz
Merge branch 'nasm-2.09.xx'
Conflicts: nasm.h version Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--doc/changes.src9
-rw-r--r--doc/nasmdoc.src6
-rw-r--r--nasm.c12
-rw-r--r--nasm.h11
-rw-r--r--output/outform.c10
-rw-r--r--output/outform.h10
6 files changed, 41 insertions, 17 deletions
diff --git a/doc/changes.src b/doc/changes.src
index 302e9d1e..a3ba18c5 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -19,6 +19,15 @@ since 2007.
To force a specific form, use the \c{STRICT} keyword, see \k{strict}.
+\S{cl-2.09.08} Version 2.09.08
+
+\b Fix \c{__OUTPUT_FORMAT__} assignment when output driver alias
+ is used. For example when \c{-f elf} is used \c{__OUTPUT_FORMAT__}
+ must be set to \c{elf}, if \c{-f elf32} is used \c{__OUTPUT_FORMAT__}
+ must be assigned accordingly, i.e. to \c{elf32}. The rule applies to
+ all output driver aliases. See \k{ofmtm}.
+
+
\S{cl-2.09.07} Version 2.09.07
\b Fix attempts to close same file several times
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index 515a8bb2..34e83868 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -1,6 +1,6 @@
\# --------------------------------------------------------------------------
\#
-\# Copyright 1996-2010 The NASM Authors - All Rights Reserved
+\# Copyright 1996-2011 The NASM Authors - All Rights Reserved
\# See the file AUTHORS included with the NASM distribution for
\# the specific copyright holders.
\#
@@ -35,7 +35,7 @@
\#
\M{category}{Programming}
\M{title}{NASM - The Netwide Assembler}
-\M{year}{1996-2010}
+\M{year}{1996-2011}
\M{author}{The NASM Development Team}
\M{copyright_tail}{-- All Rights Reserved}
\M{license}{This document is redistributable under the license given in the file "LICENSE" distributed in the NASM archive.}
@@ -334,7 +334,7 @@ distribution archive, for the license conditions under which you may
use NASM. NASM is now under the so-called 2-clause BSD license, also
known as the simplified BSD license.
-Copyright 1996-2010 the NASM Authors - All rights reserved.
+Copyright 1996-2011 the NASM Authors - All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
diff --git a/nasm.c b/nasm.c
index c0a105b0..36be46e4 100644
--- a/nasm.c
+++ b/nasm.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2010 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2011 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -98,6 +98,7 @@ static char errname[FILENAME_MAX];
static int globallineno; /* for forward-reference tracking */
/* static int pass = 0; */
struct ofmt *ofmt = &OF_DEFAULT;
+struct ofmt_alias *ofmt_alias = NULL;
const struct dfmt *dfmt;
static FILE *error_file; /* Where to write error messages */
@@ -268,8 +269,13 @@ static void define_macros_late(void)
{
char temp[128];
+ /*
+ * In case if output format is defined by alias
+ * we have to put shortname of the alias itself here
+ * otherwise ABI backward compatibility gets broken.
+ */
snprintf(temp, sizeof(temp), "__OUTPUT_FORMAT__=%s",
- ofmt->shortname);
+ ofmt_alias ? ofmt_alias->shortname : ofmt->shortname);
pp_pre_define(temp);
}
@@ -652,7 +658,7 @@ static bool process_arg(char *p, char *q)
break;
case 'f': /* output format */
- ofmt = ofmt_find(param);
+ ofmt = ofmt_find(param, &ofmt_alias);
if (!ofmt) {
nasm_error(ERR_FATAL | ERR_NOFILE | ERR_USAGE,
"unrecognised output format `%s' - "
diff --git a/nasm.h b/nasm.h
index 069584bd..ff77553e 100644
--- a/nasm.h
+++ b/nasm.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2010 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2011 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -754,6 +754,15 @@ struct ofmt {
void (*cleanup) (int debuginfo);
};
+/*
+ * Output format driver alias
+ */
+struct ofmt_alias {
+ const char *shortname;
+ const char *fullname;
+ struct ofmt *ofmt;
+};
+
extern struct ofmt *ofmt;
extern FILE *ofile;
diff --git a/output/outform.c b/output/outform.c
index e386343e..0c8ae53b 100644
--- a/output/outform.c
+++ b/output/outform.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2011 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -47,11 +47,13 @@
#define BUILD_DRIVERS_ARRAY
#include "output/outform.h"
-struct ofmt *ofmt_find(char *name)
+struct ofmt *ofmt_find(char *name, struct ofmt_alias **ofmt_alias)
{
struct ofmt **ofp, *of;
unsigned int i;
+ *ofmt_alias = NULL;
+
/* primary targets first */
for (ofp = drivers; (of = *ofp); ofp++) {
if (!nasm_stricmp(name, of->shortname))
@@ -61,8 +63,10 @@ struct ofmt *ofmt_find(char *name)
/* lets walk thru aliases then */
for (i = 0; i < ARRAY_SIZE(ofmt_aliases); i++) {
if (ofmt_aliases[i].shortname &&
- !nasm_stricmp(name, ofmt_aliases[i].shortname))
+ !nasm_stricmp(name, ofmt_aliases[i].shortname)) {
+ *ofmt_alias = &ofmt_aliases[i];
return ofmt_aliases[i].ofmt;
+ }
}
return NULL;
diff --git a/output/outform.h b/output/outform.h
index e703d99c..4b809b7b 100644
--- a/output/outform.h
+++ b/output/outform.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2011 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -330,11 +330,7 @@ static struct ofmt *drivers[] = {
NULL
};
-static struct ofmt_alias {
- const char *shortname;
- const char *fullname;
- struct ofmt *ofmt;
-} ofmt_aliases[] = {
+static struct ofmt_alias ofmt_aliases[] = {
#ifdef OF_ELF32
{
"elf",
@@ -361,7 +357,7 @@ static struct ofmt_alias {
#endif /* BUILD_DRIVERS_ARRAY */
-struct ofmt *ofmt_find(char *);
+struct ofmt *ofmt_find(char *name, struct ofmt_alias **ofmt_alias);
struct dfmt *dfmt_find(struct ofmt *, char *);
void ofmt_list(struct ofmt *, FILE *);
void dfmt_list(struct ofmt *ofmt, FILE * fp);