Issue 114146
Summary [lld] ld64.lld does not respect allowable-client field in .tbds
Labels lld
Assignees
Reporter bdash
    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_
 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to