From e84a1c068bdb339f1003631d9b67f98bc69b906c Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 11 Dec 2002 18:29:58 +0000 Subject: [PATCH] Print a warning if a bss type segment has both, run and load areas assigned. git-svn-id: svn://svn.cc65.org/cc65/trunk@1737 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/config.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ld65/config.c b/src/ld65/config.c index c06824ecb..0faeb8e18 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -721,9 +721,6 @@ static void ParseSegments (void) CfgOptionalComma (); } - /* Skip the semicolon */ - CfgConsumeSemi (); - /* Check for mandatory parameters */ AttrCheck (S->Attr, SA_LOAD, "LOAD"); @@ -748,11 +745,19 @@ static void ParseSegments (void) CfgGetName (), CfgErrorLine); } + /* If the segment is marked as BSS style, it may not have separate + * load and run memory areas, because it's is never written to disk. + */ + if ((S->Flags & SF_BSS) != 0 && (S->Flags & SF_LOAD_AND_RUN) != 0) { + Warning ("%s(%u): Segment with type `bss' has both LOAD and RUN " + "memory areas assigned", CfgGetName (), CfgErrorLine); + } + /* Don't allow read/write data to be put into a readonly area */ if ((S->Flags & SF_RO) == 0) { if (S->Run->Flags & MF_RO) { - CfgError ("Cannot put r/w segment `%s' in r/o memory area `%s'", - S->Name, S->Run->Name); + CfgError ("Cannot put r/w segment `%s' in r/o memory area `%s'", + S->Name, S->Run->Name); } } @@ -782,6 +787,9 @@ static void ParseSegments (void) /* Segment does not exist, discard the descriptor */ FreeSegDesc (S); } + + /* Skip the semicolon */ + CfgConsumeSemi (); } }