How to call the compiler as if it were the linker

Lawrence Velázquez larryv at macports.org
Thu Oct 2 08:27:58 PDT 2014


On Oct 2, 2014, at 2:11 AM, Ryan Schmidt <ryandesign at macports.org> wrote:

> I thought I would be clever and just replace "ld" with ${configure.cc} and that would work, and it did on Yosemite beta. On every previous system however it caused clang to experience an assertion failure, so I must not be doing this right.

Re: https://trac.macports.org/ticket/41653#comment:9

Looks like ld64 is doing the asserting, not Clang.

> :info:build /usr/bin/clang -arch x86_64 -r lex.yy.o y.tab.o -o gr1c_parse.o
> :info:build ld: warning: unexpected dylib (/usr/lib/libSystem.dylib) on link line
> :info:build 0  0x1003aa098  __assert_rtn + 144
> :info:build 1  0x1003f5682  std::__1::map<ld::File const*, ld::File::Ordinal, std::__1::less<ld::File const*>, std::__1::allocator<std::__1::pair<ld::File const* const, ld::File::Ordinal> > >::operator[](ld::File const* const&) + 0
> :info:build 2  0x1003f535f  ld::tool::SectionRelocationsAtom<x86_64>::sectSymNum(bool, ld::Atom const*) + 45
> :info:build 3  0x1003eaabb  ld::tool::SectionRelocationsAtom<x86_64>::encodeSectionReloc(ld::Internal::FinalSection*, ld::tool::SectionRelocationsAtom<x86_64>::Entry const&, std::__1::vector<macho_relocation_info<Pointer64<LittleEndian> >, std::__1::allocator<macho_relocation_info<Pointer64<LittleEndian> > > >&) + 77
> :info:build 4  0x10040c0a2  ld::tool::SectionRelocationsAtom<x86_64>::encode() + 62
> :info:build 5  0x1003f0340  ld::tool::OutputFile::updateLINKEDITAddresses(ld::Internal&) + 420
> :info:build 6  0x1003ec030  ld::tool::OutputFile::write(ld::Internal&) + 136
> :info:build 7  0x1003aa4d7  main + 713
> :info:build 8  0x10039bcd4  start + 52
> :info:build A linker snapshot was created at:
> :info:build 	/tmp/gr1c_parse.o-2014-09-01-232702.ld-snapshot
> :info:build ld: Assertion failed: (_machoSection != 0), function machoSection, file /SourceCache/ld64/ld64-136/src/ld/ld.hpp, line 641.
> :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

vq


More information about the macports-dev mailing list