summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-06-07 11:34:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-06-07 11:34:28 -0700
commitb714cb27cbf8b3b158b11841875a4aa6ff71b17d (patch)
tree53d9565a954cd79c1891d528232d304ec40300c7
parent4dff757ba5f22b3ac633d7c792f720d12f4f19f8 (diff)
downloadnasm-b714cb27cbf8b3b158b11841875a4aa6ff71b17d.tar.gz
outobj: handle compilers without 64-bit switch() support
OpenWatcom, in particular, doesn't handle switch() statements with 64-bit expressions, sigh. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--output/outobj.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/output/outobj.c b/output/outobj.c
index f6601709..e62bc3f0 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -43,6 +43,7 @@
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
+#include <limits.h>
#include "nasm.h"
#include "nasmlib.h"
@@ -1099,7 +1100,10 @@ static void obj_out(int32_t segto, const void *data,
ldata -= size;
}
- switch (size) {
+ if (size > UINT_MAX)
+ size = 0;
+
+ switch ((unsigned int)size) {
default:
nasm_error(ERR_NONFATAL, "OBJ format can only handle 16- or "
"32-byte relocations");