Merge pull request #2003 from bbbradsmith/large_align_false_positive_fix

supress spurious "large alignment" warnings
This commit is contained in:
Bob Andrews
2023-02-24 16:32:41 +01:00
committed by GitHub
3 changed files with 10 additions and 10 deletions

View File

@@ -2120,15 +2120,15 @@ Here's a list of all control commands and a description, what they do:
</verb></tscreen> </verb></tscreen>
the assembler will force a segment alignment to the least common multiple of the assembler will force a segment alignment to the least common multiple of
15, 18 and 251 - which is 22590. To protect the user against errors, the 15, 18 and 251 - which is 22590. To protect the user against errors, when the
assembler will issue a warning when the combined alignment exceeds 256. The combined alignment is larger than the explicitly requested alignments,
command line option <tt><ref id="option--large-alignment" the assembler will issue a warning if it also exceeds 256. The command line
name="--large-alignment"></tt> will disable this warning. option <tt><ref id="option--large-alignment" name="--large-alignment"></tt>
will disable this warning.
Please note that with alignments that are a power of two (which were the Please note that with only alignments that are a power of two, a warning will
only alignments possible in older versions of the assembler), the problem is never occur, because the least common multiple of powers to the same base is
less severe, because the least common multiple of powers to the same base is always simply the larger one.
always the larger one.

View File

@@ -306,7 +306,7 @@ void SegAlign (unsigned long Alignment, int FillVal)
ActiveSeg->Align = CombinedAlignment; ActiveSeg->Align = CombinedAlignment;
/* Output a warning for larger alignments if not suppressed */ /* Output a warning for larger alignments if not suppressed */
if (CombinedAlignment >= LARGE_ALIGNMENT && !LargeAlignment) { if (CombinedAlignment >= LARGE_ALIGNMENT && CombinedAlignment > ActiveSeg->Align && CombinedAlignment > Alignment && !LargeAlignment) {
Warning (0, "Combined alignment is suspiciously large (%lu)", Warning (0, "Combined alignment is suspiciously large (%lu)",
CombinedAlignment); CombinedAlignment);
} }

View File

@@ -230,7 +230,7 @@ Section* ReadSection (FILE* F, ObjData* O)
"%lu. Last module requiring alignment was '%s'.", "%lu. Last module requiring alignment was '%s'.",
GetString (Name), Alignment, MAX_ALIGNMENT, GetString (Name), Alignment, MAX_ALIGNMENT,
GetObjFileName (O)); GetObjFileName (O));
} else if (Alignment >= LARGE_ALIGNMENT && !LargeAlignment) { } else if (Alignment >= LARGE_ALIGNMENT && Alignment > S->Alignment && Alignment > Sec->Alignment && !LargeAlignment) {
Warning ("Combined alignment for segment '%s' is suspiciously " Warning ("Combined alignment for segment '%s' is suspiciously "
"large (%lu). Last module requiring alignment was '%s'.", "large (%lu). Last module requiring alignment was '%s'.",
GetString (Name), Alignment, GetObjFileName (O)); GetString (Name), Alignment, GetObjFileName (O));