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