X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Fsegments.c;h=1474ebe5550f4cba2b108598d110c7b226737575;hb=35e1184901ca38bdb2e56d154ed3b71f6096eacc;hp=a4e54317c30e81496e2d5c72790be92e98f31bde;hpb=02cbc7da254e5218394c9ff55e75bb80df633823;p=cc65 diff --git a/src/ld65/segments.c b/src/ld65/segments.c index a4e54317c..1474ebe55 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -45,6 +45,7 @@ #include "fragdefs.h" #include "hashfunc.h" #include "print.h" +#include "segdefs.h" #include "symdefs.h" #include "xmalloc.h" @@ -93,6 +94,7 @@ static Segment* NewSegment (unsigned Name, unsigned char AddrSize) /* Initialize the fields */ S->Name = Name; S->Next = 0; + S->Flags = SEG_FLAG_NONE; S->Sections = EmptyCollection; S->MemArea = 0; S->PC = 0; @@ -104,7 +106,6 @@ static Segment* NewSegment (unsigned Name, unsigned char AddrSize) S->AddrSize = AddrSize; S->ReadOnly = 0; S->Dumped = 0; - S->BankRef = 0; /* Insert the segment into the segment list and assign the segment id */ S->Id = CollCount (&SegmentList); @@ -190,6 +191,7 @@ Section* ReadSection (FILE* F, ObjData* O) /* Read a section from a file */ { unsigned Name; + unsigned Flags; unsigned Size; unsigned long Alignment; unsigned char Type; @@ -198,12 +200,13 @@ Section* ReadSection (FILE* F, ObjData* O) Section* Sec; /* Read the segment data */ - (void) Read32 (F); /* File size of data */ + (void) Read32 (F); /* File size of data */ Name = MakeGlobalStringId (O, ReadVar (F)); /* Segment name */ - Size = ReadVar (F); /* Size of data */ - Alignment = ReadVar (F); /* Alignment */ - Type = Read8 (F); /* Segment type */ - FragCount = ReadVar (F); /* Number of fragments */ + Flags = ReadVar (F); /* Segment flags */ + Size = ReadVar (F); /* Size of data */ + Alignment = ReadVar (F); /* Alignment */ + Type = Read8 (F); /* Segment type */ + FragCount = ReadVar (F); /* Number of fragments */ /* Print some data */ @@ -213,6 +216,11 @@ Section* ReadSection (FILE* F, ObjData* O) /* Get the segment for this section */ S = GetSegment (Name, Type, GetObjFileName (O)); + + /* The only possible flag is currently SEG_FLAG_BANKREF, and it must be + * applied to the segment, not the section. + */ + S->Flags |= Flags; /* Allocate the section we will return later */ Sec = NewSection (S, Alignment, Type);