From 928e0a856a33c082f99f8a8744afdb6547f74103 Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Thu, 29 Jun 2023 18:39:05 +0100 Subject: [PATCH] Fix for rsp files on Windows. File names starting with @ can not be escaped --- bin/hipcc | 3 ++- bin/hipcc.pl | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/hipcc b/bin/hipcc index 4002631..8dae941 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -33,9 +33,10 @@ $USE_PERL_SCRIPT //= 1; # use defined-or assignment operator. Use env var, but my $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys'); # escapes args with quotes SWDEV-341955 +# do not escape @ for rsp files on windows foreach $arg (@ARGV) { if ($isWindows) { - $arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\ ]/\\$&/g; + $arg =~ s/[^-a-zA-Z0-9_=+,.:@\/\\ ]/\\$&/g; } } diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 56dcda2..d880bf5 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -371,6 +371,15 @@ BEGIN $hsacoVersion = $arg; $swallowArg = 1; } + if($arg =~ /\.rsp$/) { + $pre_rsp = " "; + if($isWindows) { + $pre_rsp = " --rsp-quoting=windows "; + } + $HIPLDFLAGS .= $pre_rsp.$arg; + $HIPCXXFLAGS .= $pre_rsp.$arg; + $swallowArg = 1; + } # nvcc does not handle standard compiler options properly # This can prevent hipcc being used as standard CXX/C Compiler @@ -467,10 +476,10 @@ BEGIN # 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) { - $arg =~ s/[^-a-zA-Z0-9_=+,.\/]/\\$&/g; + $arg =~ s/[^-a-zA-Z0-9_=+,.@\/]/\\$&/g; } if ($isWindows and $escapeArg) { - $arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g; + $arg =~ s/[^-a-zA-Z0-9_=+,.:@\/\\]/\\$&/g; } $toolArgs .= " $arg" unless $swallowArg; $prevArg = $arg;