Hi, I got one test that failed by using the mainline GCC on the target of mipsisa32r2-elf. The handling of stack pointer or frame pointer may be broken. Thanks!
Ex: # mipsisa32r2-elf-gcc -o bug126 -Tidt32.ld bug126.c # mipsisa32r2-elf-run bug126 mips-core: 4 byte read to unmapped address 0x4 at 0x80020348 program stopped with signal 10. # cat bug126.c int check_var (int z, ...) { } int main () { check_var (2); return 0; } (big126.s) check_var: .frame $fp,80,$31 .mask 0x40000000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro addiu $sp,$sp,-80 sw $fp,76($sp) <---------- move $fp,$sp sw $5,52($fp) sw $6,56($fp) sw $7,60($fp) sw $8,64($fp) sw $9,68($fp) sw $10,72($fp) sw $11,76($fp) <---------- Data is written again. sdc1 $f12,16($fp) sdc1 $f14,24($fp) sdc1 $f16,32($fp) sdc1 $f18,40($fp) sw $4,0($fp) move $sp,$fp lw $fp,76($sp) <---------- FP is wrong. addiu $sp,$sp,80 j $31 nop .set macro .set reorder .end check_var .size check_var, .-check_var .align 2 .globl main .ent main main: .frame $fp,8,$31 .mask 0xc0000000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro addiu $sp,$sp,-8 sw $31,4($sp) sw $fp,0($sp) move $fp,$sp li $4,2 jal check_var nop move $2,$0 move $sp,$fp <----------- SP is wrong. lw $31,4($sp) <---------- FAIL lw $fp,0($sp) addiu $sp,$sp,8 j $31 nop Regards, Chao-ying