Menu

#144 Fix for bug 2819835

closed-accepted
z80 port (16)
5
2009-09-20
2009-09-07
Randal Lux
No

When linking for z80, the -o option causes sdcc to delete the .ihx and .map files, rather than rename them.
link-z80 names it's output using the -o filename itself (but it always gives it extension of .ihx or .s19).
The current -o implementation assumes the linker named output after the first linked module, and deletes the
-o filename in preparation to rename the linker output with that name.

In the case with "-o anything.ihx" it deletes the newly linked file!

With "-o anything.anything_but_ihx", such as "-o myfile.hex", the file is not deleted, but it is named "myfile.ihx" instead of "myfile.hex".

In all cases the .map file is deleted.

This patch simply causes sdcc to use the name link-z80 gave it's output when it tries to rename.
(link-z80 only uses the base filename from the -o, not the extension. The rename is still needed for cases where the extension
is other than .ihx.)

I did not adjust the indent of the code in the "else" clause of the new "if", because it makes it easier to see what is added.
Let me know if I should adjust the indent, I'd be happy to if needed. Also, I could add/adjust comments in surrounding code.
This is the first patch I have submitted to ANY project, so I did not want to get carried away with changes. :-)

Discussion

  • Randal Lux

    Randal Lux - 2009-09-07

    fixes -o for z80 linking

     
  • Philipp Klaus Krause

    Applied in #5518.

     
  • Philipp Klaus Krause

    • assigned_to: nobody --> spth
    • status: open --> closed-accepted
     

Log in to post a comment.