OABI calling convention was broken since the addition of the hardfloat calling convention in commit 7f6095bfec82b178084b22b33941d4f06155e514. This commit fixes the breakage.
Unified · Split
| @@ -829,7 +829,7 @@ void gfunc_call(int nb_args) · 828 unmodified lines | ||
| 829 | 829 | --nb_args; |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | − vpushi(0); | |
| 832 | + vpushi(0), nb_args++; | |
| 833 | 833 | vtop->type.t = VT_LLONG; |
| 834 | 834 | args_size = 0; |
| 835 | 835 | #endif |
| @@ -845,7 +845,7 @@ void gfunc_call(int nb_args) · 9 unmodified lines | ||
| 845 | 845 | structures in the first zone are moved just after the SValue pointed by |
| 846 | 846 | before_vfpreg_hfa. SValue's representing structures in the second zone are |
| 847 | 847 | moved just after the SValue pointer by before_stack. */ |
| 848 | − for(i = nb_args + 1 ; i-- ;) { | |
| 848 | + for(i = nb_args; i-- ;) { | |
| 849 | 849 | int j, assigned_vfpreg = 0; |
| 850 | 850 | size = type_size(&vtop[-i].type, &align); |
| 851 | 851 | switch(vtop[-i].type.t & VT_BTYPE) { |
| @@ -920,9 +920,11 @@ void gfunc_call(int nb_args) · 68 unmodified lines | ||
| 920 | 920 | } |
| 921 | 921 | continue; |
| 922 | 922 | default: |
| 923 | +#ifdef TCC_ARM_EABI | |
| 923 | 924 | if (!i) { |
| 924 | 925 | break; |
| 925 | 926 | } |
| 927 | +#endif | |
| 926 | 928 | if (ncrn < 4) { |
| 927 | 929 | int is_long = (vtop[-i].type.t & VT_BTYPE) == VT_LLONG; |
| 928 | 930 | |
| @@ -953,7 +955,9 @@ void gfunc_call(int nb_args) · 24 unmodified lines | ||
| 953 | 955 | #endif |
| 954 | 956 | args_size += (size + 3) & -4; |
| 955 | 957 | } |
| 956 | − vtop--; | |
| 958 | +#ifdef TCC_ARM_EABI | |
| 959 | + vtop--, nb_args--; | |
| 960 | +#endif | |
| 957 | 961 | args_size = keep = 0; |
| 958 | 962 | for(i = 0;i < nb_args; i++) { |
| 959 | 963 | vrotb(keep+1); |