[PATCH] D128184: [lld-macho] Show source information for undefined references

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 16:15:51 PDT 2022


thakis added a comment.
Herald added a subscriber: StephenFan.

Apologies, only after landing this did I realize that this makes ld64.lld crash on the repro in comment 0 of https://github.com/llvm/llvm-project/issues/56121

I'll revert this again for now, to keep HEAD green.

Lengthy stack below:

  (lldb) r
  Process 58952 launched: '/Users/thakis/src/llvm-project/out/gn/bin/ld64.lld' (arm64)
  ld64.lld was compiled with optimization - stepping may behave oddly; variables may not be available.
  Process 58952 stopped
  * thread #16, stop reason = EXC_BAD_ACCESS (code=1, address=0xa00000129)
      frame #0: 0x0000000100606a80 ld64.lld`llvm::DWARFUnit::tryExtractDIEsIfNeeded(bool) [inlined] std::__1::vector<llvm::DWARFDebugInfoEntry, std::__1::allocator<llvm::DWARFDebugInfoEntry> >::empty(this=0x0000000a00000129 size=0) const at vector:524:23 [opt]
     521 	        {return static_cast<size_type>(__end_cap() - this->__begin_);}
     522 	    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
     523 	    bool empty() const _NOEXCEPT
  -> 524 	        {return this->__begin_ == this->__end_;}
     525 	    size_type max_size() const _NOEXCEPT;
     526 	    void reserve(size_type __n);
     527 	    void shrink_to_fit() _NOEXCEPT;
  Target 0: (ld64.lld) stopped.
  (lldb) bt
  * thread #16, stop reason = EXC_BAD_ACCESS (code=1, address=0xa00000129)
    * frame #0: 0x0000000100606a80 ld64.lld`llvm::DWARFUnit::tryExtractDIEsIfNeeded(bool) [inlined] std::__1::vector<llvm::DWARFDebugInfoEntry, std::__1::allocator<llvm::DWARFDebugInfoEntry> >::empty(this=0x0000000a00000129 size=0) const at vector:524:23 [opt]
      frame #1: 0x0000000100606a80 ld64.lld`llvm::DWARFUnit::tryExtractDIEsIfNeeded(this=0x0000000a00000009, CUDieOnly=true) at DWARFUnit.cpp:487:31 [opt]
      frame #2: 0x000000010060699c ld64.lld`llvm::DWARFUnit::extractDIEsIfNeeded(this=0x0000000a00000009, CUDieOnly=<unavailable>) at DWARFUnit.cpp:482:17 [opt]
      frame #3: 0x000000010060614c ld64.lld`llvm::DWARFUnit::getCompilationDir() [inlined] llvm::DWARFUnit::getUnitDIE(this=0x0000000a00000009, ExtractUnitDIEOnly=true) at DWARFUnit.h:403:5 [opt]
      frame #4: 0x0000000100606144 ld64.lld`llvm::DWARFUnit::getCompilationDir(this=0x0000000a00000009) at DWARFUnit.cpp:390:26 [opt]
      frame #5: 0x000000010025305c ld64.lld`lld::macho::ObjFile::sourceFile(this=0x00000001587fc698) const at InputFiles.cpp:1379:37 [opt]
      frame #6: 0x000000010027e280 ld64.lld`lld::macho::SymtabSection::emitStabs(this=0x000000028cdc4a00) at SyntheticSections.cpp:934:33 [opt]
      frame #7: 0x000000010027e850 ld64.lld`lld::macho::SymtabSection::finalizeContents(this=0x000000028cdc4a00) at SyntheticSections.cpp:1027:3 [opt]
      frame #8: 0x00000001002a4d74 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] std::__1::__function::__value_func<void ()>::operator(this=0x0000600001809218)() const at function.h:509:16 [opt]
      frame #9: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] std::__1::function<void ()>::operator(this=0x0000600001809218)() const at function.h:1186:12 [opt]
      frame #10: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] llvm::ThreadPool::createTaskAndFuture(this=0x0000600001809208)>)::'lambda'()::operator()() const at ThreadPool.h:135:15 [opt]
      frame #11: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] decltype(__f=0x0000600001809208)>)::'lambda'()&>(fp)()) std::__1::__invoke<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&>(llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&) at type_traits:2435:23 [opt]
      frame #12: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] void std::__1::__invoke_void_return_wrapper<void, true>::__call<llvm::ThreadPool::createTaskAndFuture(__args=0x0000600001809208)>)::'lambda'()&>(llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()&) at invoke.h:61:9 [opt]
      frame #13: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator()() [inlined] std::__1::__function::__alloc_func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator(this=0x0000600001809208)() at function.h:182:16 [opt]
      frame #14: 0x00000001002a4d60 ld64.lld`std::__1::__function::__func<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'(), std::__1::allocator<llvm::ThreadPool::createTaskAndFuture(std::__1::function<void ()>)::'lambda'()>, void ()>::operator(this=0x0000600001809200)() at function.h:356:12 [opt]
      frame #15: 0x000000010035dd54 ld64.lld`llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) [inlined] std::__1::__function::__value_func<void ()>::operator(this=0x00000002da436f18)() const at function.h:509:16 [opt]
      frame #16: 0x000000010035dd40 ld64.lld`llvm::ThreadPool::processTasks(llvm::ThreadPoolTaskGroup*) [inlined] std::__1::function<void ()>::operator(this=0x00000002da436f18)() const at function.h:1186:12 [opt]
      frame #17: 0x000000010035dd40 ld64.lld`llvm::ThreadPool::processTasks(this=0x000000016fdfe1a0, WaitingForGroup=0x0000000000000000) at ThreadPool.cpp:99:5 [opt]
      frame #18: 0x000000010035e694 ld64.lld`void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) [inlined] llvm::ThreadPool::grow(int)::$_0::operator()() const at ThreadPool.cpp:47:7 [opt]
      frame #19: 0x000000010035e680 ld64.lld`void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) [inlined] void llvm::thread::Apply<llvm::ThreadPool::grow(int)::$_0>(std::__1::tuple<llvm::ThreadPool::grow(int)::$_0>&, std::__1::integer_sequence<unsigned long>) at thread.h:42:5 [opt]
      frame #20: 0x000000010035e680 ld64.lld`void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(void*) [inlined] void llvm::thread::GenericThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(Ptr=0x0000600000121490) at thread.h:50:5 [opt]
      frame #21: 0x000000010035e678 ld64.lld`void* llvm::thread::ThreadProxy<std::__1::tuple<llvm::ThreadPool::grow(int)::$_0> >(Ptr=0x0000600000121490) at thread.h:60:5 [opt]
      frame #22: 0x000000018c02626c libsystem_pthread.dylib`_pthread_start + 148


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128184/new/

https://reviews.llvm.org/D128184



More information about the llvm-commits mailing list