X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Fobjfile.c;h=24a9afda81bb3f64c67623acacb23f9493b49f19;hb=35e1184901ca38bdb2e56d154ed3b71f6096eacc;hp=8f7fbe9d67f868e0c7432883cc4fe803afa65e1a;hpb=1f95085ffe4e7a3c76b42db714080ae377e2445e;p=cc65 diff --git a/src/ld65/objfile.c b/src/ld65/objfile.c index 8f7fbe9d6..24a9afda8 100644 --- a/src/ld65/objfile.c +++ b/src/ld65/objfile.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2011, Ullrich von Bassewitz */ +/* (C) 1998-2012, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -34,10 +34,6 @@ #include -#include -#include -#include /* EMX needs this */ -#include /* common */ #include "fname.h" @@ -107,6 +103,8 @@ static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name) H->AssertSize = Read32 (Obj); H->ScopeOffs = Read32 (Obj); H->ScopeSize = Read32 (Obj); + H->SpanOffs = Read32 (Obj); + H->SpanSize = Read32 (Obj); } @@ -196,11 +194,18 @@ void ObjReadDbgSyms (FILE* F, unsigned long Pos, ObjData* O) /* Seek to the correct position */ FileSetPos (F, Pos); - /* Read the data */ + /* Read the asm debug symbols */ DbgSymCount = ReadVar (F); CollGrow (&O->DbgSyms, DbgSymCount); for (I = 0; I < DbgSymCount; ++I) { - CollAppend (&O->DbgSyms, ReadDbgSym (F, O)); + CollAppend (&O->DbgSyms, ReadDbgSym (F, O, I)); + } + + /* Read the hll debug symbols */ + DbgSymCount = ReadVar (F); + CollGrow (&O->HLLDbgSyms, DbgSymCount); + for (I = 0; I < DbgSymCount; ++I) { + CollAppend (&O->HLLDbgSyms, ReadHLLDbgSym (F, O, I)); } } @@ -281,6 +286,25 @@ void ObjReadScopes (FILE* F, unsigned long Pos, ObjData* O) +void ObjReadSpans (FILE* F, unsigned long Pos, ObjData* O) +/* Read the span table from a file at the given offset */ +{ + unsigned I; + unsigned SpanCount; + + /* Seek to the correct position */ + FileSetPos (F, Pos); + + /* Read the data */ + SpanCount = ReadVar (F); + CollGrow (&O->Spans, SpanCount); + for (I = 0; I < SpanCount; ++I) { + CollAppend (&O->Spans, ReadSpan (F, O, I)); + } +} + + + void ObjAdd (FILE* Obj, const char* Name) /* Add an object file to the module list */ { @@ -317,15 +341,20 @@ void ObjAdd (FILE* Obj, const char* Name) /* Read the assertions from the object file */ ObjReadAssertions (Obj, O->Header.AssertOffs, O); - /* Read the scope table from the object file */ - ObjReadScopes (Obj, O->Header.ScopeOffs, O); - - /* Read the segment list from the object file. This must be last, since + /* Read the segment list from the object file. This must be late, since * the expressions stored in the code may reference segments or imported * symbols. */ ObjReadSections (Obj, O->Header.SegOffs, O); + /* Read the scope table from the object file. Scopes reference segments, so + * we must read them after the sections. + */ + ObjReadScopes (Obj, O->Header.ScopeOffs, O); + + /* Read the spans from the object file */ + ObjReadSpans (Obj, O->Header.SpanOffs, O); + /* Mark this object file as needed */ O->Flags |= OBJ_REF;