summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-05-26 18:19:19 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-05-26 18:19:19 +0000
commitd0e365d523ffb30fbc32e6a3d8dcb6958de8e617 (patch)
treeba92f3afa6c7420e57d7d3c207349619e3d35a5c
parentb6469d3a8478cbe1a644e8c4c02262513b814dee (diff)
downloadnasm-d0e365d523ffb30fbc32e6a3d8dcb6958de8e617.tar.gz
Make "ABSOLUTE <label>" work again; code based on 0.97.
-rw-r--r--nasm.c17
-rw-r--r--parser.c6
2 files changed, 12 insertions, 11 deletions
diff --git a/nasm.c b/nasm.c
index 73753921..c8b920ad 100644
--- a/nasm.c
+++ b/nasm.c
@@ -58,10 +58,11 @@ static unsigned long cpu = IF_PLEVEL; /* passed to insn_size & assemble.c */
int global_offset_changed; /* referenced in labels.c */
static loc_t location;
-int in_abs_seg; /* Flag we are in ABSOLUTE seg */
+int in_abs_seg; /* Flag we are in ABSOLUTE seg */
+long abs_seg; /* ABSOLUTE segment basis */
+long abs_offset; /* ABSOLUTE offset */
static struct RAA *offsets;
-static long abs_offset;
static struct SAA *forwrefs; /* keep track of forward references */
static struct forwrefinfo *forwref;
@@ -951,11 +952,7 @@ static void assemble_file (char *fname)
"cannot use non-relocatable expression as "
"ABSOLUTE address");
else {
- if ( reloc_seg(e) != NO_SEG ) {
- report_error(pass0==1 ? ERR_NONFATAL : ERR_PANIC,
- "non-constant expression "
- "supplied as the address to ABSOLUTE");
- }
+ abs_seg = reloc_seg(e);
abs_offset = reloc_value(e);
}
} else
@@ -1115,9 +1112,9 @@ static void assemble_file (char *fname)
{
int isext = output_ins.oprs[0].opflags & OPFLAG_EXTERN;
def_label (output_ins.label,
- output_ins.oprs[0].segment,
- output_ins.oprs[0].offset,
- NULL, FALSE, isext, ofmt, report_error);
+ output_ins.oprs[0].segment,
+ output_ins.oprs[0].offset,
+ NULL, FALSE, isext, ofmt, report_error);
}
else if (output_ins.operands == 2 &&
(output_ins.oprs[0].type & IMMEDIATE) &&
diff --git a/parser.c b/parser.c
index 2c6df95a..d0be7a46 100644
--- a/parser.c
+++ b/parser.c
@@ -19,6 +19,10 @@
#include "parser.h"
#include "float.h"
+extern int in_abs_seg; /* ABSOLUTE segment flag */
+extern long abs_seg; /* ABSOLUTE segment */
+extern long abs_offset; /* ABSOLUTE segment offset */
+
static long reg_flags[] = { /* sizes and special flags */
0, REG8, REG_AL, REG_AX, REG8, REG8, REG16, REG16, REG8, REG_CL,
REG_CREG, REG_CREG, REG_CREG, REG_CR4, REG_CS, REG_CX, REG8,
@@ -99,7 +103,7 @@ insn *parse_line (int pass, char *buffer, insn *result,
* Generally fix things. I think this is right as it is, but
* am still not certain.
*/
- ldef (result->label, location->segment,
+ ldef (result->label, in_abs_seg?abs_seg:location->segment,
location->offset, NULL, TRUE, FALSE, outfmt, errfunc);
}
}