]> git.sur5r.net Git - cc65/blobdiff - src/ld65/mapfile.c
Added classification macros for file types from struct dirent.
[cc65] / src / ld65 / mapfile.c
index c1bc4cf90e6e5e074853d7938c313e88e4d83e71..6dc4ffb60cb1663c015a9df7237d8248d899e1f8 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2005 Ullrich von Bassewitz                                       */
-/*               Römerstraße 52                                              */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 1998-2010, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -43,6 +43,7 @@
 #include "exports.h"
 #include "global.h"
 #include "error.h"
+#include "library.h"
 #include "mapfile.h"
 #include "objdata.h"
 #include "segments.h"
@@ -80,20 +81,23 @@ void CreateMapFile (int ShortMap)
         const ObjData* O = CollConstAt (&ObjDataList, I);
 
         /* Output the data */
-        if (O->LibName != INVALID_STRING_ID) {
+        if (O->Lib) {
             /* The file is from a library */
-            fprintf (F, "%s(%s):\n", GetString (O->LibName), GetObjFileName (O));
+            fprintf (F, "%s(%s):\n", GetLibFileName (O->Lib), GetObjFileName (O));
         } else {
             fprintf (F, "%s:\n", GetObjFileName (O));
         }
-        for (J = 0; J < O->SectionCount; ++J) {
-            const Section* S = O->Sections [J];
+        for (J = 0; J < CollCount (&O->Sections); ++J) {
+            const Section* S = CollConstAt (&O->Sections, J);
             /* Don't include zero sized sections if not explicitly
              * requested
              */
             if (VerboseMap || S->Size > 0) {
-                fprintf (F, "    %-17s Offs = %06lX   Size = %06lX\n",
-                         GetString (S->Seg->Name), S->Offs, S->Size);
+                fprintf (F, 
+                         "    %-17s Offs=%06lX  Size=%06lX  "
+                         "Align=%05lX  Fill=%04lX\n",
+                         GetString (S->Seg->Name), S->Offs, S->Size,
+                         S->Alignment, S->Fill);
             }
         }
     }
@@ -131,29 +135,17 @@ void CreateMapFile (int ShortMap)
 void CreateLabelFile (void)
 /* Create a label file */
 {
-    unsigned I;
-
     /* Open the label file */
     FILE* F = fopen (LabelFileName, "w");
     if (F == 0) {
        Error ("Cannot create label file `%s': %s", LabelFileName, strerror (errno));
     }
 
-    /* Clear the debug sym table (used to detect duplicates) */
-    ClearDbgSymTable ();
-
     /* Print the labels for the export symbols */
     PrintExportLabels (F);
 
-    /* Create labels from all modules we have linked into the output file */
-    for (I = 0; I < CollCount (&ObjDataList); ++I) {
-
-        /* Get the object file */
-        ObjData* O = CollAtUnchecked (&ObjDataList, I);
-
-        /* Output the labels */
-       PrintDbgSymLabels (O, F);
-    }
+    /* Output the labels */
+    PrintDbgSymLabels (F);
 
     /* Close the file */
     if (fclose (F) != 0) {