Re: [cc65] Closing down

From: Greg King <>
Date: 2013-04-20 11:19:06
From: "Oliver Schmidt"; on Tuesday, March 19, 2013; at 3:31 AM -0400
> Does anybody happen to remember this posting?
> It says, "... But now, the interruptors import a symbol (a new feature
> added by Uz, for this purpose:
> which is exported by 'callirq'. ...".
> That new feature has a fatal bug I reported via PM; but, Uz didn't fix
> it, in the weeks before officially resigning. So, we don't need
> analysis. We need a fix of ld65.

I believe that I have written, after some head-scratching, what we need.

The bug puts the import symbol into the wrong list.  It's put into the list
of linker-generated, therefore permanent, names.  It should go into the
temporary list of names from the (library) object module that triggerred
that import.  (That list is discarded if the module isn't linked into the
program.)  __CALLIRQ__ is created by the linker; but, we don't want it to
act that way.  We want it to disappear if the interruptor isn't used.

Index: src/ld65/exports.c
--- src/ld65/exports.c  (revision 5990)
+++ src/ld65/exports.c  (working copy)
@@ -398,22 +398,27 @@ Export* ReadExport (FILE* F, ObjData* O)
      * forced import, add this import to the object module.
     for (I = 0; I < CD_TYPE_COUNT; ++I) {
         const ConDesImport* CDI;
         if (E->ConDes[I] != CD_PRIO_NONE && (CDI = ConDesGetImport (I)) != 0) {
             unsigned J;
-            /* Generate a new import and insert it */
-            Import* Imp = InsertImport (GenImport (CDI->Name, CDI->AddrSize));
+            /* Generate a new import, and add it to the list. */
+            Import* Imp = GenImport (CDI->Name, CDI->AddrSize);
+            Imp->Obj = O;
+            CollAppend (&O->Imports, Imp);
-            /* Add line info for the config file and for the export that is
-             * actually the condes that forces the import.
+            /* Add line info for the export that is actually the condes that
+             * forces the import.  Then, add line info for the config. file.
+             * The export's info is added first because the import pretends
+             * that it came from the object module instead of the config. file.
-            CollAppend (&Imp->RefLines, GenLineInfo (&CDI->Pos));
             for (J = 0; J < CollCount (&E->DefLines); ++J) {
                 CollAppend (&Imp->RefLines, DupLineInfo (CollAt (&E->DefLines, J)));
+            CollAppend (&Imp->RefLines, GenLineInfo (&CDI->Pos));
     /* Return the new export */

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 23 18:44:32 2013

This archive was generated by hypermail 2.1.8 : 2013-08-23 18:45:04 CEST