-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when building Linux with latest LLVM (and CLang) #72026
Comments
@llvm/issue-subscribers-backend-x86 Author: alex_s168 (SuperCraftAlex)
When trying to build linux with LLVM (commit 05738a3), I get this error:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ld.lld -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o vmlinux.o -T .tmp_initcalls.lds --whole-archive vmlinux.a --no-whole-archive --start-group --end-group
1. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@ip6_rcv_core'
#0 0x000055698fdff53e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/lld+0x382253e)
#1 0x000055698fdfc9db SignalHandler(int) Signals.cpp:0:0
#2 0x00007faca405c710 (/usr/lib/libc.so.6+0x3e710)
#3 0x00007faca40bb575 __libc_realloc (/usr/lib/libc.so.6+0x9d575)
#4 0x000055698fd69dc4 llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) (/usr/local/bin/lld+0x378cdc4)
#5 0x00005569925c73b4 llvm::SUnit::addPred(llvm::SDep const&, bool) (/usr/local/bin/lld+0x5fea3b4)
#6 0x0000556991fb830a llvm::ScheduleDAGSDNodes::AddSchedEdges() (/usr/local/bin/lld+0x59db30a)
#7 0x0000556991fb09d2 (anonymous namespace)::ScheduleDAGRRList::Schedule() ScheduleDAGRRList.cpp:0:0
#8 0x0000556991f9bf2e llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/usr/local/bin/lld+0x59bef2e)
#9 0x0000556991f9e86f llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/usr/local/bin/lld+0x59c186f)
#10 0x0000556991fa0e0a llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#11 0x0000556991ac6d40 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#12 0x00005569923b93c8 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#13 0x0000556993dfc271 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/local/bin/lld+0x781f271)
#14 0x0000556993dfc5bc llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/local/bin/lld+0x781f5bc)
#15 0x0000556993dfcfbe llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/lld+0x781ffbe)
#16 0x000055699211bcac codegen(llvm::lto::Config const&, llvm::TargetMachine*, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) LTOBackend.cpp:0:0
#17 0x000055699211c3df llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/local/bin/lld+0x5b3f3df)
#18 0x000055699210edf2 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/local/bin/lld+0x5b31df2)
#19 0x000055699210f35b llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/local/bin/lld+0x5b3235b)
#20 0x000055699002d915 lld::elf::BitcodeCompiler::compile() (/usr/local/bin/lld+0x3a50915)
#21 0x000055698ff4e6ff void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::endianness)1, true>>(bool) (/usr/local/bin/lld+0x39716ff)
#22 0x000055698ff5bed1 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/local/bin/lld+0x397eed1)
#23 0x000055698ff5dfaf lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/local/bin/lld+0x3980faf)
#24 0x000055698ff5f77b lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/local/bin/lld+0x398277b)
#25 0x000055698fe011cc lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/local/bin/lld+0x38241cc)
#26 0x000055698fd408b6 lld_main(int, char**, llvm::ToolContext const&) (/usr/local/bin/lld+0x37638b6)
#27 0x000055698fd40b1f main (/usr/local/bin/lld+0x3763b1f)
#28 0x00007faca4045cd0 (/usr/lib/libc.so.6+0x27cd0)
#29 0x00007faca4045d8a __libc_start_main (/usr/lib/libc.so.6+0x27d8a)
#30 0x000055698fd400a5 _start (/usr/local/bin/lld+0x37630a5)
```
I think I should probably not use the latest LLVM but the CI for that commit said that all tests were completed successfully.
|
Can you post your
|
Another failed attempt here with + /usr/bin/time --verbose make WERROR=0 LLVM=-17 CFLAGS=-w HOSTCC=clang HOSTCXX=clang++ CC=clang AS=llvm-as LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf CONFIG_RUST=y MRPROPER=no CLEAN=no
-C /data/projects/kernel/vtta O=/data/projects/kernel/build/vtta -j 1 bzImage modules compile_commands.json rust-analyzer
make: Entering directory '/data/projects/kernel/vtta'
make[1]: Entering directory '/data/projects/kernel/build/vtta'
GEN Makefile
CALL /data/projects/kernel/vtta/scripts/checksyscalls.sh
DESCEND objtool
make[5]: 'install_headers' is up to date.
DESCEND bpf/resolve_btfids
make[5]: 'install_headers' is up to date.
CC arch/x86/kvm/../../../virt/kvm/async_pf.o
CC arch/x86/kvm/../../../virt/kvm/pfncache.o
CC arch/x86/kvm/x86.o
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 -Wp,-MMD,arch/x86/kvm/.x86.o.d -nostdinc -I/data/projects/kernel/vtta/arch/x86/include -I./arch/x86/include/generated -I/data/projects/kernel/vtta/include -I./include -I/data/projects/kernel/vtta/arch/x86/include/uapi -I.
/arch/x86/include/generated/uapi -I/data/projects/kernel/vtta/include/uapi -I./include/generated/uapi -include /data/projects/kernel/vtta/include/linux/compiler-version.h -include /data/projects/kernel/vtta/include/linux/kconfig.h -include /data/projects
/kernel/vtta/include/linux/compiler_types.h -D__KERNEL__ --target=x86_64-linux-gnu -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -Werror=option-ignored -Werror=unused-command-line-argument -fmacro-prefix-map=/data/p
rojects/kernel/vtta/= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=branch -fno-jump-tables -m64 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mstack-al
ignment=8 -mskip-rax-setup -march=core2 -mno-red-zone -mcmodel=kernel -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -O2 -fstack-protector -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mfentry -DCC_USI
NG_NOP_MCOUNT -DCC_USING_FENTRY -falign-functions=64 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security
-Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wframe-larger-than=1024 -Wno-gnu -Wno-unused-but-set-variable -Wno-unused-const-variable -Wvla -Wno-pointer-sign -Wcast-function-type -Wimplicit-fallthrough -Werror=date-time -Werror=incomp
atible-pointer-types -Wenum-conversion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare -Wno-unaligned-access -Wno-cast-function-type-strict -Wno-missing-field-initializers
-Wno-type-limits -Wno-shift-negative-value -Wno-initializer-overrides -Wno-sign-compare -g -gdwarf-5 -I /data/projects/kernel/vtta/arch/x86/kvm -Werror -I /data/projects/kernel/vtta/arch/x86/kvm -I ./arch/x86/kvm -DKBUILD_MODFILE=\"arch/x86/kvm/kvm\" -DK
BUILD_BASENAME=\"x86\" -DKBUILD_MODNAME=\"kvm\" -D__KBUILD_MODNAME=kmod_kvm -c -o arch/x86/kvm/x86.o /data/projects/kernel/vtta/arch/x86/kvm/x86.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/data/projects/kernel/vtta/arch/x86/kvm/x86.c'.
4. Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@kvm_check_nested_events'
#0 0x00007f08ad44d6d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/Support/Unix/Signals.inc:602:13
#1 0x00007f08ad44ba70 llvm::sys::RunSignalHandlers() /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/Support/Signals.cpp:105:18
#2 0x00007f08ad3a6c79 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
#3 0x00007f08ad3a6c79 CrashRecoverySignalHandler(int) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/Support/CrashRecoveryContext.cpp:390:51
#4 0x00007f08ac58e720 __restore_rt libc_sigaction.c:0:0
#5 0x00007f08ad8f1f11 llvm::BitVector::reset(unsigned int) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/ADT/BitVector.h:398:30
#6 0x00007f08ad8f1f11 (anonymous namespace)::PEI::insertZeroCallUsedRegs(llvm::MachineFunction&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/CodeGen/PrologEpilogInserter.cpp:1291:22
#7 0x00007f08ad8f1f11 (anonymous namespace)::PEI::insertPrologEpilogCode(llvm::MachineFunction&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/CodeGen/PrologEpilogInserter.cpp:1169:3
#8 0x00007f08ad8f1f11 (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/CodeGen/PrologEpilogInserter.cpp:263:5
#9 0x00007f08ad7e409f llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:13
#10 0x00007f08ad581016 llvm::FPPassManager::runOnFunction(llvm::Function&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/IR/LegacyPassManager.cpp:1435:27
#11 0x00007f08ad586a83 llvm::FPPassManager::runOnModule(llvm::Module&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/IR/LegacyPassManager.cpp:1481:13
#12 0x00007f08ad5816b1 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/IR/LegacyPassManager.cpp:0:27
#13 0x00007f08ad5816b1 llvm::legacy::PassManagerImpl::run(llvm::Module&) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/IR/LegacyPassManager.cpp:535:44
#14 0x00007f08b53ccac4 llvm::TimeTraceScope::~TimeTraceScope() /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/Support/TimeProfiler.h:155:9
#15 0x00007f08b53ccac4 (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<
llvm::ToolOutputFile>>&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/CodeGen/BackendUtil.cpp:1116:3
#16 0x00007f08b53ccac4 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/CodeGen/B
ackendUtil.cpp:1137:3
#17 0x00007f08b53ccac4 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>>) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/CodeGen/BackendUtil.cpp:1299:13
#18 0x00007f08b5733b4d std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>::~unique_ptr() /usr/lib64/gcc/x86_64-generic-linux/13/../../../../include/c++/13/bits/unique_ptr.h:403:6
#19 0x00007f08b5733b4d clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/CodeGen/CodeGenAction.cpp:386:7
#20 0x00007f08b44b2a56 __gnu_cxx::__normal_iterator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>*, std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<c
lang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>::__normal_iterator(std::unique_ptr<clang::TemplateInstantiationCallback, std::defaul
t_delete<clang::TemplateInstantiationCallback>>* const&) /usr/lib64/gcc/x86_64-generic-linux/13/../../../../include/c++/13/bits/stl_iterator.h:1077:20
#21 0x00007f08b44b2a56 std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateI
nstantiationCallback>>>>::begin() /usr/lib64/gcc/x86_64-generic-linux/13/../../../../include/c++/13/bits/stl_vector.h:871:16
#22 0x00007f08b44b2a56 void clang::finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_de
lete<clang::TemplateInstantiationCallback>>>>>(std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default
_delete<clang::TemplateInstantiationCallback>>>>&, clang::Sema const&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/include/clang/Sema/TemplateInstCallback.h:54:16
#23 0x00007f08b44b2a56 clang::ParseAST(clang::Sema&, bool, bool) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Parse/ParseAST.cpp:183:3
#24 0x00007f08b60b1a87 clang::FrontendAction::Execute() /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Frontend/FrontendAction.cpp:1063:10
#25 0x00007f08b602bff4 llvm::Error::getPtr() const /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/Support/Error.h:273:12
#26 0x00007f08b602bff4 llvm::Error::operator bool() /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/Support/Error.h:233:16
#27 0x00007f08b602bff4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Frontend/CompilerInstance.cpp:1053:23
#28 0x00007f08b6124344 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:25
#29 0x00005649cc27fc89 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/tools/driver/cc1_main.cpp:249:15
#30 0x00005649cc27d7c3 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/tools/driver/driver.cpp:366:12
#31 0x00007f08b5d08239 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::operator()() const /builddir/build/BUILD/llvm-pr
oject-17.0.5.src/clang/lib/Driver/Job.cpp:440:30
#32 0x00007f08b5d08239 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>(lo
ng) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#33 0x00007f08ad3a6a5c llvm::function_ref<void ()>::operator()() const /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#34 0x00007f08ad3a6a5c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/lib/Support/CrashRecoveryContext.cpp:426:3
#35 0x00007f08b5d07ade clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /builddir/build/BUILD/llvm-project-17.0.5.src/clang/li
b/Driver/Job.cpp:440:7
#36 0x00007f08b5cd225e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Driver/Compilation.cpp:199:15
#37 0x00007f08b5cd249e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Driver/Compilation.cp
p:253:13
#38 0x00007f08b5ced10e llvm::SmallVectorBase<unsigned int>::empty() const /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/include/llvm/ADT/SmallVector.h:94:46
#39 0x00007f08b5ced10e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/lib/Driver/Driver.cpp:1906:23
#40 0x00005649cc27d136 clang_main(int, char**, llvm::ToolContext const&) /builddir/build/BUILD/llvm-project-17.0.5.src/clang/tools/driver/driver.cpp:542:21
#41 0x00005649cc2898c1 main /builddir/build/BUILD/llvm-project-17.0.5.src/llvm/clr-build/tools/clang/tools/driver/clang-driver.cpp:15:3
#42 0x00007f08ac574d77 __libc_start_call_main /builddir/build/BUILD/glibc-2.38/csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#43 0x00007f08ac574e35 call_init /builddir/build/BUILD/glibc-2.38/csu/../csu/libc-start.c:128:20
#44 0x00007f08ac574e35 __libc_start_main@GLIBC_2.2.5 /builddir/build/BUILD/glibc-2.38/csu/../csu/libc-start.c:347:5
#45 0x00005649cc27a1c1 _start /builddir/build/BUILD/glibc-2.38/csu/../sysdeps/x86_64/start.S:117:0
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 17.0.5
Target: x86_64-unknown-linux-gnu
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/x86-f3aa9f.c
clang: note: diagnostic msg: /tmp/x86-f3aa9f.sh
clang: note: diagnostic msg:
********************
make[5]: *** [/data/projects/kernel/vtta/scripts/Makefile.build:243: arch/x86/kvm/x86.o] Error 1
make[4]: *** [/data/projects/kernel/vtta/scripts/Makefile.build:480: arch/x86/kvm] Error 2
make[3]: *** [/data/projects/kernel/vtta/scripts/Makefile.build:480: arch/x86] Error 2
make[2]: *** [/data/projects/kernel/vtta/Makefile:1913: .] Error 2
make[1]: *** [/data/projects/kernel/vtta/Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/data/projects/kernel/build/vtta'
make: *** [Makefile:234: __sub-make] Error 2
make: Leaving directory '/data/projects/kernel/vtta'
Command exited with non-zero status 2
Command being timed: "make WERROR=0 LLVM=-17 CFLAGS=-w HOSTCC=clang HOSTCXX=clang++ CC=clang AS=llvm-as LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf CONFIG_RUST=y MRPROPER=no CLEA
N=no -C /data/projects/kernel/vtta O=/data/projects/kernel/build/vtta -j 1 bzImage modules compile_commands.json rust-analyzer"
User time (seconds): 9.24
System time (seconds): 3.52
Percent of CPU this job got: 96%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:13.20
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 604544
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 4301
Minor (reclaiming a frame) page faults: 470178
Voluntary context switches: 5872
Involuntary context switches: 163
Swaps: 0
File system inputs: 0
File system outputs: 2568
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 2
$ rg CONFIG_LTO .config
799:CONFIG_LTO_NONE=y
800:# CONFIG_LTO_CLANG_FULL is not set
801:# CONFIG_LTO_CLANG_THIN is not set |
@vtta I am not sure your crash is the same issue as the one initially reported here, as it is reproducible on |
Thanks for the fix, I can compile with |
Hey, I think I narrowed down the issue that is affecting the kernel compile here.
, deleting all compiler arguments except Anyone want to try to reproduce and investigate further? |
I'm not familiar enough with linux kernel builds to reproduce this, but if its happening with any znver* model suggests it could be something to do with the PostRAScheduler which AMD models enable by default. |
I can reproduce this now, I'll try to have a trivial reproducer later today. |
@RKSimon I bisected this issue to d96529a.
C reproducer from enum {
IPSTATS_MIB_NUM,
IPSTATS_MIB_INPKTS,
IPSTATS_MIB_OUTBCASTOCTETS,
IPSTATS_MIB_CSUMERRORS,
IPSTATS_MIB_NOECTPKTS,
__IPSTATS_MIB_MAX
};
struct {
long mibs[__IPSTATS_MIB_MAX];
} ip6_rcv_core__idev_0;
enum { SKB_DROP_REASON_NOT_SPECIFIED } ipv6_get_dsfield_ipv6h;
enum { INET_ECN_MASK = 3 } __in6_dev_get_dev;
int __in6_dev_get_dev_0;
char ip6_rcv_core___trans_tmp_6;
long ip6_rcv_core_pto_val__() {
({
typeof(__in6_dev_get_dev_0) *__UNIQUE_ID_rcu783 = ({
*(volatile typeof(_Generic(__in6_dev_get_dev,
default: &__in6_dev_get_dev_0)) *)0;
});
__UNIQUE_ID_rcu783;
});
ip6_rcv_core___trans_tmp_6 = ipv6_get_dsfield_ipv6h >> 4;
asm("add"
"%[val]"
", "
"var"
: "+m"(ip6_rcv_core__idev_0.mibs[IPSTATS_MIB_NOECTPKTS +
(ip6_rcv_core___trans_tmp_6 &
INET_ECN_MASK)])
: [val] "re"(ip6_rcv_core_pto_val__));
return 0;
}
LLVM IR reproducer from target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.anon = type { [5 x i64] }
@ip6_rcv_core__idev_0 = external global %struct.anon
define i64 @ip6_rcv_core_pto_val__() {
entry:
%0 = load i32, ptr null, align 4
%shr = lshr i32 %0, 1
%and = and i32 %shr, 1
%add = or i32 %and, 4
%idxprom = zext i32 %add to i64
%arrayidx = getelementptr [5 x i64], ptr @ip6_rcv_core__idev_0, i64 0, i64 %idxprom
tail call void asm "add$1, var", "=*m,re,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %arrayidx, ptr @ip6_rcv_core_pto_val__, ptr elementtype(i64) %arrayidx)
ret i64 0
}
|
SimplifyDemandedBits is awesome at shaking down code :-| |
@RKSimon I see there are some new branches on your fork of llvm-project dating pretty close to the issue being (self)assigned to you, but I don't see any of them clearly labeled to be related to this, could you please elaborate on those if possible, or give any pointers as how to best work around this issue for experimenting purposes? |
Haven't had time to look at this in depth. Returning to the pool if you want to give it a go |
My bad, I gave the wrong idea. I wasn't trying to demand/coerce you to progress on the matter, simply I wasn't sure if one of those branches contained the fix since they were created around the same time, hence the "elaborate on those". As for me, I'm not, well, I could try to just fix conflicts from reverting the problematic commit (which I gave up quickly at before since I don't know enough about the codebase), but I wouldn't dare publish that (laugh), I'm not a contributor yet alone a proper dev. I'm sorry that I gave the impression. If you so choose feel free to take up the issue again at your own pace. |
Probably a duplicate of #50640 |
Further reduced test case: long a[1];
char b();
void c() { asm("" : "+m"(a[1 + (b() & 1)])); } |
This bug has been open for 5 months, is it any closer to being resolved? If it was bisected to d96529a should that be reverted again? |
Today's kernel compilation attempt with LLVM/clang/lld 18.1.6 ... flags for zen-3, Full-LTO, etc. ... and this error still occurs = under 17.0.6 everything is ok:
|
@tstellar @tstellarAMD is someone from AMD able to take a look at this? |
The repro at https://godbolt.org/z/En7dccW9P now compiles correctly with trunk (you may need to rerun the compilation after opening the link but it does work) - could this issue now be closed? |
but the mainline still does not work correctly - I tested with yesterday's compilation 18.1.8 ... errors again |
It has just been commited, you may not see this fix until 19 is released. If the trunk builds correctly, though, the issue can be closed |
18.1.8 can't build linux-6.6.43 which is an LTS kernel. This is my build command...
|
FYI @tru - I think I know what the answer will be - but we're hitting a lot of reports regarding 18.x not building the linux kernel with some -march combos. |
I don't really have a strong opinion but I want to clarify that this is largely self inflicted on the part of kernel builders, as the upstream kernel does not have any uses of |
@nathanchance I would agree if the patch was complicated to backport, here I don't understand the reason of pushing back: Arch and Gentoo (and probably other linux distributions) are already backporting the patch, it applies well on 18.1: https://gitlab.archlinux.org/archlinux/packaging/packages/llvm/-/blob/main/PKGBUILD?ref_type=heads#L18, https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-devel/llvm?id=0324fa3c789398654e760d47b826e831000e0b91. |
I am not pushing back on backporting the patch altogether; if the release managers feel this is worthy of a new release, I am not going to argue with that. I am merely clarifying that this is an issue that one has to go out of their way to hit and building the kernel without that specific |
It would be norm breaking to release a new 18.x now, it doesn't seem like a security issue or a fatal error that leads to some really bad outcomes especially when there are workarounds. Releasing a new version of LLVM is a pretty intensive process and we are currently focusing on the LLVM 19 release. So I will not have the extra bandwidth to do it. If @tstellar have the time and think it should prioritized I won't block a new 18 release, but if it was only up to me I would say that we don't do it. |
It sounds like this can be worked-around by using |
I've set it to Zen 1 and am getting the same error on NixOS with clang 18.1.8 and Linux 6.13 (with -O3 enabled):
|
@xdevs23 Are you using -march=native or -march=x86-64-v4 ? The latter should avoid the issue. |
Using |
When trying to build linux zen (6.5/main) with LLVM (commit 05738a3), I get this error:
I think I should probably not use the latest LLVM but the CI for that commit said that all tests were completed successfully.
The text was updated successfully, but these errors were encountered: