diff options
Diffstat (limited to 'llvm/tools/llvm-objcopy/CopyConfig.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/CopyConfig.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/CopyConfig.cpp b/llvm/tools/llvm-objcopy/CopyConfig.cpp index cdd9147..1bab7cd 100644 --- a/llvm/tools/llvm-objcopy/CopyConfig.cpp +++ b/llvm/tools/llvm-objcopy/CopyConfig.cpp @@ -895,6 +895,9 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) { for (auto Arg : InputArgs.filtered(INSTALL_NAME_TOOL_add_rpath)) Config.RPathToAdd.push_back(Arg->getValue()); + for (auto *Arg : InputArgs.filtered(INSTALL_NAME_TOOL_prepend_rpath)) + Config.RPathToPrepend.push_back(Arg->getValue()); + for (auto Arg : InputArgs.filtered(INSTALL_NAME_TOOL_delete_rpath)) { StringRef RPath = Arg->getValue(); @@ -904,6 +907,11 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) { errc::invalid_argument, "cannot specify both -add_rpath %s and -delete_rpath %s", RPath.str().c_str(), RPath.str().c_str()); + if (is_contained(Config.RPathToPrepend, RPath)) + return createStringError( + errc::invalid_argument, + "cannot specify both -prepend_rpath %s and -delete_rpath %s", + RPath.str().c_str(), RPath.str().c_str()); Config.RPathsToRemove.insert(RPath); } @@ -940,6 +948,13 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) { "cannot specify both -add_rpath " + *It3 + " and -rpath " + Old + " " + New); + // Cannot specify the same rpath under both -prepend_rpath and -rpath. + auto It4 = find_if(Config.RPathToPrepend, Match); + if (It4 != Config.RPathToPrepend.end()) + return createStringError(errc::invalid_argument, + "cannot specify both -prepend_rpath " + *It4 + + " and -rpath " + Old + " " + New); + Config.RPathsToUpdate.insert({Old, New}); } |