forked from OSchip/llvm-project
[llvm-install-name-tool] Quote passed rpath args in error messages
This diff refactors error reporting to make it more clear what arguments were passed to llvm-install-name-tool. Test plan: make check-all Differential revision: https://reviews.llvm.org/D90080
This commit is contained in:
parent
c3783847ae
commit
51f8d46491
|
@ -15,7 +15,7 @@
|
|||
# RUN: not llvm-install-name-tool -add_rpath @executable_path/. %t.i386 2>&1 \
|
||||
# RUN: | FileCheck --check-prefix=DUPLICATE-RPATH %s
|
||||
|
||||
# DUPLICATE-RPATH: duplicate load command
|
||||
# DUPLICATE-RPATH: rpath '@executable_path/.' would create a duplicate load command
|
||||
|
||||
# RUN: not llvm-install-name-tool -add_rpath @executable_path/. 2>&1 \
|
||||
# RUN: | FileCheck --check-prefix=NO-INPUT %s
|
||||
|
@ -27,7 +27,7 @@
|
|||
# RUN: -add_rpath @executable_X %t.i386 2>&1 \
|
||||
# RUN: | FileCheck --check-prefix=DOUBLE %s
|
||||
|
||||
# DOUBLE: duplicate load command
|
||||
# DOUBLE: rpath '@executable_X' would create a duplicate load command
|
||||
|
||||
## Check that cmdsize accounts for NULL terminator.
|
||||
# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
# RUN: -delete_rpath @executable_b/. %t 2>&1 | \
|
||||
# RUN: FileCheck %s --check-prefix=COMBINED
|
||||
|
||||
# COMBINED: cannot specify both -add_rpath @executable_b/. and -delete_rpath @executable_b/.
|
||||
# COMBINED: cannot specify both -add_rpath '@executable_b/.' and -delete_rpath '@executable_b/.'
|
||||
|
||||
## Remove all RPATHS
|
||||
# RUN: yaml2obj %s -o %t2
|
||||
|
|
|
@ -30,28 +30,28 @@
|
|||
# RUN: not llvm-install-name-tool -prepend_rpath first_rpath %t.i386 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=DUPLICATE-RPATH %s
|
||||
|
||||
# DUPLICATE-RPATH: rpath first_rpath would create a duplicate load command
|
||||
# DUPLICATE-RPATH: rpath 'first_rpath' would create a duplicate load command
|
||||
|
||||
## Prepend same RPATH twice:
|
||||
# RUN: not llvm-install-name-tool -prepend_rpath @executable_X \
|
||||
# RUN: -prepend_rpath @executable_X %t.i386 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=DOUBLE %s
|
||||
|
||||
# DOUBLE: rpath @executable_X would create a duplicate load command
|
||||
# DOUBLE: rpath '@executable_X' would create a duplicate load command
|
||||
|
||||
## Prepend and delete RPATH:
|
||||
# RUN: not llvm-install-name-tool -prepend_rpath foo \
|
||||
# RUN: -delete_rpath foo %t.i386 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=DELETE %s
|
||||
|
||||
# DELETE: cannot specify both -prepend_rpath foo and -delete_rpath foo
|
||||
# DELETE: cannot specify both -prepend_rpath 'foo' and -delete_rpath 'foo'
|
||||
|
||||
## Prepend and replace RPATH:
|
||||
# RUN: not llvm-install-name-tool -prepend_rpath foo \
|
||||
# RUN: -rpath foo bar %t.i386 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=REPLACE %s
|
||||
|
||||
# REPLACE: cannot specify both -prepend_rpath foo and -rpath foo bar
|
||||
# REPLACE: cannot specify both -prepend_rpath 'foo' and -rpath 'foo' 'bar'
|
||||
|
||||
## Check that cmdsize accounts for NULL terminator:
|
||||
# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
# RUN: FileCheck %s --check-prefix=EXISTING
|
||||
# RUN: cmp %t %t1
|
||||
|
||||
# EXISTING: rpath ABCD would create a duplicate load command
|
||||
# EXISTING: rpath 'ABCD' would create a duplicate load command
|
||||
|
||||
## Duplicate RPath entries:
|
||||
# RUN: not llvm-install-name-tool -rpath DDD1/. @exec_d/. \
|
||||
|
@ -82,7 +82,7 @@
|
|||
# RUN: FileCheck %s --check-prefix=DUPLICATE
|
||||
# RUN: cmp %t %t1
|
||||
|
||||
# DUPLICATE: cannot specify both -rpath DDD1/. @exec_d/. and -rpath @exec_d/. DDD2/.
|
||||
# DUPLICATE: cannot specify both -rpath 'DDD1/.' '@exec_d/.' and -rpath '@exec_d/.' 'DDD2/.'
|
||||
|
||||
## Updating and deleting RPath at the same time:
|
||||
# RUN: not llvm-install-name-tool -rpath @executable_d/. DD/. \
|
||||
|
@ -90,7 +90,7 @@
|
|||
# RUN: FileCheck %s --check-prefix=COMBINED-DELETE
|
||||
# RUN: cmp %t %t1
|
||||
|
||||
# COMBINED-DELETE: cannot specify both -delete_rpath @executable_d/. and -rpath @executable_d/. DD/.
|
||||
# COMBINED-DELETE: cannot specify both -delete_rpath '@executable_d/.' and -rpath '@executable_d/.' 'DD/.'
|
||||
|
||||
## Updating and adding RPath at the same time:
|
||||
# RUN: not llvm-install-name-tool -rpath @executable_e/. EE/. \
|
||||
|
@ -98,7 +98,7 @@
|
|||
# RUN: FileCheck %s --check-prefix=COMBINED-ADD
|
||||
# RUN: cmp %t %t1
|
||||
|
||||
# COMBINED-ADD: cannot specify both -add_rpath @executable_e/. and -rpath @executable_e/. EE/.
|
||||
# COMBINED-ADD: cannot specify both -add_rpath '@executable_e/.' and -rpath '@executable_e/.' 'EE/.'
|
||||
|
||||
## Missing an RPath argument:
|
||||
# RUN: not llvm-install-name-tool %t -rpath @executable_e/. 2>&1 | \
|
||||
|
|
|
@ -905,12 +905,12 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) {
|
|||
if (is_contained(Config.RPathToAdd, RPath))
|
||||
return createStringError(
|
||||
errc::invalid_argument,
|
||||
"cannot specify both -add_rpath %s and -delete_rpath %s",
|
||||
"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",
|
||||
"cannot specify both -prepend_rpath '%s' and -delete_rpath '%s'",
|
||||
RPath.str().c_str(), RPath.str().c_str());
|
||||
|
||||
Config.RPathsToRemove.insert(RPath);
|
||||
|
@ -930,30 +930,30 @@ parseInstallNameToolOptions(ArrayRef<const char *> ArgsArr) {
|
|||
});
|
||||
if (It1 != Config.RPathsToUpdate.end())
|
||||
return createStringError(errc::invalid_argument,
|
||||
"cannot specify both -rpath " + It1->getFirst() +
|
||||
" " + It1->getSecond() + " and -rpath " +
|
||||
Old + " " + New);
|
||||
"cannot specify both -rpath '" +
|
||||
It1->getFirst() + "' '" + It1->getSecond() +
|
||||
"' and -rpath '" + Old + "' '" + New + "'");
|
||||
|
||||
// Cannot specify the same rpath under both -delete_rpath and -rpath
|
||||
auto It2 = find_if(Config.RPathsToRemove, Match);
|
||||
if (It2 != Config.RPathsToRemove.end())
|
||||
return createStringError(errc::invalid_argument,
|
||||
"cannot specify both -delete_rpath " + *It2 +
|
||||
" and -rpath " + Old + " " + New);
|
||||
"cannot specify both -delete_rpath '" + *It2 +
|
||||
"' and -rpath '" + Old + "' '" + New + "'");
|
||||
|
||||
// Cannot specify the same rpath under both -add_rpath and -rpath
|
||||
auto It3 = find_if(Config.RPathToAdd, Match);
|
||||
if (It3 != Config.RPathToAdd.end())
|
||||
return createStringError(errc::invalid_argument,
|
||||
"cannot specify both -add_rpath " + *It3 +
|
||||
" and -rpath " + Old + " " + New);
|
||||
"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);
|
||||
"cannot specify both -prepend_rpath '" + *It4 +
|
||||
"' and -rpath '" + Old + "' '" + New + "'");
|
||||
|
||||
Config.RPathsToUpdate.insert({Old, New});
|
||||
}
|
||||
|
|
|
@ -183,8 +183,8 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
|
|||
"no LC_RPATH load command with path: " + Old);
|
||||
if (RPaths.count(New) != 0)
|
||||
return createStringError(errc::invalid_argument,
|
||||
"rpath " + New +
|
||||
" would create a duplicate load command");
|
||||
"rpath '" + New +
|
||||
"' would create a duplicate load command");
|
||||
}
|
||||
|
||||
// Update load commands.
|
||||
|
@ -222,8 +222,8 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
|
|||
for (StringRef RPath : Config.RPathToAdd) {
|
||||
if (RPaths.count(RPath) != 0)
|
||||
return createStringError(errc::invalid_argument,
|
||||
"rpath " + RPath +
|
||||
" would create a duplicate load command");
|
||||
"rpath '" + RPath +
|
||||
"' would create a duplicate load command");
|
||||
RPaths.insert(RPath);
|
||||
Obj.LoadCommands.push_back(buildRPathLoadCommand(RPath));
|
||||
}
|
||||
|
@ -231,8 +231,8 @@ static Error processLoadCommands(const CopyConfig &Config, Object &Obj) {
|
|||
for (StringRef RPath : Config.RPathToPrepend) {
|
||||
if (RPaths.count(RPath) != 0)
|
||||
return createStringError(errc::invalid_argument,
|
||||
"rpath " + RPath +
|
||||
" would create a duplicate load command");
|
||||
"rpath '" + RPath +
|
||||
"' would create a duplicate load command");
|
||||
|
||||
RPaths.insert(RPath);
|
||||
Obj.LoadCommands.insert(Obj.LoadCommands.begin(),
|
||||
|
|
Loading…
Reference in New Issue