Added symbol definitions on the command line and weak symbols in the config.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3552 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-07-26 20:42:30 +00:00
parent d2ee1c447d
commit 1d5c1b1983
2 changed files with 76 additions and 6 deletions

View File

@@ -1335,7 +1335,7 @@ static void ParseFeatures (void)
default:
Error ("Unexpected feature token");
FAIL ("Unexpected feature token");
}
/* Skip the semicolon */
@@ -1359,7 +1359,7 @@ static void ParseSymbols (void)
while (CfgTok == CFGTOK_IDENT) {
long Val = 0L;
int Weak;
int Weak = 0;
/* Remember the name */
unsigned Name = GetStringId (CfgSVal);
@@ -1381,9 +1381,6 @@ static void ParseSymbols (void)
Val = CfgIVal;
CfgNextTok ();
/* Generate an export with the given value */
CreateConstExport (Name, Val);
} else {
/* Bitmask to remember the attributes we got already */
@@ -1453,7 +1450,18 @@ static void ParseSymbols (void)
Weak = 0;
}
/* Generate an export with the given value */
}
/* Check if the symbol is already defined */
if (FindExport (Name) != 0) {
/* If the symbol is not marked as weak, this is an error.
* Otherwise ignore the symbol from the config.
*/
if (!Weak) {
CfgError ("Symbol `%s' is already defined", GetString (Name));
}
} else {
/* The symbol is undefined, generate an export */
CreateConstExport (Name, Val);
}