suppress spurious "large alignment" warning when the combined alignment is not larger than any of the explictly requested ones

This commit is contained in:
bbbradsmith 2023-02-21 06:48:46 -05:00
parent d0f17ba602
commit 13f1d37403
3 changed files with 9 additions and 8 deletions

View File

@ -2112,14 +2112,15 @@ Here's a list of all control commands and a description, what they do:
</verb></tscreen>
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
assembler will issue a warning when the combined alignment exceeds 256. The
command line option <tt><ref id="option--large-alignment"
name="--large-alignment"></tt> will disable this warning.
15, 18 and 251 - which is 22590. To protect the user against errors, when the
combined alignment is larger than the explicitly requested alignments,
and also exceeds 256, the assembler will issue a warning. The command line
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
only alignments possible in older versions of the assembler), the problem is
less severe, because the least common multiple of powers to the same base is
only alignments possible in older versions of the assembler) will not cause
a warning, because the least common multiple of powers to the same base is
always the larger one.

View File

@ -306,7 +306,7 @@ void SegAlign (unsigned long Alignment, int FillVal)
ActiveSeg->Align = CombinedAlignment;
/* 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)",
CombinedAlignment);
}

View File

@ -230,7 +230,7 @@ Section* ReadSection (FILE* F, ObjData* O)
"%lu. Last module requiring alignment was '%s'.",
GetString (Name), Alignment, MAX_ALIGNMENT,
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 "
"large (%lu). Last module requiring alignment was '%s'.",
GetString (Name), Alignment, GetObjFileName (O));