Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Fix for rsp files on Windows. File names starting with @ can not be e…
Browse files Browse the repository at this point in the history
…scaped
  • Loading branch information
cjatin committed Jul 10, 2023
1 parent f122a50 commit 4f85842
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/hipcc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
13 changes: 11 additions & 2 deletions bin/hipcc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4f85842

Please sign in to comment.