mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
Fixed an error in file offset calculation.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5380 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -1816,6 +1816,9 @@ unsigned CfgProcess (void)
|
|||||||
/* Get the segment */
|
/* Get the segment */
|
||||||
SegDesc* S = CollAtUnchecked (&M->SegList, J);
|
SegDesc* S = CollAtUnchecked (&M->SegList, J);
|
||||||
|
|
||||||
|
/* Remember the start address before handling this segment */
|
||||||
|
unsigned long StartAddr = Addr;
|
||||||
|
|
||||||
/* Some actions depend on wether this is the load or run memory
|
/* Some actions depend on wether this is the load or run memory
|
||||||
* area.
|
* area.
|
||||||
*/
|
*/
|
||||||
@@ -1866,8 +1869,8 @@ unsigned CfgProcess (void)
|
|||||||
Addr = NewAddr;
|
Addr = NewAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the segment has .BANK expressions referring to it, it
|
/* If the segment has .BANK expressions referring to it, it
|
||||||
* must be placed into a memory area that has the bank
|
* must be placed into a memory area that has the bank
|
||||||
* attribute.
|
* attribute.
|
||||||
*/
|
*/
|
||||||
if (S->Seg->BankRef && M->BankExpr == 0) {
|
if (S->Seg->BankRef && M->BankExpr == 0) {
|
||||||
@@ -1931,6 +1934,11 @@ unsigned CfgProcess (void)
|
|||||||
/* Calculate the new address */
|
/* Calculate the new address */
|
||||||
Addr += S->Seg->Size;
|
Addr += S->Seg->Size;
|
||||||
|
|
||||||
|
/* If this segment goes out to the file, increase the file size */
|
||||||
|
if ((S->Flags & SF_BSS) == 0 && S->Load == M) {
|
||||||
|
M->F->Size += Addr - StartAddr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If requested, define symbols for start, size and offset of the
|
/* If requested, define symbols for start, size and offset of the
|
||||||
@@ -1963,11 +1971,11 @@ unsigned CfgProcess (void)
|
|||||||
SB_Done (&Buf);
|
SB_Done (&Buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grow the file by the size of the memory area */
|
/* If we didn't have an overflow and are requested to fill the memory
|
||||||
if (M->Flags & MF_FILL) {
|
* area, acount for that in the file size.
|
||||||
M->F->Size += M->Size;
|
*/
|
||||||
} else {
|
if ((M->Flags & MF_OVERFLOW) == 0 && (M->Flags & MF_FILL) != 0) {
|
||||||
M->F->Size += M->FillLevel;
|
M->F->Size += (M->Size - M->FillLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user