Separate processing the linker config file into two phases: The config file is

read when the -t or -C switch is encountered and parts of it are processed.
The remaining parts are processed when all object files and libraries have
been read. To make this work, the expression evaluation in cfgexpr has been
rewritten to generate true expression trees. This means that expressions in
the linker config may use exports from the object files. 

Separation of config file processing is the base for several enhancements, for
example forced imports by linker config.

This code needs more work and is only very, very, very roughly tested.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4840 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2010-11-08 21:52:24 +00:00
parent 6c0a9c0438
commit da792b3fd0
21 changed files with 718 additions and 462 deletions

View File

@@ -302,6 +302,9 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg)
} else {
CfgSetName (PathName);
}
/* Read the config */
CfgRead ();
}
@@ -356,7 +359,7 @@ static void OptForceImport (const char* Opt attribute ((unused)), const char* Ar
/* Use default address size (which for now is always absolute
* addressing)
*/
InsertImport (GenImport (Arg, ADDR_SIZE_ABS));
InsertImport (GenImport (GetStringId (Arg), ADDR_SIZE_ABS));
} else {
@@ -375,7 +378,7 @@ static void OptForceImport (const char* Opt attribute ((unused)), const char* Ar
A[ColPos - Arg] = '\0';
/* Generate the import */
InsertImport (GenImport (A, AddrSize));
InsertImport (GenImport (GetStringId (A), AddrSize));
/* Delete the copy of the argument */
xfree (A);
@@ -481,6 +484,9 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg)
/* Set the target data */
DefaultBinFmt = D->BinFmt;
CfgSetBuf (D->Cfg);
/* Read the target config */
CfgRead ();
}
@@ -643,12 +649,12 @@ int main (int argc, char* argv [])
/* Check if we have open library groups */
LibCheckGroup ();
/* Read the config file */
CfgRead ();
/* Create the condes tables if requested */
ConDesCreate ();
/* Process data from the config file */
CfgProcess ();
/* Assign start addresses for the segments, define linker symbols. The
* function will return the number of memory area overflows (zero on
* success).