Menu

#2599 Small-C calling convention test fails for mcs51

closed-wont-fix
None
MCS51
5
2017-05-14
2017-04-12
No

The regression test smallc.c fails for the stack-auto variants of mcs51. This is a bug, but probably not a very important one. AFAIK, all or most users of the Small-C calling convention use z80-related backends.

Philipp

Discussion

  • Maarten Brock

    Maarten Brock - 2017-04-27

    When I search for small-C the only target in common with SDCC I can find is the Z80.

    Can I assume that there is no specification for Small-C and more specifically for its calling convention, making the original implementation the standard?

    My suggestion is to make __smallc a Z80 specific keyword.

     
    • Philipp Klaus Krause

      I'm not sure about the current state of support, but AFAIR, the Small-C-derived compiler developed by z88dk (and which AFAIK is still their default, though they now also support SDCC well) also supports or supported the other z80-related targets SDCC has (except for tlcs90).

      Philipp

       
      • Maarten Brock

        Maarten Brock - 2017-04-27

        I meant to say a Z80-like targets specific keyword. Or in other words, not accepted for ds390/mcs51/hc08/stm8/pic.

         
  • alvin

    alvin - 2017-04-27

    When I search for small-C the only target in common with SDCC I can find is the Z80.

    You'll find small C connected with the 8080, 8085, 8088, z80, 6502, 68xx. It had a lot of influence on compilers of that era because it was given away for free.

    Can I assume that there is no specification for Small-C and more specifically for its calling convention, making the original implementation the standard?

    Yes the original Small-C defined the convention. There might have been influence from Pascal because I can't think of any other reason to go left to right. It doesn't fit well with vararg functions where an additional parameter has to be passed to the function to tell it how many items are on the stack.

    the Small-C-derived compiler developed by z88dk also supports or supported the other z80-related targets SDCC has.

    sccz80 supports the z80, z180 and r2k.

    There are two assembly language libraries in z88dk. One is written for small-C linkage and the new one has separated asm implementation from C interface so that it can use any linkage. For sdcc, the new library uses R->L.

     
  • Maarten Brock

    Maarten Brock - 2017-05-14
    • status: open --> closed-wont-fix
    • assigned_to: Maarten Brock
     
  • Maarten Brock

    Maarten Brock - 2017-05-14

    In [r9904] I've made __smallc a stm8 and z80-related only keyword.

     

Log in to post a comment.