mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-19 18:00:23 +08:00
Make "ABSOLUTE <label>" work again; code based on 0.97.
This commit is contained in:
parent
b6469d3a84
commit
d0e365d523
17
nasm.c
17
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) &&
|
||||
|
6
parser.c
6
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user