aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-05-06 15:32:20 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-05-06 15:33:24 -0700
commitfea84d7fec9e5cc181ff148a6e49ac60cfdd8193 (patch)
tree5cb2b1d4c002fb373e25dbb9d3fb84916a711369
parent55ae12052cd110cc27fa8ef15a114b4e75fa4c24 (diff)
downloadnasm-test-fea84d7fec9e5cc181ff148a6e49ac60cfdd8193.tar.gz
nasm-test-fea84d7fec9e5cc181ff148a6e49ac60cfdd8193.tar.xz
nasm-test-fea84d7fec9e5cc181ff148a6e49ac60cfdd8193.zip
Permit short intersegment jumps
Allow an intersegment jump to be short (OUT_REL1ADR) if explicitly specified so by the user. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--assemble.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/assemble.c b/assemble.c
index 00ee78fb..3932ab02 100644
--- a/assemble.c
+++ b/assemble.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2010 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -1336,14 +1336,18 @@ static void gencode(int32_t segment, int64_t offset, int bits,
break;
case4(050):
- if (opx->segment != segment)
- errfunc(ERR_NONFATAL,
- "short relative jump outside segment");
- data = opx->offset - insn_end;
- if (data > 127 || data < -128)
- errfunc(ERR_NONFATAL, "short jump is out of range");
- bytes[0] = data;
- out(offset, segment, bytes, OUT_RAWDATA, 1, NO_SEG, NO_SEG);
+ if (opx->segment != segment) {
+ data = opx->offset;
+ out(offset, segment, &data,
+ OUT_REL1ADR, insn_end - offset,
+ opx->segment, opx->wrt);
+ } else {
+ data = opx->offset - insn_end;
+ if (data > 127 || data < -128)
+ errfunc(ERR_NONFATAL, "short jump is out of range");
+ out(offset, segment, &data,
+ OUT_ADDRESS, 1, NO_SEG, NO_SEG);
+ }
offset += 1;
break;