From 5bcbb39bba0cb81fa94b1f9297de49c2292c1b55 Mon Sep 17 00:00:00 2001 From: uz Date: Wed, 28 Dec 2011 16:00:16 +0000 Subject: [PATCH] Make the error message for large alignments more descriptive. Don't use the real number of fill bytes for an alignment, we didn't accept anyway. git-svn-id: svn://svn.cc65.org/cc65/trunk@5340 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/segment.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ca65/segment.c b/src/ca65/segment.c index a1c2aed27..00ac6234e 100644 --- a/src/ca65/segment.c +++ b/src/ca65/segment.c @@ -292,7 +292,14 @@ void SegAlign (unsigned long Alignment, int FillVal) */ CombinedAlignment = LeastCommonMultiple (ActiveSeg->Align, Alignment); if (CombinedAlignment > MAX_ALIGNMENT) { - Error ("Combined alignment for active segment exceeds 0x10000"); + Error ("Combined alignment for active segment is %lu which exceeds %lu", + CombinedAlignment, MAX_ALIGNMENT); + + /* Avoid creating large fills for an object file that is thrown away + * later. + */ + Count = 1; + } else { ActiveSeg->Align = CombinedAlignment; @@ -301,13 +308,13 @@ void SegAlign (unsigned long Alignment, int FillVal) Warning (0, "Combined alignment is suspiciously large (%lu)", CombinedAlignment); } + + /* Calculate the number of fill bytes */ + Count = AlignCount (ActiveSeg->PC, Alignment) - ActiveSeg->PC; + } - - /* Calculate the number of fill bytes */ - Count = AlignCount (ActiveSeg->PC, Alignment) - ActiveSeg->PC; - /* Emit the data or a fill fragment */ if (FillVal != -1) { /* User defined fill value */