Emit warnings for wasted bytes when aligning
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 . */
|
||||
|
||||
Reference in New Issue
Block a user