Skip to content

Unable to compile mono arm64 with clang12 #84503

Closed
@sbomer

Description

@sbomer

See build failure in https://dev.azure.com/dnceng-public/public/_build/results?buildId=231491&view=logs&jobId=fc4a8644-4c6a-5833-fe7a-25aca425d858&j=14eb0ddd-87f8-595e-102b-e1af7724045a&t=726d924a-e961-5f2c-8a5f-9886acc5d601, which uses CBL-mariner build images that have clang 12.0.1.

  Stack dump:
  0.	Program arguments: /usr/local/bin/clang-12 -DBUILDENV_DEBUG=1 -DCROSS_COMPILE -DDEBUG -DDISABLE_CONTRACTS -DHAVE_CONFIG_H=1 -DHAVE___THREAD=0 -DHOST_64BIT -DHOST_AMD64 -DHOST_UNIX -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_STRING=\"\" -DTARGET_64BIT -DTARGET_ARM64 -DTARGET_LINUX -DTARGET_UNIX -DURTBLDENV_FRIENDLY=Debug -DUSE_STL -D_DBG -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/__w/1/s/artifacts/obj/external/libunwind -I/__w/1/s/src/native/external/libunwind_extras -I/__w/1/s/src/native -I/__w/1/s/src/coreclr/pal/inc -I/__w/1/s/src/coreclr/pal/src -I/__w/1/s/src/coreclr/pal/../inc -I/__w/1/s/src/native/external/libunwind/include -I/__w/1/s/src/native/external/libunwind/include/tdep -I/__w/1/s/artifacts/obj/external/libunwind/include -I/__w/1/s/artifacts/obj/external/libunwind/include/tdep -I/__w/1/s/src/native/external/libunwind/src -g -fPIC -O0 -g -Wall -Wno-null-conversion -fno-omit-frame-pointer -fms-extensions -fwrapv -fstack-protector-strong -Werror -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-tautological-compare -Wno-unknown-pragmas -Wimplicit-fallthrough -Wno-unused-but-set-variable -ffp-contract=off -Wno-unknown-warning-option -ferror-limit=4096 -Wno-unused-private-field -Wno-constant-logical-operand -Wno-pragma-pack -Wno-incompatible-ms-struct -Wno-reserved-identifier -Wno-unsafe-buffer-usage -Wno-single-bit-bitfield-constant-conversion -Wno-cast-function-type-strict -fsigned-char -fvisibility=hidden -ffunction-sections -fexceptions -Wno-format -Wno-format-security -Wno-implicit-fallthrough -Wno-header-guard -Wno-implicit-int-conversion -std=gnu11 -MD -MT /__w/1/s/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/__w/1/s/src/native/external/libunwind/src/elf64.c.o -MF CMakeFiles/libunwind.dir/__w/1/s/src/native/external/libunwind/src/elf64.c.o.d -o CMakeFiles/libunwind.dir/__w/1/s/src/native/external/libunwind/src/elf64.c.o -c /__w/1/s/src/native/external/libunwind/src/elf64.c
  1.	<eof> parser at end of file
  2.	Code generation
  [ 30%] Building CXX object utilcode/CMakeFiles/utilcodestaticnohost.dir/ex.cpp.o
   #0 0x0000558a87fc205e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/clang-12+0x213f05e)
   #1 0x0000558a87fbfe54 llvm::sys::RunSignalHandlers() (/usr/local/bin/clang-12+0x213ce54)
   #2 0x0000558a87f36438 CrashRecoverySignalHandler(int) (/usr/local/bin/clang-12+0x20b3438)
   #3 0x00007f31b4b0ee30 __restore_rt (/lib/libc.so.6+0x42e30)
   #4 0x0000558a88a68310 llvm::DIE::getUnitDie() const (/usr/local/bin/clang-12+0x2be5310)
   #5 0x0000558a88a7269c llvm::DwarfDebug::finishEntityDefinitions() (/usr/local/bin/clang-12+0x2bef69c)
   #6 0x0000558a88a8ba52 llvm::DwarfDebug::finalizeModuleInfo() (/usr/local/bin/clang-12+0x2c08a52)
   #7 0x0000558a88a8ea68 llvm::DwarfDebug::endModule() (/usr/local/bin/clang-12+0x2c0ba68)
   #8 0x0000558a88a5faa9 llvm::AsmPrinter::doFinalization(llvm::Module&) (/usr/local/bin/clang-12+0x2bdcaa9)
   #9 0x0000558a8791955d llvm::FPPassManager::doFinalization(llvm::Module&) (.localalias) (/usr/local/bin/clang-12+0x1a9655d)
  #10 0x0000558a87925020 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/local/bin/clang-12+0x1aa2020)
  #11 0x0000558a88255f2c (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (.constprop.0) (/usr/local/bin/clang-12+0x23d2f2c)
  #12 0x0000558a88257c7c clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/usr/local/bin/clang-12+0x23d4c7c)
  #13 0x0000558a88e9070c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/local/bin/clang-12+0x300d70c)
  #14 0x0000558a8995ab39 clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/bin/clang-12+0x3ad7b39)
  #15 0x0000558a88865269 clang::FrontendAction::Execute() (/usr/local/bin/clang-12+0x29e2269)
  #16 0x0000558a88808ccb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/bin/clang-12+0x2985ccb)
  #17 0x0000558a88913c58 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/bin/clang-12+0x2a90c58)
  #18 0x0000558a86a3188f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/bin/clang-12+0xbae88f)
  #19 0x0000558a86a2f2a0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/usr/local/bin/clang-12+0xbac2a0)
  #20 0x0000558a886b75b5 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::'lambda'()>(long) (/usr/local/bin/clang-12+0x28345b5)
  #21 0x0000558a87f36533 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local/bin/clang-12+0x20b3533)
  #22 0x0000558a886b86df clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) (/usr/local/bin/clang-12+0x28356df)
  #23 0x0000558a8868ead7 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/local/bin/clang-12+0x280bad7)
  #24 0x0000558a8868f519 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/usr/local/bin/clang-12+0x280c519)
  #25 0x0000558a8869cf29 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/local/bin/clang-12+0x2819f29)
  #26 0x0000558a869a8cb2 main (/usr/local/bin/clang-12+0xb25cb2)
  #27 0x00007f31b4afa57d __libc_start_call_main (/lib/libc.so.6+0x2e57d)
  #28 0x00007f31b4afa630 __libc_start_main_impl (/lib/libc.so.6+0x2e630)
  #29 0x0000558a86a2ec85 _start (/usr/local/bin/clang-12+0xbabc85)
  clang-12: error: clang frontend command failed with exit code 139 (use -v to see invocation)
  clang version 12.0.1
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /usr/local/bin
  clang-12: note: diagnostic msg: 
  ********************
  
  PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
  Preprocessed source(s) and associated run script(s) are located at:
  clang-12: note: diagnostic msg: /tmp/elf64-6bdede.c
  clang-12: note: diagnostic msg: /tmp/elf64-6bdede.sh
  clang-12: note: diagnostic msg: 
  
  ********************
  make[3]: *** [/__w/1/s/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/build.make:1250: /__w/1/s/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/__w/1/s/src/native/external/libunwind/src/elf64.c.o] Error 139
  make[2]: *** [CMakeFiles/Makefile2:1770: /__w/1/s/artifacts/obj/external/libunwind/CMakeFiles/libunwind.dir/all] Error 2
  make[2]: *** Waiting for unfinished jobs....

Looks like it may be the same as https://bugs.llvm.org/show_bug.cgi?id=50611, which suggests that it could be bad code produced by an old gcc used to compile LLVM. If this is the same issue, we may be able to fix it by building LLVM on the mariner images with a newer gcc, or using clang. This may also go away when we upgrade to LLVM 16 (dotnet/dotnet-buildtools-prereqs-docker#840), but if the issue is bad codegen in old versions of gcc, we should probably change how we build LLVM anyway.

I intend to keep the failing leg (mono arm64 product build) on the old build images as part of #84148, and I'll use this issue to track moving that build leg to the mariner images.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions