diff --git a/bin/hipcc b/bin/hipcc index 32494dd345..86622c7a36 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -22,7 +22,6 @@ # Need perl > 5.10 to use logic-defined or use 5.006; use v5.10.1; -use strict; use warnings; use File::Basename; @@ -30,6 +29,13 @@ use File::Spec::Functions 'catfile'; # TODO: By default select perl script until change incorporated in HIP build script. my $HIPCC_USE_PERL_SCRIPT = 1; +my $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys'); +# escapes args with quotes SWDEV-341955 +foreach $arg (@ARGV) { + if ($isWindows) { + $arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g; + } +} my $SCRIPT_DIR=dirname(__FILE__); if ($HIPCC_USE_PERL_SCRIPT) { diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 24edf7c59c..645ae62d03 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -595,9 +595,12 @@ foreach $arg (@ARGV) # 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. - if (not $isWindows and $escapeArg) { # Windows needs different quoting, ignore for now + if (not $isWindows and $escapeArg) { $arg =~ s/[^-a-zA-Z0-9_=+,.\/]/\\$&/g; } + if ($isWindows and $escapeArg) { + $arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g; + } $toolArgs .= " $arg" unless $swallowArg; $prevArg = $arg; }