From c65292b78dd03a065c3665feb7f4365a76667c0f Mon Sep 17 00:00:00 2001 From: uz Date: Wed, 8 Jun 2011 18:33:34 +0000 Subject: [PATCH] Fixed an error: The amount of fill bytes for a section was declared as an unsigned char, so larger values got truncated making alignments larger than $100 unreliable. git-svn-id: svn://svn.cc65.org/cc65/trunk@5042 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/segments.c | 4 ++-- src/ld65/segments.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ld65/segments.c b/src/ld65/segments.c index f6add7a21..518288eea 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -181,7 +181,7 @@ Section* NewSection (Segment* Seg, unsigned char Align, unsigned char AddrSize) /* Calculate the alignment bytes needed for the section */ V = (0x01UL << S->Align) - 1; - S->Fill = (unsigned char) (((Seg->Size + V) & ~V) - Seg->Size); + S->Fill = (((Seg->Size + V) & ~V) - Seg->Size); /* Adjust the segment size and set the section offset */ Seg->Size += S->Fill; @@ -475,7 +475,7 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void* Print (stdout, 2, " Section from \"%s\"\n", GetObjFileName (Sec->Obj)); /* If we have fill bytes, write them now */ - Print (stdout, 2, " Filling 0x%x bytes with 0x%02x\n", + Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n", Sec->Fill, S->FillVal); WriteMult (Tgt, S->FillVal, Sec->Fill); Offs += Sec->Fill; diff --git a/src/ld65/segments.h b/src/ld65/segments.h index 45f5f512f..310821782 100644 --- a/src/ld65/segments.h +++ b/src/ld65/segments.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2010, Ullrich von Bassewitz */ +/* (C) 1998-2011, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -86,8 +86,8 @@ struct Section { struct Fragment* FragLast; /* Pointer to last fragment */ unsigned long Offs; /* Offset into the segment */ unsigned long Size; /* Size of the section */ + unsigned long Fill; /* Fill bytes for alignment */ unsigned char Align; /* Alignment */ - unsigned char Fill; /* Fill bytes for alignment */ unsigned char AddrSize; /* Address size of segment */ };