]> git.sur5r.net Git - cc65/commitdiff
Fixed an error: The amount of fill bytes for a section was declared as an
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 8 Jun 2011 18:33:34 +0000 (18:33 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 8 Jun 2011 18:33:34 +0000 (18:33 +0000)
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
src/ld65/segments.h

index f6add7a219b744317b8c6d666e11311ae5ea8cad..518288eea964f8f9de91dfaff43a1ff176f2ea56 100644 (file)
@@ -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;
index 45f5f512ff31b626ff23ef976bc892fce03a622c..310821782fa326fd53b9d4e7510838555c8523fc 100644 (file)
@@ -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 */
 };