<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - LLD cannot link against iPhoneSimulator libSystem in Xcode 12 and newer"
href="https://bugs.llvm.org/show_bug.cgi?id=49799">49799</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLD cannot link against iPhoneSimulator libSystem in Xcode 12 and newer
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>MachO
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>smeenai@fb.com
</td>
</tr>
<tr>
<th>CC</th>
<td>gkm@fb.com, jezreel@gmail.com, llvm-bugs@lists.llvm.org, smeenai@fb.com
</td>
</tr></table>
<p>
<div>
<pre>$ 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>