qemu-system-arm failure with picolibc tests since 59754f85

This is sort of similar to #2326 (closed) but unlike that one, it is not fixed by 4c2c0474.

Doing a picolibc test run, there are numerous failures since this commit. For example:

./qemu-system-arm \
  -m 1G \
  -chardev stdio,mux=on,id=stdio0 \
  -semihosting-config enable=on,chardev=stdio0,arg=program-name \
  -monitor none \
  -serial none \
  -machine none,accel=tcg \
  -cpu cortex-a8 \
  -device loader,file=/tmp/picolibc-1.8.6/arm-none-eabi/test/printf_scanf_thumb_v7_fp_softfp,cpu-num=0 \
  -nographic 

Before this commit, it produces (with successful exit code):

hello world 1
checking floating point
checking pos args
checking long long
checking c99 formats 

And after, it fails:

hello world 1
checking floating point
checking pos args
ARM fault: undef
    R0:   0x00000002
    R1:   0x00005c90
    R2:   0x201ffeac
    R3:   0x20200000
    R4:   0x00000000
    R5:   0x20000004
    R6:   0x201ffec4
    PC:   0x00000364 

Another test:

./qemu-system-arm \
  -m 1G \
  -chardev stdio,mux=on,id=stdio0 \
  -semihosting-config enable=on,chardev=stdio0,arg=program-name \
  -monitor none \
  -serial none \
  -machine none,accel=tcg \
  -cpu cortex-a7 \
  -device loader,file=/tmp/picolibc-1.8.6/arm-none-eabi/newlib/testsuite/newlib.string/tstring_thumb_v7_nofp,cpu-num=0 \
  -nographic 

Before this commit it finishes successfully instantly, while after it, this test sits here doing nothing ad infinitum.

As of afaee42f (which is very close to 9.1.0-tobe), it is still unfixed.

I'm attaching the two binaries mentioned above to simplify testing: picolibc-test-files.tar.gz

Edited by Michael Tokarev