<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61388>61388</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-objdump gives <unknown> for RISC-V Vector (RVV) instruction
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
negge
</td>
</tr>
</table>
<pre>
I wrote a simple test program using the RISC-V Vector extension 1.0:
```nasm
.global _start
_start:
vsetvli t0, a2, e32
addi a0, x0, 0
addi a7, x0, 93
ecall
```
```
$ as -march=rv64gcv test.as -o test.o
$ ld test.o -o test
```
When I disassemble the ELF file with binutils objdump, it correctly decodes the vsetvli instruction:
```
$ objdump -d test.o
test.o: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <_start>:
0: 010672d7 vsetvli t0,a2,e32,m1,tu,mu
4: 4501 li a0,0
6: 05d00893 li a7,93
a: 00000073 ecall
```
However, using llvm-objdump I get an <unknown> for this instruction:
```
$ llvm-objdump -d test.o
test.o: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <_start>:
0: d7 72 06 01 <unknown>
4: 01 45 li a0, 0
6: 93 08 d0 05 li a7, 93
a: 73 00 00 00 ecall
```
Note, if I pass --mattr=+V to llvm-objdump it *does* correctly decode this instruction:
```
$ llvm-objdump -d --mattr=+V riscv/test.o
riscv/test.o: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <_start>:
0: d7 72 06 01 vsetvli t0, a2, e32, m1, tu, mu
4: 01 45 li a0, 0
6: 93 08 d0 05 li a7, 93
a: 73 00 00 00 ecall
```
However, the extension information is already encoded in the attributes of the ELF file, see `v1p0` below:
```
$ llvm-readelf -A riscv/test.o
BuildAttributes {
FormatVersion: 0x41
Section 1 {
SectionLength: 157
Vendor: riscv
Tag: Tag_File (0x1)
Size: 147
FileAttributes {
Attribute {
Tag: 5
TagName: arch
Value: rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_v1p0_zicsr2p0_zifencei2p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0
}
}
}
}
```
Is it possible to correctly decode the enabled extensions by default?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVkuP4ygQ_jXkUkqEwY_4kEM_JtqWRnOYGWWPLWzKDrPYRAanu-fXryBObKez85B2pUUtukIVVUV9H2WEtapuETckuSfJ40L0bm-6TYt1jYvCyLfNE7x0xiEIsKo5aASH1sGhM3UnGuitamtwe4TPT18eljvYYelMB_jqsLXKtBCtKOF3hD4Sep5TevprhW1OS6tam0JoeLZOdG5qPKycPcDRojtqBY4S9gCC-Rk5G7QgpFQggu41zHSuyUZNzgcVlkLrq9Ru5jv8ZDEIC8tGdOWe8MfumMZ1eQx1WXmFOYlmNNdyWDorfxDtzz228ARSWWEtNoWv-B7hw8ctVEojvCi3h0K1vVPagim-yb45-PMoB6XpOiydfgOJpZFow9ZzyVRrXdeXTpn2nxAZUx4cw_KS-nTDcEB-B36EvCrTNcIB6iqNl1o5p7FTtjzO4oT58XK0NzAVWAwpwcrhq7tKjF4NIPzhzIgPIykAThzLaUTTjMkMCM2HYxOaB64EqnimsIcmIuzB9V7qLx7ik4c4oRFcDULz4Cfw6kyodIiYSErXOb9h7bl2IRmAGDaEkXFv9zPm_WFe8IidR_d00bQ-NsszNE9QowPR-qL07V-teWkJ_-CBALdX9vfwnnn-CeiE5r8M-X8BNgyAg8wgY0BToJEv56wOM2sPrjeKk5uYjl0iDA8t5BzoGiQFmswhhQmmMOAKGQdKh78JsvkPwP1kHIZ7W8ETHIS1sFw2wrmO8EfC7nfgzBwV5YCwO2nQEnb37q7_C5hfxT9hybY3qDBX_Y8pcdUEJh8M9gChD0BoBDDpBL9DmHdU-U2u_BpVJn3AN_Tx46raU8GDbEHoDoV8A2w9IySoNth7UFXRO7S-3tOvifdoEYGk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