Issue 76231
Summary [RISCV] Incomplete llvm-objdump disassembly when using LTO
Labels new issue
Assignees
Reporter andcarminati
    I detected the following problem related to LTO. Considering the following use case:

A simple C program :

```
int __attribute__((used)) main(){
}
```

If we build it with:

```
clang  --target=riscv32 -march=rv32imafdc -mabi=ilp32d  -O1 sample.c -o sample.elf 
```

We get with llvm-objdump:

```
Disassembly of section .text:

000110d4 <main>:
   110d4: 01 45         li      a0, 0
   110d6: 82 80 ret
```


But, if we build it with:

```
clang --target=riscv32 -march=rv32imafdc -mabi=ilp32d  -O1 sample.c -o sample.elf -flto
```

Then we have:

```
Disassembly of section .text:

000110d4 <main>:
   110d4: 01 45         <unknown>
 110d6: 82 80         <unknown>
```

It seems that it is related to the ELF attributes, under LTO they became incomplete in the final elf. The disassembler cannot decode because the feature flags are not present in the MCSubtarget.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to