Working on better 65816 support

git-svn-id: svn://svn.cc65.org/cc65/trunk@2619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-07 19:28:37 +00:00
parent 066ad63e35
commit 7e74078801
23 changed files with 558 additions and 460 deletions

View File

@@ -36,6 +36,7 @@
#include <string.h>
/* common */
#include "addrsize.h"
#include "check.h"
#include "coll.h"
#include "fragdefs.h"
@@ -127,7 +128,7 @@ static int ConDesCompare (void* Data, const void* E1, const void* E2)
static void ConDesCreateOne (ConDesDesc* CD)
/* Create one table if requested */
{
Segment* Seg; /* Segment for table */
Segment* Seg; /* Segment for table */
Section* Sec; /* Section for table */
unsigned Count; /* Number of exports */
unsigned I;
@@ -151,10 +152,10 @@ static void ConDesCreateOne (ConDesDesc* CD)
CollSort (&CD->ExpList, ConDesCompare, CD);
/* Get the segment for the table, create it if needed */
Seg = GetSegment (CD->SegName, SEGTYPE_ABS, 0);
Seg = GetSegment (CD->SegName, ADDR_SIZE_ABS, 0);
/* Create a new section for the table */
Sec = NewSection (Seg, 1, SEGTYPE_ABS);
Sec = NewSection (Seg, 1, ADDR_SIZE_ABS);
/* Walk over the exports and create a fragment for each one. We will use
* the exported expression without copying it, since it's cheap and there

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<>merstrasse 52 */
/* R<>merstra<EFBFBD>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -70,7 +70,7 @@
static Segment* HashTab [HASHTAB_SIZE];
static unsigned SegCount = 0; /* Segment count */
static Segment* SegRoot = 0; /* List of all segments */
static Segment* SegRoot = 0; /* List of all segments */
@@ -80,7 +80,7 @@ static Segment* SegRoot = 0; /* List of all segments */
static Segment* NewSegment (unsigned Name, unsigned char Type)
static Segment* NewSegment (unsigned Name, unsigned char AddrSize)
/* Create a new segment and initialize it */
{
unsigned Hash;
@@ -98,7 +98,7 @@ static Segment* NewSegment (unsigned Name, unsigned char Type)
S->AlignObj = 0;
S->Align = 0;
S->FillVal = 0;
S->Type = Type;
S->AddrSize = AddrSize;
S->ReadOnly = 0;
S->Relocatable = 0;
S->Dumped = 0;
@@ -119,7 +119,7 @@ static Segment* NewSegment (unsigned Name, unsigned char Type)
Segment* GetSegment (unsigned Name, unsigned char Type, const char* ObjName)
Segment* GetSegment (unsigned Name, unsigned char AddrSize, const char* ObjName)
/* Search for a segment and return an existing one. If the segment does not
* exist, create a new one and return that. ObjName is only used for the error
* message and may be NULL if the segment is linker generated.
@@ -133,10 +133,10 @@ Segment* GetSegment (unsigned Name, unsigned char Type, const char* ObjName)
*/
if (S == 0) {
/* Create a new segment */
S = NewSegment (Name, Type);
S = NewSegment (Name, AddrSize);
} else {
/* Check if the existing segment has the requested type */
if (S->Type != Type) {
/* Check if the existing segment has the requested address size */
if (S->AddrSize != AddrSize) {
/* Allow an empty object name */
if (ObjName == 0) {
ObjName = "[linker generated]";
@@ -152,7 +152,7 @@ Segment* GetSegment (unsigned Name, unsigned char Type, const char* ObjName)
Section* NewSection (Segment* Seg, unsigned char Align, unsigned char Type)
Section* NewSection (Segment* Seg, unsigned char Align, unsigned char AddrSize)
/* Create a new section for the given segment */
{
unsigned long V;
@@ -168,7 +168,7 @@ Section* NewSection (Segment* Seg, unsigned char Align, unsigned char Type)
S->FragLast = 0;
S->Size = 0;
S->Align = Align;
S->Type = Type;
S->AddrSize = AddrSize;
/* Calculate the alignment bytes needed for the section */
V = (0x01UL << S->Align) - 1;
@@ -637,7 +637,7 @@ void PrintDbgSegments (FILE* F)
/* Print the segment data */
fprintf (F, "segment\t\"%s\", 0x%06lX, 0x%04lX, %s, %s\n",
GetString (S->Name), S->PC, S->Size,
SegTypeToStr (S->Type),
AddrSizeToStr (S->AddrSize),
S->ReadOnly? "ro" : "rw");
}

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<>merstrasse 52 */
/* R<>merstra<EFBFBD>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -64,7 +64,7 @@ struct Segment {
struct ObjData* AlignObj; /* Module that requested the alignment */
unsigned char Align; /* Alignment needed */
unsigned char FillVal; /* Value to use for fill bytes */
unsigned char Type; /* Type of segment */
unsigned char AddrSize; /* Address size of segment */
unsigned char ReadOnly; /* True for readonly segments (config) */
unsigned char Relocatable; /* True if the segment is relocatable */
unsigned char Dumped; /* Did we dump this segment? */
@@ -83,7 +83,7 @@ struct Section {
unsigned long Size; /* Size of the section */
unsigned char Align; /* Alignment */
unsigned char Fill; /* Fill bytes for alignment */
unsigned char Type; /* Type of segment */
unsigned char AddrSize; /* Address size of segment */
};
@@ -110,13 +110,13 @@ typedef unsigned (*SegWriteFunc) (ExprNode* E, /* The expression to write
Segment* GetSegment (unsigned Name, unsigned char Type, const char* ObjName);
Segment* GetSegment (unsigned Name, unsigned char AddrSize, const char* ObjName);
/* Search for a segment and return an existing one. If the segment does not
* exist, create a new one and return that. ObjName is only used for the error
* message and may be NULL if the segment is linker generated.
*/
Section* NewSection (Segment* Seg, unsigned char Align, unsigned char Type);
Section* NewSection (Segment* Seg, unsigned char Align, unsigned char AddrSize);
/* Create a new section for the given segment */
Section* ReadSection (FILE* F, struct ObjData* O);