Remove the --allow-64-bits option and make it a warning
Remove the --allow-64-bits relocation, and instead make it a
suppressible warning in the case of a zero-extended relocation, and an
error in the case of a sign-extended relocation.
Relocations which can be losslessly represented in the output format
do not issue any diagnostic at all, as there is no problem in that
case.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/nasm.c b/nasm.c
index 17ee553..e48f0a9 100644
--- a/nasm.c
+++ b/nasm.c
@@ -88,7 +88,6 @@
bool tasm_compatible_mode = false;
int pass0, passn;
int maxbits = 0;
-static bool allow_64_bit = false;
int globalrel = 0;
int globalbnd = 0;
@@ -169,6 +168,7 @@
{"lock", "lock prefix on unlockable instructions", true},
{"hle", "invalid hle prefixes", true},
{"bnd", "invalid bnd prefixes", true},
+ {"zero-reloc", "relocation zero-extended to match output format", true},
};
static bool want_usage;
@@ -618,12 +618,10 @@
enum text_options {
OPT_PREFIX,
OPT_POSTFIX,
- OPT_ALLOW_64_BIT
};
struct textargs textopts[] = {
{"prefix", OPT_PREFIX},
{"postfix", OPT_POSTFIX},
- {"allow-64-bit", OPT_ALLOW_64_BIT},
{NULL, 0}
};
@@ -981,9 +979,7 @@
}
break;
}
- case OPT_ALLOW_64_BIT:
- allow_64_bit = true;
- break;
+
default:
{
nasm_error(ERR_NONFATAL | ERR_NOFILE | ERR_USAGE,
@@ -2101,12 +2097,6 @@
"cannot specify 64-bit segment on processor below an x86-64");
i = 16;
}
- if (i != maxbits && !allow_64_bit) {
- nasm_error(ERR_NONFATAL,
- "%s output format does not support 64-bit code",
- ofmt->shortname);
- i = 16;
- }
} else {
nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_FATAL,
"`%s' is not a valid segment size; must be 16, 32 or 64",