summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-06-27 21:03:38 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-06-27 21:03:38 -0700
commitb45c03ab429ae417ed77232750d2d8ac2666aacf (patch)
treee656a2bd6e3373a3c75e19c35c68e5591da33134
parentb28ff3a51fbcd2fe7b6074f7553b439b014acb7b (diff)
downloadnasm-b45c03ab429ae417ed77232750d2d8ac2666aacf.tar.gz
asm: add a default-off warning for phase error in pass 1
Add a default-off warning for phase error in pass 1. This is default off because of the lateness in the release cycle, but cases where we have such instability should be investigated further. For now, the warning is here so we can debug these problems in the field. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/error.c1
-rw-r--r--asm/nasm.c20
-rw-r--r--include/error.h3
3 files changed, 20 insertions, 4 deletions
diff --git a/asm/error.c b/asm/error.c
index 3fdaa027..73db7443 100644
--- a/asm/error.c
+++ b/asm/error.c
@@ -69,6 +69,7 @@ const struct warning warnings[ERR_WARN_ALL+1] = {
{"not-my-pragma", "%pragma not applicable to this compilation", false},
{"unknown-warning", "unknown warning in -W/-w or warning directive", false},
{"negative-rep", "regative %rep count", true},
+ {"phase", "phase error during stabilization", false},
/* THIS ENTRY MUST COME LAST */
{"all", "all possible warnings", false}
diff --git a/asm/nasm.c b/asm/nasm.c
index 5290b078..55e4a8cf 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1613,9 +1613,23 @@ static void assemble_file(const char *fname, StrList **depend_ptr)
nasm_free(line);
} /* end while (line = preproc->getline... */
- if (pass0 == 2 && global_offset_changed && !terminate_after_phase)
- nasm_error(ERR_NONFATAL,
- "phase error detected at end of assembly.");
+ if (global_offset_changed && !terminate_after_phase) {
+ switch (pass0) {
+ case 1:
+ nasm_error(ERR_WARNING|ERR_WARN_PHASE,
+ "phase error during stabilization pass, hoping for the best");
+ break;
+
+ case 2:
+ nasm_error(ERR_NONFATAL,
+ "phase error during code generation pass");
+ break;
+
+ default:
+ /* This is normal, we'll keep going... */
+ break;
+ }
+ }
if (pass1 == 1)
preproc->cleanup(1);
diff --git a/include/error.h b/include/error.h
index 83b28da0..139400db 100644
--- a/include/error.h
+++ b/include/error.h
@@ -113,9 +113,10 @@ static inline vefunc nasm_set_verror(vefunc ve)
#define ERR_WARN_NOTMY_PRAGMA WARN(19) /* pragma inapplicable */
#define ERR_WARN_UNK_WARNING WARN(20) /* unknown warning */
#define ERR_WARN_NEG_REP WARN(21) /* negative repeat count */
+#define ERR_WARN_PHASE WARN(22) /* phase error in pass 1 */
/* The "all" warning acts as a global switch, it must come last */
-#define ERR_WARN_ALL 22 /* Do not use WARN() here */
+#define ERR_WARN_ALL 23 /* Do not use WARN() here */
struct warning {
const char *name;