qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Illegal instruction reported by qemu-ppc with -cpu 7400


From: Khem Raj
Subject: Re: Illegal instruction reported by qemu-ppc with -cpu 7400
Date: Mon, 14 Mar 2022 08:20:04 -0700

On Mon, Mar 14, 2022 at 5:34 AM Matheus K. Ferst
<matheus.ferst@eldorado.org.br> wrote:
>
> On 12/03/2022 23:51, Khem Raj wrote:
> > Hi All
> >
> > I have built an app with musl C library for ppc32 using clang 14.0.0
> > and I am using -mcpu=7400 to compile the whole thing including musl.
> > This fails to run on qemu usermode reporting illegal instruction, a
> > bit of digging revealed that it's caused by opcode in strspn()
> > function from musl where clang is emitting vxor instruction and that's
> > where qemu ppc bails out.
> >
> > Here is asm file generated by clang
> >
> > https://paste.debian.net/1233982/
> >
> > gcc ( 11.2 )
> >
> > https://paste.debian.net/1233983/
> >
> > As you can see the disassembly for gcc does not have vxor or any other
> > altivec instructions in it.
> > When I add -mno-altivec to clang then the issue is gone or when I use
> > -mcpu=power5 the issue is gone too.
> >
> > This is preprocessed strspn.i
> > https://paste.debian.net/1233987/
> >
> > I wonder if qemu-ppc -mcpu 7400 should have understood vxor instruction or 
> > not ?
>
> Hi Khem,
>
> A quick test suggests that vxor is working with -cpu 7400:
> $ cat > vxor.c << EOF
> int main(void)
> {
>      asm volatile ("vxor 2, 2, 2\n\t" ::: "v2");
>      return 0;
> }
> EOF
> $ powerpc64-linux-gnu-gcc -m32 -mcpu=7400 vxor.c -o vxor -static
> $ qemu-ppc -cpu 7400 vxor
> $ echo $?
> 0
>
> Can you show us the command line you used? What version of QEMU are you
> running?


I am using musl based toolchain, clang and qemu cmdline is
qemu-ppc64le -r 3.10.0 -cpu 7400 ....

gdb clearly is at vxor instruction when the system crashes. I also
found another problem
with clang when compiling musl itself where plt.got were not correct,
maybe there is relation
cant say yet.

>
> --
> Matheus K. Ferst
> Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
> Analista de Software
> Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]