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

Commit

Permalink
Merge pull request #100 from cjatin/rsp
Browse files Browse the repository at this point in the history
Fix for rsp files on Windows.
  • Loading branch information
kzhuravl authored Aug 14, 2023
2 parents 59c9c66 + 5e94da1 commit f30d151
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 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
11 changes: 10 additions & 1 deletion bin/hipcc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ sub get_normalized_path {
$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 @@ -471,7 +480,7 @@ sub get_normalized_path {
# 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;
}
$toolArgs .= " $arg" unless $swallowArg;
$prevArg = $arg;
Expand Down

0 comments on commit f30d151

Please sign in to comment.