Skip to content

llvm-objdump emits <unknown> and wrong register names when using "smc" and "TTBR0_EL2" on arm64(aarch64) #53956

@PG-MANA

Description

@PG-MANA

When I disassembly the aarch64 binary containg "smc 0" and "mrs x0, TTBR0_EL2", I found the result of "llvm-objdump -d " are different between llvm13 and llvm14.
llvm14-objdump emits "smc 0" as "<unknown>", and " mrs x0, TTBR0_EL2" as "mrs x0, S3_4_C2_C0_0".
llvm13-objdump seems printing correctly.

Test Code

//test.c
int main(void) {
        asm volatile ("smc 0");
        asm volatile ("mrs x0, TTBR0_EL2");
        return 0;
}

LLVM Version

I installed llvm 13 and 14 from https://apt.llvm.org/ on ubuntu.

$ llvm-objdump-13 --version
Ubuntu LLVM version 13.0.1

$ llvm-objdump-14 --version
Ubuntu LLVM version 14.0.0

Compile Command

$ clang-14 --target=aarch64-none-elf  -ffreestanding  -c test.c

Result

$ llvm-objdump-13 -d test.o

test.o: file format elf64-littleaarch64

Disassembly of section .text:

0000000000000000 <main>:
       0: 03 00 00 d4   smc     #0
       4: 00 20 3c d5   mrs     x0, TTBR0_EL2
       8: e0 03 1f 2a   mov     w0, wzr
       c: c0 03 5f d6   ret

$ llvm-objdump-14 -d test.o

test.o: file format elf64-littleaarch64

Disassembly of section .text:

0000000000000000 <main>:
       0: 03 00 00 d4   <unknown>
       4: 00 20 3c d5   mrs     x0, S3_4_C2_C0_0
       8: e0 03 1f 2a   mov     w0, wzr
       c: c0 03 5f d6   ret

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions