diff options
author | H. Peter Anvin <hpa@zytor.com> | 2017-02-21 11:53:15 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2017-02-21 11:53:15 -0800 |
commit | c5cbb97db463f0bfc258b6ddad2a5fa0a23e8306 (patch) | |
tree | 64dedc517e6344aa964a3e5513951b377efdf838 | |
parent | 90303022b4390698f311f8d73f4d113157702397 (diff) | |
download | nasm-c5cbb97db463f0bfc258b6ddad2a5fa0a23e8306.tar.gz |
assemble: for relative addresses, convert *this segment* to fixed
We can remove OUT_ADDRESS relocations for absolute addresses (NO_SEG),
but for OUT_RELADDR relocations we can remove them if they point into
*our own segment*, not NO_SEG.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | asm/assemble.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/asm/assemble.c b/asm/assemble.c index caed64f0..6aee1710 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -348,6 +348,7 @@ static void out(struct out_data *data) } xdata; uint64_t size = data->size; int64_t addrval; + int32_t fixseg; /* Segment for which to produce fixed data */ if (!data->size) return; /* Nothing to do */ @@ -359,16 +360,18 @@ static void out(struct out_data *data) switch (data->type) { case OUT_ADDRESS: addrval = data->toffset; + fixseg = NO_SEG; /* Absolute address is fixed data */ goto address; case OUT_RELADDR: addrval = data->toffset - data->relbase; + fixseg = data->segment; /* Our own segment is fixed data */ goto address; address: asize = data->size; nasm_assert(asize <= 8); - if (data->tsegment == NO_SEG && data->twrt == NO_SEG) { + if (data->tsegment == fixseg && data->twrt == NO_SEG) { uint8_t *q = xdata.b; warn_overflow_out(addrval, asize, data->sign); |