summaryrefslogtreecommitdiff
path: root/output/outas86.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-11-26 18:09:56 -0800
committerH. Peter Anvin <hpa@zytor.com>2013-11-26 18:12:39 -0800
commitfd52c277dd6d768545cee39b154e706904581966 (patch)
tree57ffb4113bc8871ca3679ae765c92a1076efa297 /output/outas86.c
parent80d18b55551e43f0c3e390550ecd396b90265fd3 (diff)
downloadnasm-fd52c277dd6d768545cee39b154e706904581966.tar.gz
output: Allow OUT_ADDRESS with a negative size to mean signed relocation
This only matters for ELF64/ELFx32, at least for now. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'output/outas86.c')
-rw-r--r--output/outas86.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/output/outas86.c b/output/outas86.c
index b288637b..7af8d785 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2013 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -345,19 +345,20 @@ static void as86_out(int32_t segto, const void *data,
as86_sect_write(s, data, size);
as86_add_piece(s, 0, 0L, 0L, size, 0);
} else if (type == OUT_ADDRESS) {
+ int asize = abs(size);
if (segment != NO_SEG) {
if (segment % 2) {
nasm_error(ERR_NONFATAL, "as86 format does not support"
" segment base references");
} else {
offset = *(int64_t *)data;
- as86_add_piece(s, 1, offset, segment, size, 0);
+ as86_add_piece(s, 1, offset, segment, asize, 0);
}
} else {
p = mydata;
WRITELONG(p, *(int64_t *)data);
- as86_sect_write(s, data, size);
- as86_add_piece(s, 0, 0L, 0L, size, 0);
+ as86_sect_write(s, data, asize);
+ as86_add_piece(s, 0, 0L, 0L, asize, 0);
}
} else if (type == OUT_REL2ADR) {
if (segment == segto)