diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2016-02-05 11:34:07 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2016-02-05 11:34:07 -0800 |
commit | ae01785d872d3271d749a0866031d2d867120234 (patch) | |
tree | f8901627720ff90ff12dee50c970d0fd8892290a | |
parent | 5482a15e17cfc80379052253003e5a6b0cd46f14 (diff) | |
download | nasm-ae01785d872d3271d749a0866031d2d867120234.tar.gz |
LLVM portability fix for abs(size)
size is actually an uint64_t, and LLVM drops the abs() on the
principle that the uint64_t should always be positive. Make it
explicit that we are converting to a signed integer first, by using
abs((int)size) instead.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | listing.c | 2 | ||||
-rw-r--r-- | output/outaout.c | 2 | ||||
-rw-r--r-- | output/outas86.c | 2 | ||||
-rw-r--r-- | output/outbin.c | 2 | ||||
-rw-r--r-- | output/outcoff.c | 4 | ||||
-rw-r--r-- | output/outelf32.c | 2 | ||||
-rw-r--r-- | output/outelf64.c | 2 | ||||
-rw-r--r-- | output/outelfx32.c | 2 | ||||
-rw-r--r-- | output/outieee.c | 2 | ||||
-rw-r--r-- | output/outmac32.c | 2 | ||||
-rw-r--r-- | output/outmac64.c | 2 | ||||
-rw-r--r-- | output/outobj.c | 2 | ||||
-rw-r--r-- | output/outrdf2.c | 2 |
13 files changed, 14 insertions, 14 deletions
@@ -216,7 +216,7 @@ static void list_output(int32_t offset, const void *data, break; } case OUT_ADDRESS: - list_address(offset, "[]", *(int64_t *)data, abs(size)); + list_address(offset, "[]", *(int64_t *)data, abs((int)size)); break; case OUT_REL1ADR: list_address(offset, "()", *(int64_t *)data, 1); diff --git a/output/outaout.c b/output/outaout.c index 575089c6..1b2b2191 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -634,7 +634,7 @@ static void aout_out(int32_t segto, const void *data, nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); aout_sect_write(s, data, size); } else if (type == OUT_ADDRESS) { - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; if (segment != NO_SEG) { if (segment % 2) { diff --git a/output/outas86.c b/output/outas86.c index a800e90f..892362b6 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -347,7 +347,7 @@ 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); + int asize = abs((int)size); if (segment != NO_SEG) { if (segment % 2) { nasm_error(ERR_NONFATAL, "as86 format does not support" diff --git a/output/outbin.c b/output/outbin.c index 77a9778f..c64daaaf 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -765,7 +765,7 @@ static void bin_out(int32_t segto, const void *data, switch (type) { case OUT_ADDRESS: { - int asize = abs(size); + int asize = abs((int)size); if (segment != NO_SEG && !find_section_by_index(segment)) { if (segment % 2) diff --git a/output/outcoff.c b/output/outcoff.c index b45e4f16..73ba13e3 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -611,7 +611,7 @@ static void coff_out(int32_t segto, const void *data, dinfo.section = s; if (type == OUT_ADDRESS) - dinfo.size = abs(size); + dinfo.size = abs((int)size); else dinfo.size = realsize(type, size); @@ -630,7 +630,7 @@ static void coff_out(int32_t segto, const void *data, nasm_error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); coff_sect_write(s, data, size); } else if (type == OUT_ADDRESS) { - int asize = abs(size); + int asize = abs((int)size); if (!win64) { if (asize != 4 && (segment != NO_SEG || wrt != NO_SEG)) { nasm_error(ERR_NONFATAL, "COFF format does not support non-32-bit" diff --git a/output/outelf32.c b/output/outelf32.c index 4489d401..7ac78050 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -730,7 +730,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_ADDRESS: { bool gnu16 = false; - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; if (segment != NO_SEG) { if (segment % 2) { diff --git a/output/outelf64.c b/output/outelf64.c index 41243b1e..3c3e921a 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -746,7 +746,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_ADDRESS: { int isize = (int)size; - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; if (segment == NO_SEG) { diff --git a/output/outelfx32.c b/output/outelfx32.c index 3eeb224f..33972b41 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -745,7 +745,7 @@ static void elf_out(int32_t segto, const void *data, case OUT_ADDRESS: { int isize = (int)size; - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; if (segment == NO_SEG) { diff --git a/output/outieee.c b/output/outieee.c index 56060db1..d42a6fd8 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -438,7 +438,7 @@ static void ieee_out(int32_t segto, const void *data, } else if (type == OUT_ADDRESS || type == OUT_REL2ADR || type == OUT_REL4ADR) { if (type == OUT_ADDRESS) - size = abs(size); + size = abs((int)size); else if (segment == NO_SEG) nasm_error(ERR_NONFATAL, "relative call to absolute address not" " supported by IEEE format"); diff --git a/output/outmac32.c b/output/outmac32.c index 0ed88c99..873ed7e1 100644 --- a/output/outmac32.c +++ b/output/outmac32.c @@ -434,7 +434,7 @@ static void macho_output(int32_t secto, const void *data, case OUT_ADDRESS: { - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; diff --git a/output/outmac64.c b/output/outmac64.c index d1a0a5c0..9a4fb4bd 100644 --- a/output/outmac64.c +++ b/output/outmac64.c @@ -536,7 +536,7 @@ static void macho_output(int32_t secto, const void *data, case OUT_ADDRESS: { - int asize = abs(size); + int asize = abs((int)size); addr = *(int64_t *)data; if (section != NO_SEG) { diff --git a/output/outobj.c b/output/outobj.c index 6b173eb9..c9f40094 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1087,7 +1087,7 @@ static void obj_out(int32_t segto, const void *data, int rsize; if (type == OUT_ADDRESS) - size = abs(size); + size = abs((int)size); if (segment == NO_SEG && type != OUT_ADDRESS) nasm_error(ERR_NONFATAL, "relative call to absolute address not" diff --git a/output/outrdf2.c b/output/outrdf2.c index fdac5ee3..884cdf44 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -583,7 +583,7 @@ static void rdf2_out(int32_t segto, const void *data, membufwrite(segto, data, size); } else if (type == OUT_ADDRESS) { - int asize = abs(size); + int asize = abs((int)size); /* if segment == NO_SEG then we are writing an address of an object within the same segment - do not produce reloc rec. */ |