nasm.c: add the --bits option for compatibility with 3.0x

To make it easier to run A:B testing against NASM 3.0x, which is
the whole point of this branch, add the --bits option from NASM 3.0x.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2026-03-03 08:40:49 -08:00
parent ecfc888fb7
commit 34501e1262

View file

@ -947,7 +947,8 @@ enum text_options {
OPT_KEEP_ALL,
OPT_NO_LINE,
OPT_DEBUG,
OPT_REPRODUCIBLE
OPT_REPRODUCIBLE,
OPT_BITS
};
enum need_arg {
ARG_NO,
@ -980,6 +981,7 @@ static const struct textargs textopts[] = {
{"no-line", OPT_NO_LINE, ARG_NO, 0},
{"debug", OPT_DEBUG, ARG_MAYBE, 0},
{"reproducible", OPT_REPRODUCIBLE, ARG_NO, 0},
{"bits", OPT_BITS, ARG_YES, 0},
{NULL, OPT_BOGUS, ARG_NO, 0}
};
@ -1350,6 +1352,18 @@ static bool process_arg(char *p, char *q, int pass)
case OPT_REPRODUCIBLE:
reproducible = true;
break;
case OPT_BITS:
if (pass == 2) {
int bits = strtoul(param, NULL, 10);
if (bits != 16 && bits != 32 && bits != 64) {
nasm_nonfatalf(ERR_USAGE, "invalid argument to --bits");
} else {
char cmdbuf[16];
snprintf(cmdbuf,sizeof(cmdbuf),"[bits %d]", bits);
pp_pre_command(NULL, cmdbuf);
}
}
break;
case OPT_HELP:
/* Allow --help topic without *requiring* topic */
if (!param)