diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-22 11:03:09 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-22 11:05:43 -0700 |
commit | 9cd543e5fd6616f3c7b4de641247a419f0435527 (patch) | |
tree | 3f4a53ea1fc6bf42f24ac8be80f55ce01d6d7f60 | |
parent | d3fcbf051d8b23b5627ee1c22d0bb4dc9eee565a (diff) | |
download | nasm-9cd543e5fd6616f3c7b4de641247a419f0435527.tar.gz |
BR 2148448: fix relative addresses in bin output
The "bin" format was misinterpreting the overloading of the "size"
argument to out(), which caused another source of 64-bit relative
offset errors.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | output/outbin.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/output/outbin.c b/output/outbin.c index b494a97b..cfa0aa60 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -798,6 +798,7 @@ static void bin_out(int32_t segto, const void *data, s->length += size; } else if (type == OUT_REL2ADR || type == OUT_REL4ADR || type == OUT_REL8ADR) { + int64_t addr = *(int64_t *)data - size; switch (type) { case OUT_REL2ADR: size = 2; @@ -824,7 +825,7 @@ static void bin_out(int32_t segto, const void *data, if (s->flags & TYPE_PROGBITS) { add_reloc(s, size, segment, segto); p = mydata; - WRITEADDR(p, *(int64_t *)data - size - s->length, size); + WRITEADDR(p, addr - s->length, size); saa_wbytes(s->contents, mydata, size); } s->length += size; |