xref: /llvm-project/llvm/test/tools/llvm-objdump/ELF/RISCV/unknown-arch-attr.test (revision 6cba93f25dc2014b5d8c71c739f17be1d8c3763a)
1d1bcddb5SFangrui Song## Handle unrecognized arch attributes.
2d1bcddb5SFangrui Song## Encode an unrecognized arch feature into an object file and try to decode it.
3d1bcddb5SFangrui Song## The expected behavior is to ignore the unrecognized arch feature and
4d1bcddb5SFangrui Song## continue to process the following arch features.
5d1bcddb5SFangrui Song##
6*6cba93f2SCraig Topper## The object file has the "rv32i2p0_m2p0_y1p0" arch feature. "y1p0" is an
7d1bcddb5SFangrui Song## unrecognized architecture extension. llvm-objdump will ignore it and decode
8d1bcddb5SFangrui Song## "mul" instruction correctly according to "m2p0" in the arch feature.
9d1bcddb5SFangrui Song##
10d1bcddb5SFangrui Song## This test cannot be assembly because the test needs an unrecognized arch
11d1bcddb5SFangrui Song## feature and `llvm-mc` will filter out the unrecognized arch feature.
12d1bcddb5SFangrui Song
13d1bcddb5SFangrui Song# RUN: yaml2obj %s -D BITS=32 -o %t.32.o
14d1bcddb5SFangrui Song# RUN: llvm-objdump -d %t.32.o \
15d1bcddb5SFangrui Song# RUN:   | FileCheck %s --check-prefixes=DISASM
16d1bcddb5SFangrui Song# RUN: yaml2obj %s -D BITS=64 -o %t.64.o
17d1bcddb5SFangrui Song# RUN: llvm-objdump -d %t.64.o \
18d1bcddb5SFangrui Song# RUN:   | FileCheck %s --check-prefixes=DISASM
19d1bcddb5SFangrui Song
20d1bcddb5SFangrui Song# DISASM: mul a0, a1, a2
21d1bcddb5SFangrui Song
22d1bcddb5SFangrui Song--- !ELF
23d1bcddb5SFangrui SongFileHeader:
24d1bcddb5SFangrui Song  Class:   ELFCLASS[[BITS]]
25d1bcddb5SFangrui Song  Data:    ELFDATA2LSB
26d1bcddb5SFangrui Song  Type:    ET_REL
27d1bcddb5SFangrui Song  Machine: EM_RISCV
28d1bcddb5SFangrui SongSections:
29d1bcddb5SFangrui Song  - Name:    .text
30d1bcddb5SFangrui Song    Type:    SHT_PROGBITS
31d1bcddb5SFangrui Song    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
32d1bcddb5SFangrui Song## The content is the encoding of "mul a0, a1, a2".
33d1bcddb5SFangrui Song## The encoding could be decoded only when the "m" extension is enabled.
34d1bcddb5SFangrui Song    Content: 3385C502
35d1bcddb5SFangrui Song  - Name:    .riscv.attributes
36d1bcddb5SFangrui Song    Type:    SHT_RISCV_ATTRIBUTES
37*6cba93f2SCraig Topper## The content is the encoding of the arch feature "rv32i2p0_m2p0_y1p0"
38*6cba93f2SCraig Topper    Content: 412300000072697363760001190000000572763332693270305F6D3270305F7931703000
39