Skip to content
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

LLD library not exposing symbols on aarch64-darwin #178879

Closed
winterqt opened this issue Jun 24, 2022 · 1 comment
Closed

LLD library not exposing symbols on aarch64-darwin #178879

winterqt opened this issue Jun 24, 2022 · 1 comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin

Comments

@winterqt
Copy link
Member

Describe the bug

When building Zig on aarch64-darwin, it fails to link to LLD:

Undefined symbols for architecture arm64:
  "operator delete[](void*)", referenced from:
      lld::elf::Configuration::~Configuration() in liblldELF.a(Driver.cpp.o)
      lld::elf::readFile(llvm::StringRef) in liblldELF.a(InputFiles.cpp.o)
      std::__1::pair<llvm::DenseMapIterator<llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString>, false>, bool> llvm::DenseMapBase<llvm::DenseMap<llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >, llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >::try_emplace<llvm::detail::DenseSetEmpty&>(llvm::CachedHashString const&, llvm::detail::DenseSetEmpty&) in liblldELF.a(InputFiles.cpp.o)
      llvm::DenseMapBase<llvm::DenseMap<llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >, llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >::moveFromOldBuckets(llvm::detail::DenseSetPair<llvm::CachedHashString>*, llvm::detail::DenseSetPair<llvm::CachedHashString>*) in liblldELF.a(InputFiles.cpp.o)
      void std::__1::vector<llvm::CachedHashString, std::__1::allocator<llvm::CachedHashString> >::__push_back_slow_path<llvm::CachedHashString const&>(llvm::CachedHashString const&) in liblldELF.a(InputFiles.cpp.o)
      lld::coff::TpiSource::clear() in liblldCOFF.a(DebugTypes.cpp.o)
      lld::coff::TpiSource::clearGHashes() in liblldCOFF.a(DebugTypes.cpp.o)
      ...
  "operator delete(void*)", referenced from:
      _ZigLLVMGetNativeFeatures in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMCreateTargetMachine in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMTargetMachineEmitToFile in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMDisposeDIBuilder in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMGetNativeTarget in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMWriteImportLibrary in libzigcpp.a(zig_llvm.cpp.o)
      llvm::Expected<llvm::object::COFFModuleDefinition>::~Expected() in libzigcpp.a(zig_llvm.cpp.o)
      ...
  "operator new[](unsigned long)", referenced from:
      bigint_unsigned_division(BigInt const*, BigInt const*, BigInt*, BigInt*) in libzigstage1.a(bigint.cpp.o)
      lld::elf::readFile(llvm::StringRef) in liblldELF.a(InputFiles.cpp.o)
      std::__1::pair<llvm::DenseMapIterator<llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString>, false>, bool> llvm::DenseMapBase<llvm::DenseMap<llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >, llvm::CachedHashString, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::CachedHashString>, llvm::detail::DenseSetPair<llvm::CachedHashString> >::try_emplace<llvm::detail::DenseSetEmpty&>(llvm::CachedHashString const&, llvm::detail::DenseSetEmpty&) in liblldELF.a(InputFiles.cpp.o)
      void std::__1::vector<llvm::CachedHashString, std::__1::allocator<llvm::CachedHashString> >::__push_back_slow_path<llvm::CachedHashString const&>(llvm::CachedHashString const&) in liblldELF.a(InputFiles.cpp.o)
      lld::coff::TpiSource::loadGHashes() in liblldCOFF.a(DebugTypes.cpp.o)
      lld::coff::TpiSource::assignGHashesFromVector(std::__1::vector<llvm::codeview::GloballyHashedType, std::__1::allocator<llvm::codeview::GloballyHashedType> >&&) in liblldCOFF.a(DebugTypes.cpp.o)
      lld::coff::TypeMerger::mergeTypesWithGHash() in liblldCOFF.a(DebugTypes.cpp.o)
      ...
  "operator new(unsigned long)", referenced from:
      _ZigLLVMTargetMachineEmitToFile in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLDLinkCOFF in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLDLinkELF in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLDLinkWasm in libzigcpp.a(zig_llvm.cpp.o)
      llvm::ErrorList::join(llvm::Error, llvm::Error) in libzigcpp.a(zig_llvm.cpp.o)
      std::__1::vector<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> >, std::__1::allocator<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> > > >::insert(std::__1::__wrap_iter<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> > const*>, std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> >&&) in libzigcpp.a(zig_llvm.cpp.o)
      void std::__1::vector<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> >, std::__1::allocator<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> > > >::__push_back_slow_path<std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> > >(std::__1::unique_ptr<llvm::ErrorInfoBase, std::__1::default_delete<llvm::ErrorInfoBase> >&&) in libzigcpp.a(zig_llvm.cpp.o)
      ...
  "operator new(unsigned long, std::nothrow_t const&)", referenced from:
      _ZigLLVMTargetMachineEmitToFile in libzigcpp.a(zig_llvm.cpp.o)
      _ZigLLVMCreateDIBuilder in libzigcpp.a(zig_llvm.cpp.o)
      lld::elf::EhFrameSection::getFdeData() const in liblldELF.a(SyntheticSections.cpp.o)
      lld::elf::SymbolTableBaseSection::finalizeContents() in liblldELF.a(SyntheticSections.cpp.o)
      lld::elf::SymbolTableBaseSection::sortSymTabSymbols() in liblldELF.a(SyntheticSections.cpp.o)
      lld::elf::GnuHashTableSection::addSymbols(std::__1::vector<lld::elf::SymbolTableEntry, std::__1::allocator<lld::elf::SymbolTableEntry> >&) in liblldELF.a(SyntheticSections.cpp.o)
      lld::elf::ARMExidxSyntheticSection::finalizeContents() in liblldELF.a(SyntheticSections.cpp.o)
      ...
ld: symbol(s) not found for architecture arm64

Steps To Reproduce

Steps to reproduce the behavior:

  1. Set zig.meta.broken to stdenv.isDarwin && stdenv.isx86_64
  2. Attempt to build

Expected behavior

The build succeeds.

Additional context

I'm convinced that this is an issue on the LLVM side of things (as opposed to the Zig end), because this derivation works fine on Linux. If I'm wrong, please let me know.

Notify maintainers

@lovek323 @7c6f434c @dtzWill @primeos

@winterqt winterqt added 0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin labels Jun 24, 2022
@winterqt
Copy link
Member Author

This was fixed by #181485.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

1 participant