[PATCH] D97865: [lld-macho] Bind re-exported symbols directly to implicitly-linked umbrellas
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 3 08:44:41 PST 2021
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Suppose we are linking against libFoo, which re-exports the
implicitly-bound libSystem, which in turn re-exports some
non-explicitly-bound library like `/usr/lib/system/libsystem_c.dylib`.
Then any bindings we have to a symbol in libsystem_c should use
libSystem (and not libFoo) as the umbrella library.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97865
Files:
lld/MachO/InputFiles.cpp
lld/test/MachO/implicit-dylibs.s
Index: lld/test/MachO/implicit-dylibs.s
===================================================================
--- lld/test/MachO/implicit-dylibs.s
+++ lld/test/MachO/implicit-dylibs.s
@@ -24,7 +24,7 @@
# RUN: %lld -dylib -lSystem %t/libunused.o -o %t/usr/lib/libunused.dylib -install_name /usr/lib/libunused.dylib
## Bar.framework is nested within Foo.framework.
-# RUN: %lld -dylib -lSystem %t/framework-baz.o -o %t/System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Versions/A/Bar \
+# RUN: %lld -dylib -lSystem %t/framework-bar.o -o %t/System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Versions/A/Bar \
# RUN: -install_name /System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Versions/A/Bar
# RUN: ln -sf %t/System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Versions/A/Bar \
# RUN: %t/System/Library/Frameworks/Foo.framework/Frameworks/Bar.framework/Bar
@@ -35,7 +35,7 @@
# RUN: -install_name /System/Library/Frameworks/Foo.framework/Versions/A/Foo
# RUN: ln -sf %t/System/Library/Frameworks/Foo.framework/Versions/A/Foo %t/System/Library/Frameworks/Foo.framework/Foo
-# RUN: %lld -dylib -lSystem %t/framework-bar.o -o %t/Baz.framework/Versions/A/Baz \
+# RUN: %lld -dylib -lSystem %t/framework-baz.o -o %t/Baz.framework/Versions/A/Baz \
# RUN: -install_name %t/Baz.framework/Versions/A/Baz
# RUN: ln -sf %t/Baz.framework/Versions/A/Baz %t/Baz.framework/Baz
@@ -54,7 +54,7 @@
# CHECK-DAG: __DATA __data {{.*}} pointer 0 libtoplevel _toplevel
# CHECK-DAG: __DATA __data {{.*}} pointer 0 libreexporter _sublevel
# CHECK-DAG: __DATA __data {{.*}} pointer 0 Foo _framework_foo
-# CHECK-DAG: __DATA __data {{.*}} pointer 0 libreexporter _framework_bar
+# CHECK-DAG: __DATA __data {{.*}} pointer 0 Foo _framework_bar
# CHECK-DAG: __DATA __data {{.*}} pointer 0 libreexporter _framework_baz
# CHECK-DAG: __DATA __data {{.*}} pointer 0 libc++abi ___gxx_personality_v0
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -693,7 +693,7 @@
const auto *c = reinterpret_cast<const dylib_command *>(cmd);
StringRef reexportPath =
reinterpret_cast<const char *>(c) + read32le(&c->dylib.name);
- loadReexport(reexportPath, umbrella, nullptr);
+ loadReexport(reexportPath, exportingFile, nullptr);
}
// FIXME: What about LC_LOAD_UPWARD_DYLIB, LC_LAZY_LOAD_DYLIB,
@@ -765,7 +765,7 @@
interface.getParent() == nullptr ? &interface : interface.getParent();
for (InterfaceFileRef intfRef : interface.reexportedLibraries())
- loadReexport(intfRef.getInstallName(), umbrella, topLevel);
+ loadReexport(intfRef.getInstallName(), exportingFile, topLevel);
}
ArchiveFile::ArchiveFile(std::unique_ptr<object::Archive> &&f)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97865.327814.patch
Type: text/x-patch
Size: 2889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210303/1ce87859/attachment.bin>
More information about the llvm-commits
mailing list