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

@@ -52,28 +52,16 @@
/* Forward for struct MemoryArea */
struct MemoryArea;
/* File list entry */
typedef struct File File;
struct File {
unsigned Name; /* Name index of the file */
unsigned Flags;
unsigned Format; /* Output format */
Collection MemList; /* List of memory areas in this file */
};
/* Memory list entry */
typedef struct Memory Memory;
struct Memory {
unsigned Name; /* Name index of the memory section */
unsigned Attr; /* Which values are valid? */
unsigned Flags; /* Set of bitmapped flags */
unsigned long Start; /* Start address */
unsigned long Size; /* Length of memory section */
unsigned long FillLevel; /* Actual fill level of segment */
unsigned char FillVal; /* Value used to fill rest of seg */
unsigned char Relocatable; /* Memory area is relocatable */
Collection SegList; /* List of segments for this section */
File* F; /* File that contains the entry */
unsigned Flags;
unsigned Format; /* Output format */
Collection MemoryAreas; /* List of memory areas in this file */
};
/* Segment descriptor entry */
@@ -83,19 +71,13 @@ struct SegDesc {
Segment* Seg; /* Pointer to segment structure */
unsigned Attr; /* Attributes for segment */
unsigned Flags; /* Set of bitmapped flags */
Memory* Load; /* Load memory section */
Memory* Run; /* Run memory section */
struct MemoryArea* Load; /* Load memory section */
struct MemoryArea* Run; /* Run memory section */
unsigned long Addr; /* Start address or offset into segment */
unsigned char Align; /* Run area alignment if given */
unsigned char AlignLoad; /* Load area alignment if given */
};
/* Memory flags */
#define MF_DEFINE 0x0001 /* Define start and size */
#define MF_FILL 0x0002 /* Fill segment */
#define MF_RO 0x0004 /* Read only memory area */
#define MF_OVERFLOW 0x0008 /* Memory area overflow */
/* Segment flags */
#define SF_RO 0x0001 /* Read only segment */
#define SF_BSS 0x0002 /* Segment is BSS style segment */
@@ -120,6 +102,9 @@ struct SegDesc {
void CfgRead (void);
/* Read the configuration */
void CfgProcess (void);
/* Process the config file after reading in object files and libraries */
unsigned CfgAssignSegments (void);
/* Assign segments, define linker symbols where requested. The function will
* return the number of memory area overflows (so zero means anything went ok).