[PATCH] D131270: MC: make section classification a bit more thorough
Nathan Chancellor via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 22 11:09:05 PDT 2022
nathanchance added a comment.
This patch breaks building the Linux kernel for RISC-V. A simplified reproducer:
enum { true };
__attribute__((__section__(".init.data"))) char *message;
_Bool __attribute__((__section__(".init.data"))) initramfs_async = true;
$ clang --version | head -1
ClangBuiltLinux clang version 16.0.0 (https://github.com/llvm/llvm-project 73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6)
$ clang --target=riscv64-linux-gnu -c -o /dev/null initramfs.i
fatal error: error in backend: unable to write nop sequence of 7 bytes
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 -c -o /dev/null initramfs.i
1. <eof> parser at end of file
2. Code generation
#0 0x000055b56adaacf3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3697cf3)
#1 0x000055b56ada8d6e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3695d6e)
#2 0x000055b56ad257af (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
#3 0x000055b56ad2573f llvm::CrashRecoveryContext::HandleExit(int) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x361273f)
#4 0x000055b56ada5817 llvm::sys::Process::Exit(int, bool) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3692817)
#5 0x000055b569a46662 (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x2333662)
#6 0x000055b56ad2a619 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3617619)
#7 0x000055b56aa1a5a4 llvm::MCAssembler::writeSectionData(llvm::raw_ostream&, llvm::MCSection const*, llvm::MCAsmLayout const&) const (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x33075a4)
#8 0x000055b56aa04c58 (anonymous namespace)::ELFWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) ELFObjectWriter.cpp:0:0
#9 0x000055b56aa03755 (anonymous namespace)::ELFSingleObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) ELFObjectWriter.cpp:0:0
#10 0x000055b56aa1b4e6 llvm::MCAssembler::Finish() (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x33084e6)
#11 0x000055b56aa3adb8 llvm::MCELFStreamer::finishImpl() (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3327db8)
#12 0x000055b56bb93339 llvm::AsmPrinter::doFinalization(llvm::Module&) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x4480339)
#13 0x000055b56a690909 llvm::FPPassManager::doFinalization(llvm::Module&) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x2f7d909)
#14 0x000055b56a689f1c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x2f76f1c)
#15 0x000055b56b5f0fbd clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3eddfbd)
#16 0x000055b56b9ecd1e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#17 0x000055b56c2f1a3a clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x4bdea3a)
#18 0x000055b56b92fc60 clang::FrontendAction::Execute() (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x421cc60)
#19 0x000055b56b8a1b9f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x418eb9f)
#20 0x000055b56b9e6182 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x42d3182)
#21 0x000055b569a46138 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x2333138)
#22 0x000055b569a43e7f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#23 0x000055b56b71e522 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#24 0x000055b56ad2562c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x361262c)
#25 0x000055b56b71e07f clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x400b07f)
#26 0x000055b56b6dd64f clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3fca64f)
#27 0x000055b56b6dd8fe clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3fca8fe)
#28 0x000055b56b6fa6a0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x3fe76a0)
#29 0x000055b569a4354b clang_main(int, char**) (/home/nathan/tmp/tmp.BkODB37lsK/install/llvm/73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6/bin/clang-16+0x233054b)
#30 0x00007f078dabc2d0 (/usr/lib/libc.so.6+0x232d0)
#31 0x00007f078dabc38a __libc_start_main (/usr/lib/libc.so.6+0x2338a)
#32 0x000055b569a40aa5 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-16: error: clang frontend command failed with exit code 70 (use -v to see invocation)
ClangBuiltLinux clang version 16.0.0 (https://github.com/llvm/llvm-project 73a9dfcee24df959b59a46d75dcbdc0bcfb50fe6)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: ...
clang-16: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
There is no issue at the direct parent.
$ clang --version | head -1
ClangBuiltLinux clang version 16.0.0 (https://github.com/llvm/llvm-project e41dd0205242af4f8e2a370d0346f24f0b0eb788)
$ clang --target=riscv64-linux-gnu -c -o /dev/null initramfs.i
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131270/new/
https://reviews.llvm.org/D131270
More information about the llvm-commits
mailing list