[PATCH] D87855: [llvm-install-name-tool] Validate -id value early
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 18:03:16 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9f9027c3c07: [llvm-install-name-tool] Validate -id value early (authored by alexshap).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87855/new/
https://reviews.llvm.org/D87855
Files:
llvm/tools/llvm-objcopy/CopyConfig.cpp
llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
Index: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
===================================================================
--- llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
+++ llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
@@ -181,13 +181,9 @@
for (LoadCommand &LC : Obj.LoadCommands) {
switch (LC.MachOLoadCommand.load_command_data.cmd) {
case MachO::LC_ID_DYLIB:
- if (Config.SharedLibId) {
- StringRef Id = Config.SharedLibId.getValue();
- if (Id.empty())
- return createStringError(errc::invalid_argument,
- "cannot specify an empty id");
- updateLoadCommandPayloadString<MachO::dylib_command>(LC, Id);
- }
+ if (Config.SharedLibId)
+ updateLoadCommandPayloadString<MachO::dylib_command>(
+ LC, *Config.SharedLibId);
break;
case MachO::LC_RPATH: {
Index: llvm/tools/llvm-objcopy/CopyConfig.cpp
===================================================================
--- llvm/tools/llvm-objcopy/CopyConfig.cpp
+++ llvm/tools/llvm-objcopy/CopyConfig.cpp
@@ -902,12 +902,15 @@
Config.RPathsToUpdate.insert({Old, New});
}
- if (auto *Arg = InputArgs.getLastArg(INSTALL_NAME_TOOL_id))
+ if (auto *Arg = InputArgs.getLastArg(INSTALL_NAME_TOOL_id)) {
Config.SharedLibId = Arg->getValue();
+ if (Config.SharedLibId->empty())
+ return createStringError(errc::invalid_argument,
+ "cannot specify an empty id");
+ }
- for (auto *Arg : InputArgs.filtered(INSTALL_NAME_TOOL_change)) {
+ for (auto *Arg : InputArgs.filtered(INSTALL_NAME_TOOL_change))
Config.InstallNamesToUpdate.insert({Arg->getValue(0), Arg->getValue(1)});
- }
SmallVector<StringRef, 2> Positional;
for (auto Arg : InputArgs.filtered(INSTALL_NAME_TOOL_UNKNOWN))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87855.292929.patch
Type: text/x-patch
Size: 1815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200919/042e936e/attachment.bin>
More information about the llvm-commits
mailing list