Merge "Correct quoting of arguments" into amd-master-next

[ROCm/clr commit: 635c8208e1]
此提交包含在:
Icarus Sparry
2020-05-11 11:39:47 -04:00
提交者 Gerrit Code Review
當前提交 56d2940ca0
+13
查看文件
@@ -401,6 +401,7 @@ if($HIP_PLATFORM eq "nvcc"){
}
}
# TODO: convert toolArgs to an array rather than a string
my $toolArgs = ""; # arguments to pass to the hcc or nvcc tool
my $optArg = ""; # -O args
my $targetOpt = '--amdgpu-target=';
@@ -410,7 +411,11 @@ my $prevArg = ""; # previous argument
foreach $arg (@ARGV)
{
# Save $arg, it can get changed in the loop.
$trimarg = $arg;
# TODO: figure out why this space removal is wanted.
# TODO: If someone has gone to the effort of quoting the spaces to the shell
# TODO: why are we removing it here?
$trimarg =~ s/^\s+|\s+$//g; # Remive whitespace
my $swallowArg = 0;
if ($arg eq '-c' or $arg eq '--genco' or $arg eq '-E') {
@@ -419,6 +424,7 @@ foreach $arg (@ARGV)
}
if ($skipOutputFile) {
# TODO: handle filename with shell metacharacters
$toolArgs .= " $arg";
$prevArg = $arg;
$skipOutputFile = 0;
@@ -667,6 +673,12 @@ foreach $arg (@ARGV)
push (@inputs, $arg);
#print "I: <$arg>\n";
}
# Produce a version of $arg where characters significant to the shell are
# quoted. One could quote everything of course but don't bother for
# common characters such as alphanumerics.
# Do the quoting here because sometimes the $arg is changed in the loop
# Important to have all of '-Xlinker' in the set of unquoted characters.
$arg =~ s/[^-a-zA-Z0-9=+,.]/\\$&/g;
$toolArgs .= " $arg" unless $swallowArg;
$prevArg = $arg;
}
@@ -813,6 +825,7 @@ if ($HIPCC_LINK_FLAGS_APPEND) {
$HIPLDFLAGS .= " $HIPCC_LINK_FLAGS_APPEND";
}
# TODO: convert CMD to an array rather than a string
my $CMD="$HIPCC";
if ($needCFLAGS) {