Open DoDoENT opened 3 years ago
Originally detected on the emscripten project while attempting to find more information about a different bug: https://github.com/emscripten-core/emscripten/issues/15427#issuecomment-963400640
Basically, when -flto=thin is combined with -fwhole-program-vtables I get the following crash in the WebAssembly backend:
-flto=thin
-fwhole-program-vtables
|| Assertion failed: (DataLocations.count(&WS) > 0), function writeOneObject, file /opt/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/MC/WasmObjectWriter.cpp, line 1794. || PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. || Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it): || 0 libLLVM.dylib 0x000000010ad4c67b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43 || 1 libLLVM.dylib 0x000000010ad4b448 llvm::sys::RunSignalHandlers() + 248 || 2 libLLVM.dylib 0x000000010ad4cce0 SignalHandler(int) + 288 || 3 libsystem_platform.dylib 0x00007ff807aace2d _sigtramp + 29 || 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370452300272 || 5 libsystem_c.dylib 0x00007ff8079e3d10 abort + 123 || 6 libsystem_c.dylib 0x00007ff8079e30be err + 0 || 7 libLLVM.dylib 0x000000010c69070a (anonymous namespace)::WasmObjectWriter::writeOneObject(llvm::MCAssembler&, llvm::MCAsmLayout const&, (anonymous namespace)::WasmObjectWriter::DwoMode) + 34842 || 8 libLLVM.dylib 0x000000010c686e38 (anonymous namespace)::WasmObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) + 152 || 9 libLLVM.dylib 0x000000010c62f36c llvm::MCAssembler::Finish() + 76 || 10 libLLVM.dylib 0x000000010b73ef33 llvm::AsmPrinter::doFinalization(llvm::Module&) + 5683 || 11 libLLVM.dylib 0x000000010aed7156 llvm::FPPassManager::doFinalization(llvm::Module&) + 70 || 12 libLLVM.dylib 0x000000010aecfada llvm::legacy::PassManagerImpl::run(llvm::Module&) + 4522 || 13 libLLVM.dylib 0x000000010c5f8a3c codegen(llvm::lto::Config const&, llvm::TargetMachine, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) + 1292 || 14 libLLVM.dylib 0x000000010c5f990a llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std::2::equal_to, std::2::allocator >, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long long, llvm::GlobalValueSummary, llvm::DenseMapInfo, llvm::detail::DenseMapPair<unsigned long long, llvm::GlobalValueSummary> > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModule>, std::2::allocator<std::2::pair<llvm::StringRef, llvm::Bitc || 15 libLLVM.dylib 0x000000010c5f978f llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::__2::unordered_set<unsigned long long, std::2::hash, std::__2::equal_to, std::__2::allocator >, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long long, llvm::GlobalValueSummary, llvm::DenseMapInfo, llvm::detail::DenseMapPair<unsigned long long, llvm::GlobalValueSummary> > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModule>, std::2::allocator<std::2::pair<llvm::StringRef, llvm::Bitc || 16 libLLVM.dylib 0x000000010c5f23a7 (anonymous namespace)::InProcessThinBackend::runThinLTOBackendThread(std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, std::2::function<std::2::function<std::__2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)> (unsigned int, llvm::StringRef)>, unsigned int, llvm::BitcodeModule, llvm::ModuleSummaryIndex&, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std::2::equal_to, std::2::allocator >, llvm::MallocAllocator> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo > const&, std::2::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::2::less, std::2::allocator<std::2::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > > const&, llvm::DenseMap<unsigne || 17 libLLVM.dylib 0x000000010c5f21e2 void std::2::function::policy_invoker<void ()>::__call_impl<std::2::function::default_alloc_func<std::2::bind<(anonymous namespace)::InProcessThinBackend::start(unsigned int, llvm::BitcodeModule, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std::2::equal_to, std::2::allocator >, llvm::MallocAllocator> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo > const&, std::2::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::2::less, std::2::allocator<std::2::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModul || 18 libLLVM.dylib 0x000000010ace95c6 void llvm::thread::ThreadProxy<std::__2::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::$_0> >(void*) + 662 || 19 libsystem_pthread.dylib 0x00007ff807a97514 _pthread_start + 125 || 20 libsystem_pthread.dylib 0x00007ff807a9302f thread_start + 15
LLVM_SYMBOLIZER_PATH
At the moment I don't have any open source reproducer, but the problem goes away if I compile everything without -fwhole-program-vtables.
assigned to @sbc100
Extended Description
Originally detected on the emscripten project while attempting to find more information about a different bug: https://github.com/emscripten-core/emscripten/issues/15427#issuecomment-963400640
Basically, when
-flto=thin
is combined with-fwhole-program-vtables
I get the following crash in the WebAssembly backend:|| Assertion failed: (DataLocations.count(&WS) > 0), function writeOneObject, file /opt/s/w/ir/cache/builder/emscripten-releases/llvm-project/llvm/lib/MC/WasmObjectWriter.cpp, line 1794. || PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. || Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var > (unsigned int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) + 1292
|| 14 libLLVM.dylib 0x000000010c5f990a llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std:: 2::default_delete > (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std:: 2::equal_to, std:: 2::allocator >, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long long, llvm::GlobalValueSummary , llvm::DenseMapInfo, llvm::detail::DenseMapPair<unsigned long long, llvm::GlobalValueSummary> > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModule>, std::2::allocator<std::2::pair<llvm::StringRef, llvm::Bitc
|| 15 libLLVM.dylib 0x000000010c5f978f llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::__2::unordered_set<unsigned long long, std:: 2::hash, std::__2::equal_to, std::__2::allocator >, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long long, llvm::GlobalValueSummary , llvm::DenseMapInfo, llvm::detail::DenseMapPair<unsigned long long, llvm::GlobalValueSummary> > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModule>, std::2::allocator<std::2::pair<llvm::StringRef, llvm::Bitc
|| 16 libLLVM.dylib 0x000000010c5f23a7 (anonymous namespace)::InProcessThinBackend::runThinLTOBackendThread(std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_delete > (unsigned int)>, std::2::function<std::2::function<std::__2::unique_ptr<llvm::NativeObjectStream, std:: 2::default_delete > (unsigned int)> (unsigned int, llvm::StringRef)>, unsigned int, llvm::BitcodeModule, llvm::ModuleSummaryIndex&, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std:: 2::equal_to, std:: 2::allocator >, llvm::MallocAllocator> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo > const&, std::2::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::2::less, std::2::allocator<std::2::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > > const&, llvm::DenseMap<unsigne
|| 17 libLLVM.dylib 0x000000010c5f21e2 void std::2::function::policy_invoker<void ()>::__call_impl<std::2::function::default_alloc_func<std::2::bind<(anonymous namespace)::InProcessThinBackend::start(unsigned int, llvm::BitcodeModule, llvm::StringMap<std::2::unordered_set<unsigned long long, std::2::hash, std:: 2::equal_to, std:: 2::allocator >, llvm::MallocAllocator> const&, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo > const&, std::2::map<unsigned long long, llvm::GlobalValue::LinkageTypes, std::2::less, std::2::allocator<std::2::pair<unsigned long long const, llvm::GlobalValue::LinkageTypes> > > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::2::vector<std::2::pair<llvm::StringRef, llvm::BitcodeModul
|| 18 libLLVM.dylib 0x000000010ace95c6 void llvm::thread::ThreadProxy<std::__2::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::$_0> >(void*) + 662
|| 19 libsystem_pthread.dylib 0x00007ff807a97514 _pthread_start + 125
|| 20 libsystem_pthread.dylib 0x00007ff807a9302f thread_start + 15
LLVM_SYMBOLIZER_PATH
to point to it): || 0 libLLVM.dylib 0x000000010ad4c67b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43 || 1 libLLVM.dylib 0x000000010ad4b448 llvm::sys::RunSignalHandlers() + 248 || 2 libLLVM.dylib 0x000000010ad4cce0 SignalHandler(int) + 288 || 3 libsystem_platform.dylib 0x00007ff807aace2d _sigtramp + 29 || 4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603370452300272 || 5 libsystem_c.dylib 0x00007ff8079e3d10 abort + 123 || 6 libsystem_c.dylib 0x00007ff8079e30be err + 0 || 7 libLLVM.dylib 0x000000010c69070a (anonymous namespace)::WasmObjectWriter::writeOneObject(llvm::MCAssembler&, llvm::MCAsmLayout const&, (anonymous namespace)::WasmObjectWriter::DwoMode) + 34842 || 8 libLLVM.dylib 0x000000010c686e38 (anonymous namespace)::WasmObjectWriter::writeObject(llvm::MCAssembler&, llvm::MCAsmLayout const&) + 152 || 9 libLLVM.dylib 0x000000010c62f36c llvm::MCAssembler::Finish() + 76 || 10 libLLVM.dylib 0x000000010b73ef33 llvm::AsmPrinter::doFinalization(llvm::Module&) + 5683 || 11 libLLVM.dylib 0x000000010aed7156 llvm::FPPassManager::doFinalization(llvm::Module&) + 70 || 12 libLLVM.dylib 0x000000010aecfada llvm::legacy::PassManagerImpl::run(llvm::Module&) + 4522 || 13 libLLVM.dylib 0x000000010c5f8a3c codegen(llvm::lto::Config const&, llvm::TargetMachine, std::2::function<std::2::unique_ptr<llvm::NativeObjectStream, std::2::default_deleteAt the moment I don't have any open source reproducer, but the problem goes away if I compile everything without
-fwhole-program-vtables
.