summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2015-02-21 18:54:33 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2015-02-21 21:14:28 +0300
commit775153b1bf10ac6a44c70920abd54334f79ff267 (patch)
treedad95b7cf29241c9db963227fc923bc100cae2f2
parentd72bec12bc0f9dbc1aceedb6c831d32b6e47ece1 (diff)
downloadnasm-775153b1bf10ac6a44c70920abd54334f79ff267.tar.gz
output: dbg,aout,elf32 -- Fix out for signed relocations
@size might be negative for signed relocations but its length is abs value. This is rather a fix for future use because at moment we can't hit this problems but better be on a safe side. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outaout.c4
-rw-r--r--output/outdbg.c2
-rw-r--r--output/outelf32.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/output/outaout.c b/output/outaout.c
index b9f21ec6..860b8a8b 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -677,11 +677,11 @@ static void aout_out(int32_t segto, const void *data,
}
}
p = mydata;
- if (size == 2)
+ if (asize == 2)
WRITESHORT(p, addr);
else
WRITELONG(p, addr);
- aout_sect_write(s, mydata, size);
+ aout_sect_write(s, mydata, asize);
} else if (type == OUT_REL2ADR) {
if (segment == segto)
nasm_error(ERR_PANIC, "intra-segment OUT_REL2ADR");
diff --git a/output/outdbg.c b/output/outdbg.c
index 77dcd7f9..155dbd17 100644
--- a/output/outdbg.c
+++ b/output/outdbg.c
@@ -128,7 +128,7 @@ static void dbg_out(int32_t segto, const void *data,
int id;
if (type == OUT_ADDRESS)
- fprintf(ofile, "out to %"PRIx32", len = %d: ", segto, (int)size);
+ fprintf(ofile, "out to %"PRIx32", len = %d: ", segto, (int)abs((int)size));
else
fprintf(ofile, "out to %"PRIx32", len = %"PRIu64": ", segto, size);
diff --git a/output/outelf32.c b/output/outelf32.c
index b55853ce..c1c8b82f 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -808,8 +808,8 @@ static void elf_out(int32_t segto, const void *data,
} else if (asize != 4 && segment != NO_SEG) {
nasm_error(ERR_NONFATAL, "Unsupported non-32-bit ELF relocation");
}
- WRITEADDR(p, addr, size);
- elf_sect_write(s, mydata, size);
+ WRITEADDR(p, addr, asize);
+ elf_sect_write(s, mydata, asize);
break;
}