Search code examples
xcodeclang

XCode 14: ld: Assertion failed: (dylib != NULL), function classicOrdinalForProxy when compiling with -mcmodel=large


I've just updated to Xcode 14, I compile my code with the -mcmodel=large flag.

This used to work on Xcode 13, but since the upgrade I get the following error:

0  0x104a141a0  __assert_rtn + 140
1  0x104a1d2ec  ld::tool::SymbolTableAtom<arm64>::classicOrdinalForProxy(ld::Atom const*) (.cold.2) + 0
2  0x104925598  ld::tool::LocalRelocationsAtom<arm64_32>::~LocalRelocationsAtom() + 0
3  0x104924ab8  ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 204
4  0x104924150  ld::tool::SymbolTableAtom<arm64>::encode() + 420
5  0x104910c18  ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke_3 + 36
6  0x1ac8465f0  _dispatch_call_block_and_release + 32
7  0x1ac8481b4  _dispatch_client_callout + 20
8  0x1ac859b14  _dispatch_root_queue_drain + 952
9  0x1ac85a104  _dispatch_worker_thread2 + 164
10  0x1aca08324  _pthread_wqthread + 228
A linker snapshot was created at:
    /tmp/project_name-2022-09-18-183942.ld-snapshot
ld: Assertion failed: (dylib != NULL), function classicOrdinalForProxy, file LinkEditClassic.hpp, line 495.

Removing -mcmodel=large solves the issue, but I need this flag for my code.


Solution

  • Does -fno-objc-msgsend-selector-stubs help?