[PATCH] D97905: [lld-macho] Include install name in error messages for dylibs from TBDs
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 4 09:05:00 PST 2021
int3 updated this revision to Diff 328198.
int3 marked 2 inline comments as done.
int3 added a comment.
move up initialization of all fields
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97905/new/
https://reviews.llvm.org/D97905
Files:
lld/MachO/InputFiles.cpp
lld/test/MachO/invalid/incompatible-target-tapi.test
Index: lld/test/MachO/invalid/incompatible-target-tapi.test
===================================================================
--- lld/test/MachO/invalid/incompatible-target-tapi.test
+++ lld/test/MachO/invalid/incompatible-target-tapi.test
@@ -6,5 +6,5 @@
RUN: -o /dev/null 2>&1 | FileCheck %s --check-prefix=ARCH
RUN: not %lld -dylib -arch arm64 -platform_version ios-simulator 14.0 15.0 %t/arm64-test.o \
RUN: %S/Inputs/libincompatible.tbd -o /dev/null 2>&1 | FileCheck %s --check-prefix=PLATFORM
-ARCH: error: {{.*}}libincompatible.tbd is incompatible with x86_64 (macOS)
-PLATFORM: error: {{.*}}libincompatible.tbd is incompatible with arm64 (iOS Simulator)
+ARCH: error: {{.*}}libincompatible.tbd(/usr/lib/libincompatible.dylib) is incompatible with x86_64 (macOS)
+PLATFORM: error: {{.*}}libincompatible.tbd(/usr/lib/libincompatible.dylib) is incompatible with arm64 (iOS Simulator)
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -79,6 +79,12 @@
std::string lld::toString(const InputFile *f) {
if (!f)
return "<internal>";
+
+ // Multiple dylibs can be defined in one .tbd file.
+ if (auto dylibFile = dyn_cast<DylibFile>(f))
+ if (f->getName().endswith(".tbd"))
+ return (f->getName() + "(" + dylibFile->dylibName + ")").str();
+
if (f->archiveName.empty())
return std::string(f->getName());
return (path::filename(f->archiveName) + "(" + path::filename(f->getName()) +
@@ -700,15 +706,16 @@
if (umbrella == nullptr)
umbrella = this;
+ dylibName = saver.save(interface.getInstallName());
+ compatibilityVersion = interface.getCompatibilityVersion().rawValue();
+ currentVersion = interface.getCurrentVersion().rawValue();
+
if (!is_contained(interface.targets(), config->target)) {
error(toString(this) + " is incompatible with " +
std::string(config->target));
return;
}
- dylibName = saver.save(interface.getInstallName());
- compatibilityVersion = interface.getCompatibilityVersion().rawValue();
- currentVersion = interface.getCurrentVersion().rawValue();
DylibFile *exportingFile = isImplicitlyLinked(dylibName) ? this : umbrella;
auto addSymbol = [&](const Twine &name) -> void {
symbols.push_back(symtab->addDylib(saver.save(name), exportingFile,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97905.328198.patch
Type: text/x-patch
Size: 2378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210304/0289b709/attachment.bin>
More information about the llvm-commits
mailing list