]> git.sur5r.net Git - cc65/blobdiff - src/ld65/config.h
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / ld65 / config.h
index 3693d76ac22ef92e45da88c4b247ffeb9addfd46..8eb86133e1990471c764d4a0af41d931b943f3f5 100644 (file)
@@ -1,12 +1,12 @@
 /*****************************************************************************/
 /*                                                                           */
-/*                                config.h                                  */
+/*                                 config.h                                  */
 /*                                                                           */
-/*              Target configuration file for the ld65 linker               */
+/*               Target configuration file for the ld65 linker               */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2010, Ullrich von Bassewitz                                      */
+/* (C) 1998-2012, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
 
 /* common */
 #include "coll.h"
+#include "filepos.h"
 
 /* ld65 */
+#include "lineinfo.h"
 #include "segments.h"
 
 
 
 /*****************************************************************************/
-/*                                          Data                                    */
+/*                                   Data                                    */
 /*****************************************************************************/
 
 
 
+/* 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 */
-};
-
-/* Segment list node. Needed because there are two lists (RUN & LOAD) */
-typedef struct MemListNode MemListNode;
-struct MemListNode {
-    MemListNode*       Next;           /* Next entry */
-    struct SegDesc*    Seg;            /* Segment */
-};
-
-/* 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 */
-    MemListNode*       SegList;        /* List of segments for this section */
-    MemListNode*       SegLast;        /* Last segment in this section */
-    File*              F;              /* File that contains the entry */
+    unsigned            Flags;
+    unsigned            Format;         /* Output format */
+    unsigned long       Size;           /* Size of the generated file */
+    Collection          MemoryAreas;    /* List of memory areas in this file */
 };
 
 /* Segment descriptor entry */
 typedef struct SegDesc SegDesc;
 struct SegDesc {
     unsigned            Name;           /* Index of the name */
-    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 */
-    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 */
+    LineInfo*           LI;             /* Position of definition */
+    Segment*            Seg;            /* Pointer to segment structure */
+    unsigned            Attr;           /* Attributes for segment */
+    unsigned            Flags;          /* Set of bitmapped flags */
+    unsigned char       FillVal;        /* Fill value for this segment */
+    struct MemoryArea*  Load;           /* Load memory section */
+    struct MemoryArea*  Run;            /* Run memory section */
+    unsigned long       Addr;           /* Start address or offset into segment */
+    unsigned long       RunAlignment;   /* Run area alignment if given */
+    unsigned long       LoadAlignment;  /* 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 */
-#define SF_ZP                  0x0004          /* Zeropage segment (o65 only) */
-#define SF_DEFINE              0x0008          /* Define start and size */
-#define SF_ALIGN       0x0010          /* Align segment in run area */
+#define SF_RO           0x0001          /* Read only segment */
+#define SF_BSS          0x0002          /* Segment is BSS style segment */
+#define SF_ZP           0x0004          /* Zeropage segment (o65 only) */
+#define SF_DEFINE       0x0008          /* Define start and size */
+#define SF_ALIGN        0x0010          /* Align segment in run area */
 #define SF_ALIGN_LOAD   0x0020          /* Align segment in load area */
-#define SF_OFFSET              0x0040          /* Segment has offset in memory */
-#define SF_START       0x0080          /* Segment has fixed start address */
+#define SF_OFFSET       0x0040          /* Segment has offset in memory */
+#define SF_START        0x0080          /* Segment has fixed start address */
 #define SF_OPTIONAL     0x0100          /* Segment is optional (must not exist) */
-#define SF_RUN_DEF             0x0200          /* RUN symbols already defined */
-#define SF_LOAD_DEF    0x0400          /* LOAD symbols already defined */
+#define SF_RUN_DEF      0x0200          /* RUN symbols already defined */
+#define SF_LOAD_DEF     0x0400          /* LOAD symbols already defined */
+#define SF_FILLVAL      0x0800          /* Segment has separate fill value */
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -128,9 +108,11 @@ struct SegDesc {
 void CfgRead (void);
 /* Read the configuration */
 
-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).
+unsigned CfgProcess (void);
+/* Process the config file after reading in object files and libraries. This
+ * includes postprocessing of the config file data but also assigning segments
+ * and defining segment/memory area related symbols. The function will return
+ * the number of memory area overflows (so zero means anything went ok).
  * In case of overflows, a short mapfile can be generated later, to ease the
  * task of rearranging segments for the user.
  */
@@ -143,8 +125,3 @@ void CfgWriteTarget (void);
 /* End of config.h */
 
 #endif
-
-
-
-
-