Issue |
126731
|
Summary |
eBPF/atomic: error in backend: Cannot select... AtomicStore...
|
Labels |
|
Assignees |
|
Reporter |
richiejp
|
I added `__atomic_store_n` to an eBPF program and the following happened:
```
clang: warning: argument unused during compilation: '--gcc-toolchain=/nix/store/l89iqc7am6i60y8vk507zwrzxf0wcd3v-gcc-14-20241116' [-Wunused-command-line-argument]
fatal error: error in backend: Cannot select: 0x5583e0: ch = AtomicStore<(store monotonic (s64) into %ir.87)> 0x5580d0:1, Constant:i64<0>, 0x557ea0, ./counter.c:256:5 @[ ./counter.c:295:3 @[ ./counter.c:303:3 ] ]
0x6dacd0: i64 = Constant<0>
0x557ea0: i64 = add nuw 0x557960, Constant:i64<16>, ./counter.c:256:28 @[ ./counter.c:295:3 @[ ./counter.c:303:3 ] ]
0x557960: i64,ch = CopyFromReg 0x556608, Register:i64 %7, ./counter.c:254:5 @[ ./counter.c:295:3 @[ ./counter.c:303:3 ] ]
0x6db210: i64 = Register %7
0x6db520: i64 = Constant<16>
In function: xdp_count_packets
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang @/tmp/nix-shell.ZW3Re7/cc-params.DwnvVk
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/home/rich/go/src/github.com/dkorunic/pktstat-bpf/counter.c'.
4. Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@xdp_count_packets'
#0 0x00007fffeafee01c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xfee01c)
#1 0x00007fffeafebd74 llvm::sys::CleanupOnSignal(unsigned long) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xfebd74)
#2 0x00007fffeaedfc22 llvm::CrashRecoveryContext::HandleExit(int) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xedfc22)
#3 0x00007fffeafe25ce llvm::sys::Process::Exit(int, bool) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xfe25ce)
#4 0x00000000004120e6 LLVMErrorHandler(void*, char const*, bool) (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x4120e6)
#5 0x00007fffeaef7bad llvm::report_fatal_error(llvm::Twine const&, bool) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xef7bad)
#6 0x00007fffebc36c1c llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c36c1c)
#7 0x00007fffebc3bc76 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c3bc76)
#8 0x00007fffebc32d59 llvm::SelectionDAGISel::DoInstructionSelection() (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c32d59)
#9 0x00007fffebc3f112 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c3f112)
#10 0x00007fffebc41c2a llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c41c2a)
#11 0x00007fffebc44085 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c44085)
#12 0x00007fffebc32899 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x1c32899)
#13 0x00007fffeb56c9c9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x156c9c9)
#14 0x00007fffeb1b3a61 llvm::FPPassManager::runOnFunction(llvm::Function&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x11b3a61)
#15 0x00007fffeb1b3e1c llvm::FPPassManager::runOnModule(llvm::Module&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x11b3e1c)
#16 0x00007fffeb1b597b llvm::legacy::PassManagerImpl::run(llvm::Module&) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0x11b597b)
#17 0x00007ffff584c0f6 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x224c0f6)
#18 0x00007ffff5d22f93 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2722f93)
#19 0x00007ffff42c290c clang::ParseAST(clang::Sema&, bool, bool) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0xcc290c)
#20 0x00007ffff67dcde9 clang::FrontendAction::Execute() (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x31dcde9)
#21 0x00007ffff6752b4b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x3152b4b)
#22 0x00007ffff6872896 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x3272896)
#23 0x0000000000413f42 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x413f42)
#24 0x000000000040d883 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x40d883)
#25 0x00007ffff634e5f9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2d4e5f9)
#26 0x00007fffeaedfb13 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/nix/store/mgdrglr25yp24y82z4kcfbm9lszsx6q5-llvm-19.1.5-lib/lib/libLLVM.so.19.1+0xedfb13)
#27 0x00007ffff634f0a5 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2d4f0a5)
#28 0x00007ffff6310fc9 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2d10fc9)
#29 0x00007ffff6311a6e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2d11a6e)
#30 0x00007ffff632559c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/nix/store/isxsfmzsxsh1xa3lyh66zkv8w0qziai8-clang-19.1.5-lib/lib/libclang-cpp.so.19.1+0x2d2559c)
#31 0x0000000000410f1a clang_main(int, char**, llvm::ToolContext const&) (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x410f1a)
#32 0x000000000040d244 main (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x40d244)
#33 0x00007fffe982a1fc __libc_start_call_main (/nix/store/65h17wjrrlsj2rj540igylrx7fqcd6vq-glibc-2.40-36/lib/libc.so.6+0x2a1fc)
#34 0x00007fffe982a2b9 __libc_start_main@GLIBC_2.2.5 (/nix/store/65h17wjrrlsj2rj540igylrx7fqcd6vq-glibc-2.40-36/lib/libc.so.6+0x2a2b9)
#35 0x000000000040d2a5 _start (/nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin/clang+0x40d2a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 19.1.5
Target: bpfeb
Thread model: posix
InstalledDir: /nix/store/wrkvgny73b9lbjbkvm21k34kqnj4qsrn-clang-19.1.5/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/nix-shell.ZW3Re7/counter-4ddef8.c
clang: note: diagnostic msg: /tmp/nix-shell.ZW3Re7/counter-4ddef8.sh
clang: note: diagnostic msg:
********************
Error: compile: exit status 1
exit status 1
gen.go:24: running "go": exit status 1
```
Source and run script:
[clang-logs.tar.gz](https://github.com/user-attachments/files/18751118/clang-logs.tar.gz)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs