Greetings Daniel, while reading code in arm-gen.c recently I stumbled upon what I think is a bug I introduced with the hard float calling convention. Two places in register assignment code assume that at the top of the value stack (the place pointed by vtop) is a LLONG pushed for 8 bytes alignment of the stack at function call. As you know it, it's only true with EABI (hard float variant or not). I made a quick patch but I don't have a non EABI system to test it.
Could you try to compile a function with only 1 argument with gcc and then, with and without the attached patch to: - compile another file containing the call to this function; - link it to the file containing the function compiled with gcc? Once this issue will be sorted out, I'll start splitting gfunc_call for arm in several functions and add more comments. It's really needed for other people to understand the code without spending too much time on it. Best regards, Thomas
diff --git a/arm-gen.c b/arm-gen.c index ea12fd6..4df0696 100644 --- a/arm-gen.c +++ b/arm-gen.c @@ -920,9 +920,11 @@ void gfunc_call(int nb_args) } continue; default: +#ifdef TCC_ARM_EABI if (!i) { break; } +#endif if (ncrn < 4) { int is_long = (vtop[-i].type.t & VT_BTYPE) == VT_LLONG; @@ -953,7 +955,9 @@ void gfunc_call(int nb_args) #endif args_size += (size + 3) & -4; } +#ifdef TCC_ARM_EABI vtop--; +#endif args_size = keep = 0; for(i = 0;i < nb_args; i++) { vrotb(keep+1);
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel