Skip to content

gtirb-pprinter emits invalid instruction fmov v0,x3 #22

@avncharlie

Description

@avncharlie

When running gtirb pprinter on an arm64 ls binary (Attached: ls_arm64.zip) using the following command:

$ docker run --platform linux/amd64 --rm -v "$(pwd)":/workspace grammatech/ddisasm ddisasm /workspace/ls_arm64 --asm /workspace/out_ls_identity/ls_arm64.S

The generated assembly contains fmov v0,x3 instructions:

$ cat ./out_ls_identity/ls_arm64.S | grep "fmov v0"
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3
            fmov v0,x3

Trying to assemble this code results in this assembler error:

$ gcc -c -o ./ls_arm64.o ./ls_arm64.S -nodefaultlibs -nostartfiles
./ls_arm64.S: Assembler messages:
./ls_arm64.S:29839: Error: the top half of a 128-bit FP/SIMD register is expected at operand 1 -- `fmov v0,x3'
...

I believe the instruction it should emit is: fmov v0.d[1], x3 (this appears to be the corresponding instruction in the binary to the fmov v0,x3 instruction gtirb-pprinter emits).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions