<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114146>114146</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld] ld64.lld does not respect allowable-client field in .tbds
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bdash
</td>
</tr>
</table>
<pre>
Apple's linker rejects linking to libraries with allowable client lists:
```
$ cc -framework vecLib -o test test.m
ld: cannot link directly with 'vecLib' because product being built is not an allowed client of it
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
After https://github.com/llvm/llvm-project/pull/97639, not only does ld64.lld not reject linking to vecLib.framework, it links to the library despite the binary not being an allowed client:
```
$ cc -framework vecLib -fuse-ld=lld -Bllvm-build/Release+Asserts/bin -o test test.m
$ nm -m test | grep vecLib
(undefined) external _vvdiv (from vecLib)
$ grep ' clients:' $(xcrun --show-sdk-path)/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/vecLib.tbd
clients: [ Accelerate ]
clients: [ vecLib ]
clients: [ vecLib ]
clients: [ vecLib ]
clients: [ vecLib ]
clients: [ Sparse, vecLib ]
```
Generating binaries that don't respect the allowable client list means applications will break if / when Apple moves symbols between libraries.
test.m:
```
#include <stdio.h>
#include <vecLib/vForce.h>
int main(int argc, char**argv) {
fprintf(stderr, "%p\n", &vvdiv);
return 0;
}
```
_Originally posted by @bdash in https://github.com/llvm/llvm-project/issues/97639#issuecomment-2445467330_
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vk9v6zYM_zTKhXDg0E6cHHJI0nmXBwzYA3YtZImOtcqSIclJ8-0HyUndtX3D2w4zCtWmKJL6_fgn3Ht1NkR7tj6y9dOCj6Gzbt9I7rtFY-VtfxgGTQwrD1qZF3Lg6E8SYfpU5gzBglaN406Rh6sKHXCt7ZU3mkBoRSaAVj54Vhx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