From 0964d64071fbd53e497730f079649e84687165f3 Mon Sep 17 00:00:00 2001 From: "Yaxun (Sam) Liu" Date: Tue, 4 Aug 2020 15:01:52 -0400 Subject: [PATCH] Let hipcc not escape space between obj files extracted from library hipcc extracts bundles from static libraries and pass them to clang. It should not escape spaces between objects extracted from library. Fixes: SWDEV-246544 Change-Id: Iad3902f28a43a3986917ee37a49f10382c329940 --- bin/hipcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/hipcc b/bin/hipcc index 5f1445cc6a..22fd249bfd 100755 --- a/bin/hipcc +++ b/bin/hipcc @@ -426,6 +426,7 @@ foreach $arg (@ARGV) # TODO: why are we removing it here? $trimarg =~ s/^\s+|\s+$//g; # Remive whitespace my $swallowArg = 0; + my $escapeArg = 1; if ($arg eq '-c' or $arg eq '--genco' or $arg eq '-E') { $compileOnly = 1; $needLDFLAGS = 0; @@ -578,6 +579,7 @@ foreach $arg (@ARGV) close $in; close $out; $arg = "$new_arg -Wl,\@$new_file"; + $escapeArg = 0; } elsif (($arg =~ m/\.a$/ || $arg =~ m/\.lo$/) && $HIP_PLATFORM eq 'hcc' and $HIP_COMPILER eq 'clang') { ## process static library for hip-clang @@ -624,6 +626,7 @@ foreach $arg (@ARGV) $new_arg .= " $tmpdir/$libBaseName"; } $arg = "$new_arg"; + $escapeArg = 0; if ($toolArgs =~ m/-Xlinker$/) { $toolArgs = substr $toolArgs, 0, -8; chomp $toolArgs; @@ -703,7 +706,7 @@ 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) { # Windows needs different quoting, ignore for now + if (not $isWindows and $escapeArg) { # Windows needs different quoting, ignore for now $arg =~ s/[^-a-zA-Z0-9_=+,.\/]/\\$&/g; } $toolArgs .= " $arg" unless $swallowArg;