summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-18 22:22:49 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-18 22:22:49 -0700
commit9b0d41ddd440bc040db8515f27e0ebe828449eca (patch)
tree1a9965f454f449f3e00108394a32abe76977d5ea
parenteef59fc328b691139bf986936846bf14a5d21555 (diff)
downloadnasm-9b0d41ddd440bc040db8515f27e0ebe828449eca.tar.gz
nasm-9b0d41ddd440bc040db8515f27e0ebe828449eca.tar.bz2
nasm-9b0d41ddd440bc040db8515f27e0ebe828449eca.zip
elf64: fix 32-bit truncations
Fix 32-bit truncations, as evidenced by the following test program: mov rax, 8080808080808080h
-rw-r--r--output/outelf64.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/output/outelf64.c b/output/outelf64.c
index 4424d81..e87d8bd 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -74,7 +74,7 @@ struct Symbol {
int32_t section; /* section ID of the symbol */
int type; /* symbol type */
int other; /* symbol visibility */
- int32_t value; /* address, or COMMON variable align */
+ int64_t value; /* address, or COMMON variable align */
int32_t size; /* size of symbol */
int32_t globnum; /* symbol table offset if global */
struct Symbol *next; /* list of globals in each section */
@@ -709,7 +709,7 @@ static void elf_add_reloc(struct Section *sect, int32_t segment, int type)
* isn't even necessarily sorted.
*/
static int32_t elf_add_gsym_reloc(struct Section *sect,
- int32_t segment, int32_t offset,
+ int32_t segment, int64_t offset,
int type, int exact)
{
struct Reloc *r;
@@ -779,7 +779,7 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
{
struct Section *s;
int32_t realbytes = type & OUT_SIZMASK;
- int32_t addr;
+ int64_t addr;
uint8_t mydata[16], *p;
int i;
static struct symlininfo sinfo;
@@ -851,7 +851,7 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
elf_sect_write(s, data, realbytes);
} else if (type == OUT_ADDRESS) {
int gnu16 = 0;
- addr = *(int32_t *)data;
+ addr = *(int64_t *)data;
if (segment != NO_SEG) {
if (segment % 2) {
error(ERR_NONFATAL, "ELF format does not support"