diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 40231920c..af5e73d13 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -2372,7 +2372,8 @@ Here's a list of all control commands and a description, what they do: calculated in advance by the assembler. You are therefore required to specify a matching alignment for the segment in the linker config. The linker will output a warning if the alignment of the segment is less than - what is necessary to have a correct alignment in the object file. + what is necessary to have a correct alignment in the object file. It will + also emit a warning to inform about the number of bytes wasted for alignment. Example: diff --git a/src/ca65/segment.c b/src/ca65/segment.c index adc5cec98..76126d23d 100644 --- a/src/ca65/segment.c +++ b/src/ca65/segment.c @@ -313,7 +313,9 @@ void SegAlign (unsigned long Alignment, int FillVal) /* Calculate the number of fill bytes */ Count = AlignCount (ActiveSeg->PC, Alignment); - + if (Count != 0) { + Warning(0, "Wasting %lu bytes for alignment", Count); + } } diff --git a/src/ld65/config.c b/src/ld65/config.c index bc2a26578..9536d5c26 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -2035,8 +2035,8 @@ unsigned CfgProcess (void) if (M->FillLevel == 0 && NewAddr > Addr) { PWarning (GetSourcePos (S->LI), "The first segment in memory area `%s' " - "needs fill bytes for alignment.", - GetString (M->Name)); + "needs %lu fill bytes for alignment.", + GetString (M->Name), NewAddr - Addr); } /* Use the aligned address */ diff --git a/src/ld65/segments.c b/src/ld65/segments.c index 1391d30f1..aeff972d2 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -236,6 +236,9 @@ Section* ReadSection (FILE* F, ObjData* O) GetString (Name), Alignment, GetObjFileName (O)); } S->Alignment = Alignment; + if (Sec->Fill != 0) { + Warning("Wasting %lu bytes for alignment from %s", Sec->Fill, GetObjFileName (O)); + } } /* Start reading fragments from the file and insert them into the section . */