topperc wrote:
> I see a crash when building the RISC-V vDSO in the Linux kernel with this
> change in its current form. `cvise` spits out:
>
> ```c
> int vdso_u_arch_data, riscv_vdso_get_values_cpus, riscv_vdso_get_values_end;
> int riscv_vdso_get_values() {
> int avd = vdso_u_arch_data;
> _Bool all_cpus = riscv_vdso_get_values_cpus;
> if (all_cpus && avd & riscv_vdso_get_values_end)
> ;
> return 0;
> }
> ```
>
> ```
> $ clang --target=riscv64-linux-gnu -c -o /dev/null hwprobe.i
>
> $ clang --target=riscv64-linux-gnu -fzero-call-used-regs=used-gpr -c -o
> /dev/null hwprobe.i
> Unhandled encodeInstruction length!
> UNREACHABLE executed at
> llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp:485!
> 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 --target=riscv64-linux-gnu
> -fzero-call-used-regs=used-gpr -c -o /dev/null hwprobe.i
> 1. <eof> parser at end of file
> 2. Code generation
> 3. Running pass 'Function Pass Manager' on module 'hwprobe.i'.
> 4. Running pass 'RISC-V Assembly Printer' on function
> '@riscv_vdso_get_values'
> #0 0x0000555f0e67e926 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
> (clang-23+0x6466926)
> #1 0x0000555f0e67b5f1 llvm::sys::RunSignalHandlers() (clang-23+0x64635f1)
> #2 0x0000555f0e67d40f llvm::sys::CleanupOnSignal(unsigned long)
> (clang-23+0x646540f)
> #3 0x0000555f0e5eda4d CrashRecoverySignalHandler(int)
> CrashRecoveryContext.cpp:0:0
> #4 0x00007f1436e3e8f0 (/usr/lib/libc.so.6+0x3e8f0)
> #5 0x00007f1436e9a29c (/usr/lib/libc.so.6+0x9a29c)
> #6 0x00007f1436e3e7d0 raise (/usr/lib/libc.so.6+0x3e7d0)
> #7 0x00007f1436e25681 abort (/usr/lib/libc.so.6+0x25681)
> #8 0x0000555f0e5f4c3f (clang-23+0x63dcc3f)
> #9 0x0000555f0d08a5f9 (clang-23+0x4e725f9)
> #10 0x0000555f0e3ba19c llvm::MCObjectStreamer::emitInstToData(llvm::MCInst
> const&, llvm::MCSubtargetInfo const&) (clang-23+0x61a219c)
> #11 0x0000555f0ce697be (anonymous
> namespace)::RISCVAsmPrinter::emitInstruction(llvm::MachineInstr const*)
> RISCVAsmPrinter.cpp:0:0
> #12 0x0000555f0f872e24 llvm::AsmPrinter::emitFunctionBody()
> (clang-23+0x765ae24)
> #13 0x0000555f0ce664d1 (anonymous
> namespace)::RISCVAsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
> RISCVAsmPrinter.cpp:0:0
> #14 0x0000555f0db2cdf3
> llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (clang-23+0x5914df3)
> #15 0x0000555f0e10304c llvm::FPPassManager::runOnFunction(llvm::Function&)
> (clang-23+0x5eeb04c)
> #16 0x0000555f0e10ab32 llvm::FPPassManager::runOnModule(llvm::Module&)
> (clang-23+0x5ef2b32)
> #17 0x0000555f0e103a8c llvm::legacy::PassManagerImpl::run(llvm::Module&)
> (clang-23+0x5eeba8c)
> #18 0x0000555f0f01a6ca clang::emitBackendOutput(clang::CompilerInstance&,
> clang::CodeGenOptions&, 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*)
> (clang-23+0x6e026ca)
> #19 0x0000555f0f02fd0f
> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
> (clang-23+0x6e17d0f)
> #20 0x0000555f107be8e9 clang::ParseAST(clang::Sema&, bool, bool)
> (clang-23+0x85a68e9)
> #21 0x0000555f0f5a0394 clang::FrontendAction::Execute() (clang-23+0x7388394)
> #22 0x0000555f0f4f558a
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
> (clang-23+0x72dd58a)
> #23 0x0000555f0f68df26
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
> (clang-23+0x7475f26)
> #24 0x0000555f0c280924 cc1_main(llvm::ArrayRef<char const*>, char const*,
> void*) (clang-23+0x4068924)
> #25 0x0000555f0c27c315 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&,
> llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>)
> driver.cpp:0:0
> #26 0x0000555f0c27e998 int llvm::function_ref<int (llvm::SmallVectorImpl<char
> const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext
> const&)::$_0>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
> #27 0x0000555f0f321959 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::$_0>(long) Job.cpp:0:0
> #28 0x0000555f0e5ed76e
> llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
> (clang-23+0x63d576e)
> #29 0x0000555f0f32114d
> clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char>>*, bool*) const (clang-23+0x710914d)
> #30 0x0000555f0f2dd898
> clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
> clang::driver::Command const*&, bool) const (clang-23+0x70c5898)
> #31 0x0000555f0f2ddad7
> clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
> llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool)
> const (clang-23+0x70c5ad7)
> #32 0x0000555f0f2fca39
> clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
> llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&)
> (clang-23+0x70e4a39)
> #33 0x0000555f0c27baca clang_main(int, char**, llvm::ToolContext const&)
> (clang-23+0x4063aca)
> #34 0x0000555f0c28ca8c main (clang-23+0x4074a8c)
> #35 0x00007f1436e27741 (/usr/lib/libc.so.6+0x27741)
> #36 0x00007f1436e27879 __libc_start_main (/usr/lib/libc.so.6+0x27879)
> #37 0x0000555f0c279b65 _start (clang-23+0x4061b65)
> clang: error: clang frontend command failed due to signal (use -v to see
> invocation)
> ClangBuiltLinux clang version 23.0.0git
> (https://github.com/llvm/llvm-project.git
> 681f110833d4f062ee87dfaae4c239d067841067)
> ...
> ```
That's exactly the error I was expecting when I wrote this comment
https://github.com/llvm/llvm-project/pull/194883#discussion_r3162617620
https://github.com/llvm/llvm-project/pull/194883
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits