Changed the object file and library format. There is now an additional
string table in the object file that (currently) holds all identifiers from the import, export and debug info sections. The plan is to put all strings into this table, so we have them in a central place and don't waste memory. Apart from that, the indices are unique, so comparing strings should be a lot easier than before (as soon as the programs take advantage of this fact, which is currently not the case). git-svn-id: svn://svn.cc65.org/cc65/trunk@2169 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -80,8 +80,8 @@ static DbgSym* NewDbgSym (unsigned char Type, ObjData* O)
|
||||
D->Flags = 0;
|
||||
D->Obj = O;
|
||||
D->Expr = 0;
|
||||
D->Type = Type;
|
||||
D->Name = 0;
|
||||
D->Type = Type;
|
||||
|
||||
/* Return the new entry */
|
||||
return D;
|
||||
@@ -148,7 +148,7 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
|
||||
D = NewDbgSym (Type, O);
|
||||
|
||||
/* Read and assign the name */
|
||||
D->Name = ReadStr (F);
|
||||
D->Name = GetObjString (O, ReadVar (F));
|
||||
|
||||
/* Read the value */
|
||||
if (IS_EXP_EXPR (Type)) {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -63,8 +63,8 @@ struct DbgSym {
|
||||
ObjData* Obj; /* Object file that exports the name */
|
||||
FilePos Pos; /* File position of definition */
|
||||
ExprNode* Expr; /* Expression (0 if not def'd) */
|
||||
const char* Name; /* Name */
|
||||
unsigned char Type; /* Type of symbol */
|
||||
char* Name; /* Name - dynamically allocated */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -114,7 +114,7 @@ void InsertImport (Import* I)
|
||||
unsigned HashVal;
|
||||
|
||||
/* As long as the import is not inserted, V.Name is valid */
|
||||
char* Name = I->V.Name;
|
||||
const char* Name = I->V.Name;
|
||||
|
||||
/* Create a hash value for the given name */
|
||||
HashVal = HashStr (Name) % HASHTAB_SIZE;
|
||||
@@ -134,8 +134,8 @@ void InsertImport (Import* I)
|
||||
if (E->Next == 0) {
|
||||
/* End of list an entry not found, insert a dummy */
|
||||
E->Next = NewExport (0, Name, 0);
|
||||
E = E->Next; /* Point to dummy */
|
||||
++ExpCount; /* One export more */
|
||||
E = E->Next; /* Point to dummy */
|
||||
++ExpCount; /* One export more */
|
||||
break;
|
||||
} else {
|
||||
E = E->Next;
|
||||
@@ -150,14 +150,11 @@ void InsertImport (Import* I)
|
||||
I->Next = E->ImpList;
|
||||
E->ImpList = I;
|
||||
E->ImpCount++;
|
||||
++ImpCount; /* Total import count */
|
||||
++ImpCount; /* Total import count */
|
||||
if (E->Expr == 0) {
|
||||
/* This is a dummy export */
|
||||
++ImpOpen;
|
||||
}
|
||||
|
||||
/* Now free the name since it's no longer needed */
|
||||
xfree (Name);
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +175,7 @@ Import* ReadImport (FILE* F, ObjData* Obj)
|
||||
I = NewImport (Type, Obj);
|
||||
|
||||
/* Read the name */
|
||||
I->V.Name = ReadStr (F);
|
||||
I->V.Name = GetObjString (Obj, ReadVar (F));
|
||||
|
||||
/* Read the file position */
|
||||
ReadFilePos (F, &I->Pos);
|
||||
@@ -328,7 +325,7 @@ Export* ReadExport (FILE* F, ObjData* O)
|
||||
}
|
||||
|
||||
/* Read the name */
|
||||
E->Name = ReadStr (F);
|
||||
E->Name = GetObjString (O, ReadVar (F));
|
||||
|
||||
/* Read the value */
|
||||
if (IS_EXP_EXPR (Type)) {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -65,7 +65,7 @@ struct Import {
|
||||
FilePos Pos; /* File position of reference */
|
||||
union {
|
||||
struct Export* Exp; /* Matching export for this import */
|
||||
char* Name; /* Name if not in table */
|
||||
const char* Name; /* Name if not in table */
|
||||
} V;
|
||||
unsigned char Type; /* Type of import */
|
||||
};
|
||||
@@ -84,7 +84,7 @@ struct Export {
|
||||
ExprNode* Expr; /* Expression (0 if not def'd) */
|
||||
unsigned char Type; /* Type of export */
|
||||
unsigned char ConDes[CD_TYPE_COUNT]; /* Constructor/destructor decls */
|
||||
char* Name; /* Name - dynamically allocated */
|
||||
const char* Name; /* Name */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -468,7 +468,7 @@ ExprNode* ReadExpr (FILE* F, ObjData* O)
|
||||
|
||||
case EXPR_SYMBOL:
|
||||
/* Read the import number */
|
||||
Expr->V.ImpNum = Read16 (F);
|
||||
Expr->V.ImpNum = ReadVar (F);
|
||||
break;
|
||||
|
||||
case EXPR_SECTION:
|
||||
@@ -485,7 +485,7 @@ ExprNode* ReadExpr (FILE* F, ObjData* O)
|
||||
|
||||
/* Not a leaf node */
|
||||
Expr->Left = ReadExpr (F, O);
|
||||
Expr->Right = ReadExpr (F, O);
|
||||
Expr->Right = ReadExpr (F, O);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -52,16 +52,18 @@ Fragment* NewFragment (unsigned char Type, unsigned long Size, Section* S)
|
||||
/* Create a new fragment and insert it into the section S */
|
||||
{
|
||||
/* Allocate memory */
|
||||
Fragment* F = xmalloc (sizeof (Fragment) - 1 + Size); /* Portable? */
|
||||
Fragment* F = xmalloc (sizeof (Fragment) - 1 + Size);
|
||||
|
||||
/* Initialize the data */
|
||||
F->Next = 0;
|
||||
F->Obj = 0;
|
||||
F->Size = Size;
|
||||
F->Expr = 0;
|
||||
F->Next = 0;
|
||||
F->Obj = 0;
|
||||
F->Size = Size;
|
||||
F->Expr = 0;
|
||||
InitFilePos (&F->Pos);
|
||||
F->LI = 0;
|
||||
F->Type = Type;
|
||||
F->LI = 0;
|
||||
F->WarnExpr = 0;
|
||||
F->ErrorExpr = 0;
|
||||
F->Type = Type;
|
||||
|
||||
/* Insert the code fragment into the section */
|
||||
if (S->FragRoot == 0) {
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -69,6 +69,8 @@ struct Fragment {
|
||||
struct ExprNode* Expr; /* Expression if FRAG_EXPR */
|
||||
FilePos Pos; /* File position in source */
|
||||
struct LineInfo* LI; /* Additional line info */
|
||||
struct ExprNode* WarnExpr; /* Print warning if expr true */
|
||||
struct ExprNode* ErrorExpr; /* Print error if expr true */
|
||||
unsigned char Type; /* Type of fragment */
|
||||
unsigned char LitBuf [1]; /* Dynamically alloc'ed literal buffer */
|
||||
};
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@@ -103,6 +103,8 @@ static void LibReadObjHeader (ObjData* O)
|
||||
O->Header.DbgSymSize = Read32 (Lib);
|
||||
O->Header.LineInfoOffs = Read32 (Lib);
|
||||
O->Header.LineInfoSize = Read32 (Lib);
|
||||
O->Header.StrPoolOffs = Read32 (Lib);
|
||||
O->Header.StrPoolSize = Read32 (Lib);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,20 +124,23 @@ static ObjData* ReadIndexEntry (void)
|
||||
O->Start = Read32 (Lib);
|
||||
Read32 (Lib); /* Skip Size */
|
||||
|
||||
/* Read the string pool */
|
||||
ObjReadStrPool (Lib, O);
|
||||
|
||||
/* Skip the export size, then read the exports */
|
||||
Read16 (Lib);
|
||||
(void) ReadVar (Lib);
|
||||
O->ExportCount = ReadVar (Lib);
|
||||
O->Exports = xmalloc (O->ExportCount * sizeof (Export*));
|
||||
for (I = 0; I < O->ExportCount; ++I) {
|
||||
O->Exports [I] = ReadExport (Lib, O);
|
||||
O->Exports[I] = ReadExport (Lib, O);
|
||||
}
|
||||
|
||||
/* Skip the import size, then read the imports */
|
||||
Read16 (Lib);
|
||||
(void) ReadVar (Lib);
|
||||
O->ImportCount = ReadVar (Lib);
|
||||
O->Imports = xmalloc (O->ImportCount * sizeof (Import*));
|
||||
for (I = 0; I < O->ImportCount; ++I) {
|
||||
O->Imports [I] = ReadImport (Lib, O);
|
||||
O->Imports[I] = ReadImport (Lib, O);
|
||||
}
|
||||
|
||||
/* Done */
|
||||
@@ -150,19 +155,19 @@ static void ReadIndex (void)
|
||||
unsigned I;
|
||||
|
||||
/* Read the object file count and allocate memory */
|
||||
ModuleCount = Read16 (Lib);
|
||||
ModuleCount = ReadVar (Lib);
|
||||
Index = xmalloc (ModuleCount * sizeof (ObjData*));
|
||||
|
||||
/* Read all entries in the index */
|
||||
for (I = 0; I < ModuleCount; ++I) {
|
||||
Index [I] = ReadIndexEntry ();
|
||||
Index[I] = ReadIndexEntry ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* High level stuff */
|
||||
/* High level stuff */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -176,7 +181,7 @@ static void LibCheckExports (ObjData* O)
|
||||
|
||||
/* Check all exports */
|
||||
for (I = 0; I < O->ExportCount; ++I) {
|
||||
if (IsUnresolved (O->Exports [I]->Name)) {
|
||||
if (IsUnresolved (O->Exports[I]->Name)) {
|
||||
/* We need this module */
|
||||
O->Flags |= OBJ_REF;
|
||||
break;
|
||||
@@ -187,11 +192,11 @@ static void LibCheckExports (ObjData* O)
|
||||
if (O->Flags & OBJ_REF) {
|
||||
/* Insert the exports */
|
||||
for (I = 0; I < O->ExportCount; ++I) {
|
||||
InsertExport (O->Exports [I]);
|
||||
InsertExport (O->Exports[I]);
|
||||
}
|
||||
/* Insert the imports */
|
||||
for (I = 0; I < O->ImportCount; ++I) {
|
||||
InsertImport (O->Imports [I]);
|
||||
for (I = 0; I < O->ImportCount; ++I) {
|
||||
InsertImport (O->Imports[I]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +220,7 @@ void LibAdd (FILE* F, const char* Name)
|
||||
Header.Magic = LIB_MAGIC;
|
||||
Header.Version = Read16 (Lib);
|
||||
if (Header.Version != LIB_VERSION) {
|
||||
Error ("Wrong data version in `%s'", Name);
|
||||
Error ("Wrong data version in `%s'", Name);
|
||||
}
|
||||
Header.Flags = Read16 (Lib);
|
||||
Header.IndexOffs = Read32 (Lib);
|
||||
@@ -258,7 +263,7 @@ void LibAdd (FILE* F, const char* Name)
|
||||
|
||||
/* Seek to the start of the debug info and read the debug info */
|
||||
fseek (Lib, O->Start + O->Header.DbgSymOffs, SEEK_SET);
|
||||
ObjReadDbgSyms (Lib, O);
|
||||
ObjReadDbgSyms (Lib, O);
|
||||
|
||||
/* Seek to the start of the line infos and read them */
|
||||
fseek (Lib, O->Start + O->Header.LineInfoOffs, SEEK_SET);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -86,6 +86,8 @@ ObjData* NewObjData (void)
|
||||
O->DbgSyms = 0;
|
||||
O->LineInfoCount = 0;
|
||||
O->LineInfos = 0;
|
||||
O->StringCount = 0;
|
||||
O->Strings = 0;
|
||||
|
||||
/* Link it into the list */
|
||||
if (ObjLast) {
|
||||
@@ -105,15 +107,16 @@ ObjData* NewObjData (void)
|
||||
|
||||
|
||||
|
||||
void FreeObjData (ObjData* O)
|
||||
/* Free a complete struct */
|
||||
const char* GetObjString (const ObjData* O, unsigned long Index)
|
||||
/* Get a string from the object file string table. Abort if the string index
|
||||
* is invalid.
|
||||
*/
|
||||
{
|
||||
xfree (O->Name);
|
||||
xfree (O->Imports);
|
||||
xfree (O->Exports);
|
||||
xfree (O->DbgSyms);
|
||||
xfree (O->LineInfos);
|
||||
xfree (O);
|
||||
if (Index >= O->StringCount) {
|
||||
Error ("Invalid string index (%lu) in module `%s'",
|
||||
Index, GetObjFileName (O));
|
||||
}
|
||||
return O->Strings[Index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -76,6 +76,8 @@ struct ObjData {
|
||||
struct DbgSym** DbgSyms; /* List of debug symbols */
|
||||
unsigned LineInfoCount; /* Count of additional line infos */
|
||||
struct LineInfo** LineInfos; /* List of additional line infos */
|
||||
unsigned StringCount; /* Count of strings */
|
||||
char** Strings; /* List of strings used */
|
||||
};
|
||||
|
||||
|
||||
@@ -96,8 +98,10 @@ extern ObjData* ObjLast; /* Last entry in list */
|
||||
ObjData* NewObjData (void);
|
||||
/* Allocate a new structure on the heap, insert it into the list, return it */
|
||||
|
||||
void FreeObjData (ObjData* O);
|
||||
/* Free a complete struct */
|
||||
const char* GetObjString (const ObjData* O, unsigned long Index);
|
||||
/* Get a string from the object file string table. Abort if the string index
|
||||
* is invalid.
|
||||
*/
|
||||
|
||||
const char* GetObjFileName (const ObjData* O);
|
||||
/* Get the name of the object file. Return "[linker generated]" if the object
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -86,7 +86,8 @@ static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name)
|
||||
{
|
||||
H->Version = Read16 (Obj);
|
||||
if (H->Version != OBJ_VERSION) {
|
||||
Error ("Object file `%s' has wrong version", Name);
|
||||
Error ("Object file `%s' has wrong version, expected %08X, got %08X",
|
||||
Name, OBJ_VERSION, H->Version);
|
||||
}
|
||||
H->Flags = Read16 (Obj);
|
||||
H->OptionOffs = Read32 (Obj);
|
||||
@@ -103,6 +104,8 @@ static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name)
|
||||
H->DbgSymSize = Read32 (Obj);
|
||||
H->LineInfoOffs = Read32 (Obj);
|
||||
H->LineInfoSize = Read32 (Obj);
|
||||
H->StrPoolOffs = Read32 (Obj);
|
||||
H->StrPoolSize = Read32 (Obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +182,19 @@ void ObjReadLineInfos (FILE* F, ObjData* O)
|
||||
|
||||
|
||||
|
||||
void ObjReadStrPool (FILE* F, ObjData* O)
|
||||
/* Read the string pool from a file at the current position */
|
||||
{
|
||||
unsigned I;
|
||||
O->StringCount = ReadVar (F);
|
||||
O->Strings = xmalloc (O->StringCount * sizeof (char*));
|
||||
for (I = 0; I < O->StringCount; ++I) {
|
||||
O->Strings[I] = ReadStr (F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ObjReadSections (FILE* F, ObjData* O)
|
||||
/* Read the section data from a file at the current position */
|
||||
{
|
||||
@@ -209,6 +225,10 @@ void ObjAdd (FILE* Obj, const char* Name)
|
||||
O->Name = xstrdup (GetModule (Name));
|
||||
O->Flags = OBJ_HAVEDATA;
|
||||
|
||||
/* Read the string pool from the object file */
|
||||
fseek (Obj, O->Header.StrPoolOffs, SEEK_SET);
|
||||
ObjReadStrPool (Obj, O);
|
||||
|
||||
/* Read the files list from the object file */
|
||||
fseek (Obj, O->Header.FileOffs, SEEK_SET);
|
||||
ObjReadFiles (Obj, O);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
/* common */
|
||||
#include "objdefs.h"
|
||||
|
||||
|
||||
/* ld65 */
|
||||
#include "objdata.h"
|
||||
|
||||
@@ -69,6 +69,9 @@ void ObjReadDbgSyms (FILE* F, ObjData* O);
|
||||
void ObjReadLineInfos (FILE* F, ObjData* O);
|
||||
/* Read the line infos from a file at the current position */
|
||||
|
||||
void ObjReadStrPool (FILE* F, ObjData* O);
|
||||
/* Read the string pool from a file at the current position */
|
||||
|
||||
void ObjReadSections (FILE* F, ObjData* O);
|
||||
/* Read the section data from a file at the current position */
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2001 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* R<EFBFBD>merstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
@@ -259,6 +259,10 @@ Section* ReadSection (FILE* F, ObjData* O)
|
||||
/* Read the fragment type */
|
||||
unsigned char Type = Read8 (F);
|
||||
|
||||
/* Extract the check mask from the type */
|
||||
unsigned char Check = Type & FRAG_CHECKMASK;
|
||||
Type &= ~FRAG_CHECKMASK;
|
||||
|
||||
/* Handle the different fragment types */
|
||||
switch (Type) {
|
||||
|
||||
@@ -305,6 +309,14 @@ Section* ReadSection (FILE* F, ObjData* O)
|
||||
|
||||
}
|
||||
|
||||
/* A check expression may follow */
|
||||
if (Check & FRAG_CHECK_WARN) {
|
||||
Frag->WarnExpr = ReadExpr (F, O);
|
||||
}
|
||||
if (Check & FRAG_CHECK_ERROR) {
|
||||
Frag->ErrorExpr = ReadExpr (F, O);
|
||||
}
|
||||
|
||||
/* Read the file position of the fragment */
|
||||
ReadFilePos (F, &Frag->Pos);
|
||||
|
||||
@@ -506,7 +518,12 @@ void SegWrite (FILE* Tgt, Segment* S, SegWriteFunc F, void* Data)
|
||||
/* Loop over all fragments in this section */
|
||||
Frag = Sec->FragRoot;
|
||||
while (Frag) {
|
||||
|
||||
/* Do fragment alignment checks */
|
||||
|
||||
|
||||
|
||||
/* Output fragment data */
|
||||
switch (Frag->Type) {
|
||||
|
||||
case FRAG_LITERAL:
|
||||
@@ -525,7 +542,7 @@ void SegWrite (FILE* Tgt, Segment* S, SegWriteFunc F, void* Data)
|
||||
case SEG_EXPR_RANGE_ERROR:
|
||||
Error ("Range error in module `%s', line %lu",
|
||||
GetSourceFileName (Frag->Obj, Frag->Pos.Name),
|
||||
Frag->Pos.Line);
|
||||
Frag->Pos.Line);
|
||||
break;
|
||||
|
||||
case SEG_EXPR_TOO_COMPLEX:
|
||||
|
||||
Reference in New Issue
Block a user