[PATCH] D103810: [lld/mac] Process $ld$ os condition for all actions
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 07:02:23 PDT 2021
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a reviewer: int3.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.
All non-"previous" actions have the same conditional format,
so make them all share the condition logic.
That makes it easier to warn on the not-yet implemented actions,
and maybe also to actually implement them.
No behavior change.
https://reviews.llvm.org/D103810
Files:
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
Index: lld/MachO/InputFiles.h
===================================================================
--- lld/MachO/InputFiles.h
+++ lld/MachO/InputFiles.h
@@ -177,7 +177,8 @@
private:
bool handleLDSymbol(StringRef originalName);
void handleLDPreviousSymbol(StringRef name, StringRef originalName);
- void handleLDInstallNameSymbol(StringRef name, StringRef originalName);
+ void handleLDActionSymbol(StringRef action, StringRef name,
+ StringRef originalName);
};
// .a file
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -1010,8 +1010,8 @@
std::tie(action, name) = originalName.drop_front(strlen("$ld$")).split('$');
if (action == "previous")
handleLDPreviousSymbol(name, originalName);
- else if (action == "install_name")
- handleLDInstallNameSymbol(name, originalName);
+ else
+ handleLDActionSymbol(action, name, originalName);
return true;
}
@@ -1068,16 +1068,20 @@
}
}
-void DylibFile::handleLDInstallNameSymbol(StringRef name,
+void DylibFile::handleLDActionSymbol(StringRef action, StringRef name,
StringRef originalName) {
- // originalName: $ld$ install_name $ os<version> $ install_name
- StringRef condition, installName;
- std::tie(condition, installName) = name.split('$');
+ // originalName: $ld$ <action> $ os<version> $ symbol
+ StringRef condition, symbol;
+ std::tie(condition, symbol) = name.split('$');
VersionTuple version;
if (!condition.consume_front("os") || version.tryParse(condition))
warn("failed to parse os version, symbol '" + originalName + "' ignored");
- else if (version == config->platformInfo.minimum)
- this->installName = saver.save(installName);
+ else if (version != config->platformInfo.minimum)
+ return;
+
+ if (action == "install_name")
+ installName = saver.save(symbol);
+ // FIXME: Support actions "compatibility_version", "hide", "add", "weak".
}
ArchiveFile::ArchiveFile(std::unique_ptr<object::Archive> &&f)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103810.350276.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210607/da6fb309/attachment.bin>
More information about the llvm-commits
mailing list