llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

` __builtin_ffs` leads to fatal error: error in backend: unimplemented opcode: 191 for EBPF target #102819

Closed kxxt closed 1 month ago

kxxt commented 3 months ago
         fatal error: error in backend: unimplemented opcode: 191
         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: clang -I /home/kxxt/repos/tracexec/include -D __x86_64__ -D MAX_CPUS=64 -DEBPF_DEBUG -I /tmp/.tmpgbf4Bd/bpf/src -fno-stack-protector -D__TARGET_ARCH_x86 -g -O2 -target bpf -c src/bpf/tracexec_system.bpf.c -o /tmp/.tmpERpdkV/tracexec_system.o
         1.     <eof> parser at end of file
         2.     Code generation
         3.     Running pass 'Function Pass Manager' on module 'src/bpf/tracexec_system.bpf.c'.
         4.     Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@read_fds_impl'
         Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
         0  libLLVM.so.18.1      0x000072da479c4d90 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 64
         1  libLLVM.so.18.1      0x000072da479c226d llvm::sys::CleanupOnSignal(unsigned long) + 141
         2  libLLVM.so.18.1      0x000072da478a8e4a llvm::CrashRecoveryContext::HandleExit(int) + 74
         3  libLLVM.so.18.1      0x000072da479babe6 llvm::sys::Process::Exit(int, bool) + 38
         4  clang                0x00005c6cd089fef6
         5  libLLVM.so.18.1      0x000072da478c0555 llvm::report_fatal_error(llvm::Twine const&, bool) + 117
         6  libLLVM.so.18.1      0x000072da4b0cf1f8
         7  libLLVM.so.18.1      0x000072da484146c7
         8  libLLVM.so.18.1      0x000072da48417229 llvm::SelectionDAG::Legalize() + 697
         9  libLLVM.so.18.1      0x000072da485d9810 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 496
         10 libLLVM.so.18.1      0x000072da485dcd69 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 6521
         11 libLLVM.so.18.1      0x000072da485deeb7
         12 libLLVM.so.18.1      0x000072da485e08f1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 33
         13 libLLVM.so.18.1      0x000072da47f2f72d
         14 libLLVM.so.18.1      0x000072da47b830d3 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1187
         15 libLLVM.so.18.1      0x000072da47b834a4 llvm::FPPassManager::runOnModule(llvm::Module&) + 52
         16 libLLVM.so.18.1      0x000072da47b84f6f llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1167
         17 libclang-cpp.so.18.1 0x000072da50954b8f 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*) + 4687
         18 libclang-cpp.so.18.1 0x000072da50cda495 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1253
         19 libclang-cpp.so.18.1 0x000072da4f98d013 clang::ParseAST(clang::Sema&, bool, bool) + 723
         20 libclang-cpp.so.18.1 0x000072da514583d1 clang::FrontendAction::Execute() + 433
         21 libclang-cpp.so.18.1 0x000072da513f9017 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 439
         22 libclang-cpp.so.18.1 0x000072da514b067d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 445
         23 clang                0x00005c6cd08a63a4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 8900
         24 clang                0x00005c6cd08aa70a
         25 libclang-cpp.so.18.1 0x000072da5112e405
         26 libLLVM.so.18.1      0x000072da478a8d3a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 42
         27 libclang-cpp.so.18.1 0x000072da51130d96
         28 libclang-cpp.so.18.1 0x000072da510ebfb9 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 169
         29 libclang-cpp.so.18.1 0x000072da510ec3bc clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 252
         30 libclang-cpp.so.18.1 0x000072da5110a7e4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 388
         31 clang                0x00005c6cd08ad045 clang_main(int, char**, llvm::ToolContext const&) + 9669
         32 clang                0x00005c6cd089dfd5 main + 133
         33 libc.so.6            0x000072da46c34e08
         34 libc.so.6            0x000072da46c34ecc __libc_start_main + 140
         35 clang                0x00005c6cd089e035 _start + 37
         clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
         clang version 18.1.8
         Target: bpf
         Thread model: posix
         InstalledDir: /usr/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/tracexec_system-133b42.c
         clang: note: diagnostic msg: /tmp/tracexec_system-133b42.sh
         clang: note: diagnostic msg: 

         ********************

tracexec_system-133b42.zip

s-barannikov commented 2 months ago

Likely a duplicate of #62252. Doesn't reproduce on trunk.

yonghong-song commented 1 month ago

Looks like llvm17/llvm18 failed but llvm19/llvm20 are okay.

kxxt commented 1 month ago

Does LLVM still maintain 17 and 18? If not I think this issue can be closed.

EugeneZelenko commented 1 month ago

@kxxt: Only most recent release (19 as of now) is maintained.