mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-23 17:29:23 +08:00
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>
This commit is contained in:
parent
d72bec12bc
commit
775153b1bf
@ -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");
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user