From 73430b62a5437d1ba6c36a1d812a1434d1ad9df7 Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Tue, 20 Dec 2022 06:51:12 +0530 Subject: [PATCH 1/3] SWDEV-344620 - hipcc fails to parse version of clang in some cases (#3119) Change-Id: I46f716c82a7500b9a2bcaf5f9ff4ad8a8f982770 Signed-off-by: Yiyang Wu --- bin/hipcc.pl | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/bin/hipcc.pl b/bin/hipcc.pl index 645ae62d..2a01dcc3 100755 --- a/bin/hipcc.pl +++ b/bin/hipcc.pl @@ -144,7 +144,7 @@ if ($HIP_PLATFORM eq "amd") { $execExtension = ""; if($isWindows) { $execExtension = ".exe"; - } + } $HIPCC="$HIP_CLANG_PATH/clang++" . $execExtension; # If $HIPCC clang++ is not compiled, use clang instead @@ -157,13 +157,10 @@ if ($HIP_PLATFORM eq "amd") { $HIPLDFLAGS .= " -fuse-ld=lld"; $HIPLDFLAGS .= " --ld-path=$HIP_CLANG_PATH/lld-link.exe"; } - $HIP_CLANG_VERSION = `$HIPCC --version`; - $HIP_CLANG_VERSION=~/.*clang version (\S+).*/; - $HIP_CLANG_VERSION=$1; - # Figure out the target with which llvm is configured - $HIP_CLANG_TARGET = `$HIPCC -print-target-triple`; - $HIP_CLANG_TARGET = chomp($HIP_CLANG_TARGET); + # get Clang RT Builtin path + $HIP_CLANG_RT_LIB = `$HIPCC --print-runtime-dir`; + chomp($HIP_CLANG_RT_LIB); if (! defined $HIP_CLANG_INCLUDE_PATH) { $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include"); @@ -184,7 +181,7 @@ if ($HIP_PLATFORM eq "amd") { print ("HIP_INCLUDE_PATH=$HIP_INCLUDE_PATH\n"); print ("HIP_LIB_PATH=$HIP_LIB_PATH\n"); print ("DEVICE_LIB_PATH=$DEVICE_LIB_PATH\n"); - print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n"); + print ("HIP_CLANG_RT_LIB=$HIP_CLANG_RT_LIB\n"); } if ($isWindows) { @@ -715,13 +712,8 @@ if ($HIP_PLATFORM eq "amd") { } else { $toolArgs = ${toolArgs} . " -Wl,--enable-new-dtags -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 "; } - # To support __fp16 and _Float16, explicitly link with compiler-rt - $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a"; - if (-e $HIP_CLANG_BUILTIN_LIB) { - $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins " - } else { - $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 " - } + + $toolArgs .= " -L$HIP_CLANG_RT_LIB -lclang_rt.builtins-x86_64 " } } -- 2.38.1