[lld] 7def700 - [lld/mac] Rename DylibFile::dylibName to DylibFile::installName
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 6 17:01:24 PDT 2021
Author: Nico Weber
Date: 2021-06-06T20:00:35-04:00
New Revision: 7def700667ec587e01c5cf7fbc6d31e613d1b801
URL: https://github.com/llvm/llvm-project/commit/7def700667ec587e01c5cf7fbc6d31e613d1b801
DIFF: https://github.com/llvm/llvm-project/commit/7def700667ec587e01c5cf7fbc6d31e613d1b801.diff
LOG: [lld/mac] Rename DylibFile::dylibName to DylibFile::installName
The flag to set it is called `-install_name`, and it's called `installName` in tbd files.
No behavior change.
Differential Revision: https://reviews.llvm.org/D103776
Added:
Modified:
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Writer.cpp
Removed:
################################################################################
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index ec99f8004990..288a3ac3847c 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -84,7 +84,7 @@ std::string lld::toString(const InputFile *f) {
// 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();
+ return (f->getName() + "(" + dylibFile->installName + ")").str();
if (f->archiveName.empty())
return std::string(f->getName());
@@ -821,12 +821,13 @@ DylibFile::DylibFile(MemoryBufferRef mb, DylibFile *umbrella,
auto *buf = reinterpret_cast<const uint8_t *>(mb.getBufferStart());
auto *hdr = reinterpret_cast<const mach_header *>(mb.getBufferStart());
- // Initialize dylibName.
+ // Initialize installName.
if (const load_command *cmd = findCommand(hdr, LC_ID_DYLIB)) {
auto *c = reinterpret_cast<const dylib_command *>(cmd);
currentVersion = read32le(&c->dylib.current_version);
compatibilityVersion = read32le(&c->dylib.compatibility_version);
- dylibName = reinterpret_cast<const char *>(cmd) + read32le(&c->dylib.name);
+ installName =
+ reinterpret_cast<const char *>(cmd) + read32le(&c->dylib.name);
} else if (!isBundleLoader) {
// macho_executable and macho_bundle don't have LC_ID_DYLIB,
// so it's OK.
@@ -843,7 +844,7 @@ DylibFile::DylibFile(MemoryBufferRef mb, DylibFile *umbrella,
return;
// Initialize symbols.
- exportingFile = isImplicitlyLinked(dylibName) ? this : this->umbrella;
+ exportingFile = isImplicitlyLinked(installName) ? this : this->umbrella;
if (const load_command *cmd = findCommand(hdr, LC_DYLD_INFO_ONLY)) {
auto *c = reinterpret_cast<const dyld_info_command *>(cmd);
parseTrie(buf + c->export_off, c->export_size,
@@ -911,21 +912,21 @@ DylibFile::DylibFile(const InterfaceFile &interface, DylibFile *umbrella,
umbrella = this;
this->umbrella = umbrella;
- dylibName = saver.save(interface.getInstallName());
+ installName = saver.save(interface.getInstallName());
compatibilityVersion = interface.getCompatibilityVersion().rawValue();
currentVersion = interface.getCurrentVersion().rawValue();
if (config->printEachFile)
message(toString(this));
- if (!is_contained(skipPlatformChecks, dylibName) &&
+ if (!is_contained(skipPlatformChecks, installName) &&
!is_contained(interface.targets(), config->platformInfo.target)) {
error(toString(this) + " is incompatible with " +
std::string(config->platformInfo.target));
return;
}
- exportingFile = isImplicitlyLinked(dylibName) ? this : umbrella;
+ exportingFile = isImplicitlyLinked(installName) ? this : umbrella;
auto addSymbol = [&](const Twine &name) -> void {
symbols.push_back(symtab->addDylib(saver.save(name), exportingFile,
/*isWeakDef=*/false,
@@ -1028,7 +1029,7 @@ void DylibFile::handleLDPreviousSymbol(StringRef name, StringRef originalName) {
config->platformInfo.minimum >= end)
return;
- dylibName = saver.save(installName);
+ this->installName = saver.save(installName);
if (!compatVersion.empty()) {
VersionTuple cVersion;
@@ -1050,7 +1051,7 @@ void DylibFile::handleLDInstallNameSymbol(StringRef name,
if (!condition.consume_front("os") || version.tryParse(condition))
warn("failed to parse os version, symbol '" + originalName + "' ignored");
else if (version == config->platformInfo.minimum)
- dylibName = saver.save(installName);
+ this->installName = saver.save(installName);
}
ArchiveFile::ArchiveFile(std::unique_ptr<object::Archive> &&f)
diff --git a/lld/MachO/InputFiles.h b/lld/MachO/InputFiles.h
index 7c6fcc3ddda6..3c723948242b 100644
--- a/lld/MachO/InputFiles.h
+++ b/lld/MachO/InputFiles.h
@@ -149,7 +149,7 @@ class DylibFile : public InputFile {
static bool classof(const InputFile *f) { return f->kind() == DylibKind; }
- StringRef dylibName;
+ StringRef installName;
DylibFile *exportingFile = nullptr;
DylibFile *umbrella;
uint32_t compatibilityVersion = 0;
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index f01aeb22e18c..d6d8896017f3 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -717,7 +717,7 @@ template <class LP> void Writer::createLoadCommands() {
// files.
// In the first case, *semantically distinct* DylibFiles will have the
// same installName.
- int64_t &ordinal = ordinalForInstallName[dylibFile->dylibName];
+ int64_t &ordinal = ordinalForInstallName[dylibFile->installName];
if (ordinal) {
dylibFile->ordinal = ordinal;
continue;
@@ -728,13 +728,13 @@ template <class LP> void Writer::createLoadCommands() {
dylibFile->forceWeakImport || dylibFile->refState == RefState::Weak
? LC_LOAD_WEAK_DYLIB
: LC_LOAD_DYLIB;
- in.header->addLoadCommand(make<LCDylib>(lcType, dylibFile->dylibName,
+ in.header->addLoadCommand(make<LCDylib>(lcType, dylibFile->installName,
dylibFile->compatibilityVersion,
dylibFile->currentVersion));
if (dylibFile->reexport)
in.header->addLoadCommand(
- make<LCDylib>(LC_REEXPORT_DYLIB, dylibFile->dylibName));
+ make<LCDylib>(LC_REEXPORT_DYLIB, dylibFile->installName));
}
}
More information about the llvm-commits
mailing list