-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
Description
When compiling current -tip linux tree (27. May, 2024), with the patch series [1] that enables optimized percpu access via named address spaces also for clang applied, the compilation crashes when compiling arch/x86/kernel/cpu/common.c with:
fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.6 (Fedora 18.1.6-3.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
The preprocessed file is attached, please compile with:
clang -O2 -w -S common.i
To get:
fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr)
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: /usr/bin/clang -O2 -w -S -fcolor-diagnostics -o common.s common.i
1. <eof> parser at end of file
2. Code generation
#0 0x00007f5ab640456a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x60456a)
#1 0x00007f5ab6401d54 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601d54)
#2 0x00007f5ab6335e22 (/lib64/libLLVM.so.18.1+0x535e22)
#3 0x00007f5ab6335ddf (/lib64/libLLVM.so.18.1+0x535ddf)
#4 0x00007f5ab63fe22f (/lib64/libLLVM.so.18.1+0x5fe22f)
#5 0x00000000004147c7 (/usr/bin/clang+0x4147c7)
#6 0x00007f5ab6346a07 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib64/libLLVM.so.18.1+0x546a07)
#7 0x00007f5ab6e3117e (/lib64/libLLVM.so.18.1+0x103117e)
#8 0x00007f5ab6e31d00 (/lib64/libLLVM.so.18.1+0x1031d00)
#9 0x00007f5ab6e22642 llvm::AsmPrinter::emitGlobalConstant(llvm::DataLayout const&, llvm::Constant const*, llvm::DenseMap<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>>>*) (/lib64/libLLVM.so.18.1+0x1022642)
#10 0x00007f5ab6e21ab9 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) (/lib64/libLLVM.so.18.1+0x1021ab9)
#11 0x00007f5ab6e2c077 llvm::AsmPrinter::doFinalization(llvm::Module&) (/lib64/libLLVM.so.18.1+0x102c077)
#12 0x00007f5ab6591271 llvm::FPPassManager::doFinalization(llvm::Module&) (/lib64/libLLVM.so.18.1+0x791271)
#13 0x00007f5ab658a0a1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM.so.18.1+0x78a0a1)
#14 0x00007f5abe85c58b 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*) (/lib64/libclang-cpp.so.18.1+0x185c58b)
#15 0x00007f5abec5a2a0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18.1+0x1c5a2a0)
#16 0x00007f5abd574436 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574436)
#17 0x00007f5abf81c9f6 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c9f6)
#18 0x00007f5abf794700 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x2794700)
#19 0x00007f5abf899f65 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899f65)
#20 0x00000000004144c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x4144c6)
#21 0x0000000000411164 (/usr/bin/clang+0x411164)
#22 0x00007f5abf3c5acd (/lib64/libclang-cpp.so.18.1+0x23c5acd)
#23 0x00007f5ab6335db4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.18.1+0x535db4)
#24 0x00007f5abf3c5537 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c5537)
#25 0x00007f5abf38b297 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b297)
#26 0x00007f5abf38b4f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b4f7)
#27 0x00007f5abf3a995e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.18.1+0x23a995e)
#28 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x4109bf)
#29 0x000000000041dcca main (/usr/bin/clang+0x41dcca)
#30 0x00007f5ab583d088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#31 0x00007f5ab583d14b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#32 0x000000000040d8a5 _start (/usr/bin/clang+0x40d8a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
[1] https://lore.kernel.org/lkml/20240526175655.227798-1-ubizjak@gmail.com/