Does ld64 warn or fail when an upgraded Xcode links mixed-ABI Objective-C objects?
0 reputation · 15 Oct 2020, 15:15 UTC
An Objective-C project that breaks right after an Xcode upgrade is often recovered by clearing DerivedData and rebuilding. The open question is what happens when that rebuild links object files from two toolchains — stale objects from the old configuration, or a prebuilt static library compiled against an earlier SDK.
The Objective-C non-fragile ABI and the linker's handling of duplicate class symbols are documented, but the mixed-ABI case is not clearly specified. Depending on the ld64 version, a collision in _OBJC_CLASS_$_ symbols may surface as a hard error, a warning, or apparently clean output — and a binary that links could still misbehave at runtime during class or method lookup.
Assume recent Xcode 15/16 toolchains with default ABI settings; a minimal check would link a small app against a library built with an older toolchain and watch the link log plus runtime behavior.
- Does ld64 treat duplicate Objective-C class symbols from mixed-ABI object files as an error, a warning, or nothing?
- Which build settings, such as the Objective-C Runtime ABI version, force such mismatches to fail at link time?
- Is a DerivedData wipe sufficient, or can prebuilt static libraries still carry old-ABI metadata into the link?