Created attachment 1476812 [details] Testing source code file Description of problem: clang -target bpf generates unknown opcode 8d. It doesn't generate this opcode when run with -O2. Version-Release number of selected component (if applicable): clang-6.0.1-1.fc28.x86_64 kernel-4.16.12-300.fc28.x86_64 How reproducible: 100% Steps to reproduce: Compile attached C source code file using: $ clang -target bpf -c -o kprobes_kern.o kprobes_kern.c Then use bpf_load.c from Linux source code tree to load it. BPF in-kernel verifier declines to load this file with following error: # ./kprobes bpf_load_program() err=Invalid argument unknown opcode 8d unknown opcode 8d This problem goes away when the same code is compiled with -O2.
Upstream has fixed this by emitting an error message rather than producing illegal code. The backend can't always handle the LLVM IR produced at -O0, so don't expect -O0 to work and use -O2 instead.
Fixed in rawhide by llvm-7.0.0-0.13.rc3.fc30.