[llvm-bugs] [Bug 49799] New: LLD cannot link against iPhoneSimulator libSystem in Xcode 12 and newer
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 31 20:39:47 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49799
Bug ID: 49799
Summary: LLD cannot link against iPhoneSimulator libSystem in
Xcode 12 and newer
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: MachO
Assignee: unassignedbugs at nondot.org
Reporter: smeenai at fb.com
CC: gkm at fb.com, jezreel at gmail.com,
llvm-bugs at lists.llvm.org, smeenai at fb.com
$ cat null.s
.globl _main
_main:
retq
$ llvm-mc -filetype obj -triple x86_64-apple-ios14.0.0-simulator \
-o null.o null.s
$ ld64.lld -platform_version ios-simulator 14.0.0 14.0 -arch x86_64 \
-o null null.o -lSystem -syslibroot \
/Applications/Xcode_12.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
ld64.lld: error:
/Applications/Xcode_12.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/libsystem_kernel.tbd(/usr/lib/system/libsystem_kernel.dylib)
is incompatible with x86_64 (iOS Simulator)
ld64.lld: error:
/Applications/Xcode_12.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/libsystem_platform.tbd(/usr/lib/system/libsystem_platform.dylib)
is incompatible with x86_64 (iOS Simulator)
ld64.lld: error:
/Applications/Xcode_12.0.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/libsystem_pthread.tbd(/usr/lib/system/libsystem_pthread.dylib)
is incompatible with x86_64 (iOS Simulator)
Repros with 12.4 and 12.5 as well (and I presume other 12.x versions).
The error message seems legit, as far as I can tell. If I look at the
iPhoneSimulator libSystem.tbd, libsystem_kernel indeed doesn't have
x86_64-ios-simulator in its targets list. However, it's re-exported by
libsystem_sim_kernel_host, which does mark it as a re-export for the
x86_64-ios-simulator target (potentially a bug?). libsystem_sim_kernel_host is
re-exported by libsystem_sim_kernel, which is re-exported by libSystem, which
is presumably how we end up with the error.
ld64 is able to handle this libSystem. Interestingly enough, even if I force a
reference to __kernelrpc_mach_port_destroy_trap, which is not defined for
x86_64-ios-simulator (but is defined for x86_64-macos), it's able to link. The
link does fail if I reference ___aio_suspend, which is only defined for
i386-macos. I don't know if ld64 is specifically treating ios-simulator and
macos as equivalent, or if it's only looking at the architecture and not the
platform in general.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210401/baf69692/attachment.html>
More information about the llvm-bugs
mailing list