]> git.sur5r.net Git - cc65/blobdiff - src/ld65/dbgsyms.c
support for .zeropage segment in GEOS
[cc65] / src / ld65 / dbgsyms.c
index 911dedab9239d518311446ba321f550fb14a6651..e728c2907630d1e789920d07c56e1260e4027745 100644 (file)
@@ -2,14 +2,14 @@
 /*                                                                           */
 /*                                dbgsyms.c                                 */
 /*                                                                           */
-/*                Debug symbol handing for the ld65 linker                  */
+/*                Debug symbol handling for the ld65 linker                 */
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998     Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 1998-2000 Ullrich von Bassewitz                                       */
+/*               Wacholderweg 14                                             */
+/*               D-70597 Stuttgart                                           */
+/* EMail:        uz@musoftware.de                                            */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -39,7 +39,7 @@
 #include "check.h"
 #include "symdefs.h"
 #include "xmalloc.h"
-         
+
 /* ld65 */
 #include "global.h"
 #include "error.h"
@@ -69,14 +69,11 @@ static DbgSym*      DbgSymPool [256];
 
 
 
-static DbgSym* NewDbgSym (unsigned char Type, const char* Name, ObjData* O)
+static DbgSym* NewDbgSym (unsigned char Type, ObjData* O)
 /* Create a new DbgSym and return it */
 {
-    /* Get the length of the symbol name */
-    unsigned Len = strlen (Name);
-
     /* Allocate memory */
-    DbgSym* D = xmalloc (sizeof (DbgSym) + Len);
+    DbgSym* D = xmalloc (sizeof (DbgSym));
 
     /* Initialize the fields */
     D->Next     = 0;
@@ -84,8 +81,7 @@ static DbgSym* NewDbgSym (unsigned char Type, const char* Name, ObjData* O)
     D->Obj      = O;
     D->Expr            = 0;
     D->Type            = Type;
-    memcpy (D->Name, Name, Len);
-    D->Name [Len] = '\0';
+    D->Name    = 0;
 
     /* Return the new entry */
     return D;
@@ -143,20 +139,19 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O)
 /* Read a debug symbol from a file, insert and return it */
 {
     unsigned char Type;
-    char Name [256];
     DbgSym* D;
 
     /* Read the type */
     Type = Read8 (F);
 
-    /* Read the name */
-    ReadStr (F, Name);
+    /* Create a new debug symbol */
+    D = NewDbgSym (Type, O);
 
-    /* Create a new export */
-    D = NewDbgSym (Type, Name, O);
+    /* Read and assign the name */
+    D->Name = ReadStr (F);
 
     /* Read the value */
-    if (Type & EXP_EXPR) {
+    if (IS_EXP_EXPR (Type)) {
                D->Expr = ReadExpr (F, O);
     } else {
        D->Expr = LiteralExpr (Read32 (F), O);