mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 21:06:50 +00:00
[lld] load rpaths from tbd files (#134925)
TBD files can contain rpaths, add support for setting them in DylibFile during construction.
This commit is contained in:
parent
15428e0d78
commit
4b267bb7c2
@ -1879,6 +1879,9 @@ DylibFile::DylibFile(const InterfaceFile &interface, DylibFile *umbrella,
|
||||
installName = saver().save(interface.getInstallName());
|
||||
compatibilityVersion = interface.getCompatibilityVersion().rawValue();
|
||||
currentVersion = interface.getCurrentVersion().rawValue();
|
||||
for (const auto &rpath : interface.rpaths())
|
||||
if (rpath.first == config->platformInfo.target)
|
||||
rpaths.push_back(saver().save(rpath.second));
|
||||
|
||||
if (config->printEachFile)
|
||||
message(toString(this));
|
||||
|
87
lld/test/MachO/tapi-rpath.s
Normal file
87
lld/test/MachO/tapi-rpath.s
Normal file
@ -0,0 +1,87 @@
|
||||
# REQUIRES: aarch64, shell
|
||||
# RUN: rm -rf %t; split-file %s %t
|
||||
# RUN: ln -s Versions/A/Developer %t/Developer/Library/Frameworks/Developer.framework/
|
||||
# RUN: ln -s Versions/A/DeveloperCore %t/Developer/Library/PrivateFrameworks/DeveloperCore.framework/
|
||||
# RUN: llvm-mc -filetype obj -triple arm64-apple-macos11.0 %t/test.s -o %t/test.o
|
||||
# RUN: %lld -arch arm64 -platform_version macos 11.0 11.0 -o %t/test -framework Developer -F %t/Developer/Library/Frameworks %t/test.o
|
||||
|
||||
# RUN: llvm-objdump --bind --no-show-raw-insn -d %t/test | FileCheck %s
|
||||
# CHECK: Bind table:
|
||||
# CHECK-DAG: __DATA __data {{.*}} pointer 0 Developer _funcPublic
|
||||
# CHECK-DAG: __DATA __data {{.*}} pointer 0 Developer _funcCore
|
||||
|
||||
#--- Developer/Library/Frameworks/Developer.framework/Versions/A/Developer
|
||||
{
|
||||
"tapi_tbd_version": 5,
|
||||
"main_library": {
|
||||
"target_info": [
|
||||
{
|
||||
"target": "arm64-macos"
|
||||
}
|
||||
],
|
||||
"install_names": [
|
||||
{
|
||||
"name": "@rpath/Developer.framework/Versions/A/Developer"
|
||||
}
|
||||
],
|
||||
"rpaths": [
|
||||
{
|
||||
"paths": [
|
||||
"@loader_path/../../../../PrivateFrameworks/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"reexported_libraries": [
|
||||
{
|
||||
"names": [
|
||||
"@rpath/DeveloperCore.framework/Versions/A/DeveloperCore"
|
||||
]
|
||||
}
|
||||
],
|
||||
"exported_symbols": [
|
||||
{
|
||||
"text": {
|
||||
"global": ["_funcPublic"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
#--- Developer/Library/PrivateFrameworks/DeveloperCore.framework/Versions/A/DeveloperCore
|
||||
{
|
||||
"tapi_tbd_version": 5,
|
||||
"main_library": {
|
||||
"target_info": [
|
||||
{
|
||||
"target": "arm64-macos"
|
||||
}
|
||||
],
|
||||
"install_names": [
|
||||
{
|
||||
"name": "@rpath/DeveloperCore.framework/Versions/A/DeveloperCore"
|
||||
}
|
||||
],
|
||||
"allowable_clients": [
|
||||
{
|
||||
"clients": ["Developer"]
|
||||
}
|
||||
],
|
||||
"exported_symbols": [
|
||||
{
|
||||
"text": {
|
||||
"global": ["_funcCore"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
#--- test.s
|
||||
.text
|
||||
.globl _main
|
||||
|
||||
_main:
|
||||
ret
|
||||
|
||||
.data
|
||||
.quad _funcPublic
|
||||
.quad _funcCore
|
Loading…
x
Reference in New Issue
Block a user