mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Allow to define symbols in the linker config
git-svn-id: svn://svn.cc65.org/cc65/trunk@620 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
1eff067ff9
commit
1923199dad
@ -1138,6 +1138,36 @@ static void ParseFeatures (void)
|
||||
|
||||
|
||||
|
||||
static void ParseSymbols (void)
|
||||
/* Parse a symbols section */
|
||||
{
|
||||
while (CfgTok == CFGTOK_IDENT) {
|
||||
|
||||
long Val;
|
||||
|
||||
/* Remember the name */
|
||||
char Name [sizeof (CfgSVal)];
|
||||
strcpy (Name, CfgSVal);
|
||||
CfgNextTok ();
|
||||
|
||||
/* Allow an optional assignment */
|
||||
CfgOptionalAssign ();
|
||||
|
||||
/* Make sure the next token is an integer, read and skip it */
|
||||
CfgAssureInt ();
|
||||
Val = CfgIVal;
|
||||
CfgNextTok ();
|
||||
|
||||
/* Generate an export with the given value */
|
||||
CreateConstExport (Name, Val);
|
||||
|
||||
/* Skip the semicolon */
|
||||
CfgConsumeSemi ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void ParseConfig (void)
|
||||
/* Parse the config file */
|
||||
{
|
||||
@ -1147,6 +1177,7 @@ static void ParseConfig (void)
|
||||
{ "SEGMENTS", CFGTOK_SEGMENTS },
|
||||
{ "FORMATS", CFGTOK_FORMATS },
|
||||
{ "FEATURES", CFGTOK_FEATURES },
|
||||
{ "SYMBOLS", CFGTOK_SYMBOLS },
|
||||
};
|
||||
cfgtok_t BlockTok;
|
||||
|
||||
@ -1183,6 +1214,10 @@ static void ParseConfig (void)
|
||||
ParseFeatures ();
|
||||
break;
|
||||
|
||||
case CFGTOK_SYMBOLS:
|
||||
ParseSymbols ();
|
||||
break;
|
||||
|
||||
default:
|
||||
FAIL ("Unexpected block token");
|
||||
|
||||
|
@ -65,6 +65,7 @@ typedef enum {
|
||||
CFGTOK_SEGMENTS,
|
||||
CFGTOK_FORMATS,
|
||||
CFGTOK_FEATURES,
|
||||
CFGTOK_SYMBOLS,
|
||||
|
||||
CFGTOK_START,
|
||||
CFGTOK_SIZE,
|
||||
|
@ -230,7 +230,7 @@ Section* ReadSection (FILE* F, ObjData* O)
|
||||
Type = Read8 (F);
|
||||
|
||||
/* Print some data */
|
||||
Print (stdout, 1, "Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
|
||||
Print (stdout, 2, "Module `%s': Found segment `%s', size = %lu, align = %u, type = %u\n",
|
||||
GetObjFileName (O), Name, Size, Align, Type);
|
||||
|
||||
/* Get the segment for this section */
|
||||
|
Loading…
x
Reference in New Issue
Block a user