On Windows, when the LLVM toolchain is in the current path (%PATH%), fusing the linker yields c:\{path}\lld.exe whereas the hip tests did not expect the .exe part.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
In one case (opt, llc, clang-offload-bundler) it finds those programs in the "program paths", ie. the build folder: https://github.com/llvm/llvm-project/blob/master/clang/lib/Driver/Driver.cpp#L4733
Whereas in another cases (lld) when it doesn't find the program in the "program paths", it will go search the env.var. %PATH% and fall back to a platform-specific search, which includes searching using {program_name}.exe: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/Windows/Program.inc#L65
This is the output I was getting:
D:\llvm-project\buildninjaRel\tools\clang\test\Driver>"d:\llvm-project\buildninjarel\bin\clang.exe" "-c" "--cuda-device-only" "-###" "-target" "x86_64-linux-gnu" "-o" "a.s" "-x" "hip" "--cuda-gpu-arch=gfx900" "--hip-device-lib=lib1.bc" "--hip-device-lib-path=D:\llvm-project\clang\test\Driver/Inputs/hip_multiple_inputs/lib1" "D:\llvm-project\clang\test\Driver/Inputs/hip_multiple_inputs/a.cu" clang version 11.0.0 (https://github.com/llvm/llvm-project.git c1f8595fe5b856222418e2de547f0e346d84ac84) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: d:\llvm-project\buildninjarel\bin "d:\\llvm-project\\buildninjarel\\bin\\clang.exe" "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" "-emit-llvm-uselists" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "a.cu" "-mrelocation-model" "pic" "-pic-level" "1" "-mthread-model" "posix" "-mframe-pointer=all" "-fno-rounding-math" "-mconstructor-aliases" "-aux-target-cpu" "x86-64" "-target-cpu" "gfx900" "-fcuda-is-device" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden" "-fapply-global-visibility-to-externs" "-mlink-builtin-bitcode" "D:\\llvm-project\\clang\\test\\Driver/Inputs/hip_multiple_inputs/lib1\\lib1.bc" "-dwarf-column-info" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-resource-dir" "d:\\llvm-project\\buildninjarel\\lib\\clang\\11.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "d:\\llvm-project\\buildninjarel\\lib\\clang\\11.0.0\\include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "d:\\llvm-project\\buildninjarel\\lib\\clang\\11.0.0\\include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fno-autolink" "-fdebug-compilation-dir" "D:\\llvm-project\\buildninjaRel\\tools\\clang\\test\\Driver" "-ferror-limit" "19" "-fmessage-length" "138" "-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-fcuda-allow-variadic-functions" "-faddrsig" "-o" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940.bc" "-x" "hip" "D:\\llvm-project\\clang\\test\\Driver/Inputs/hip_multiple_inputs/a.cu" "d:\\llvm-project\\buildninjarel\\bin\\llvm-link" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940.bc" "-o" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-linked-fa625c.bc" "d:\\llvm-project\\buildninjarel\\bin\\opt" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-linked-fa625c.bc" "-mtriple=amdgcn-amd-amdhsa" "-mcpu=gfx900" "-o" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-optimized-227a21.bc" "d:\\llvm-project\\buildninjarel\\bin\\llc" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-optimized-227a21.bc" "-mtriple=amdgcn-amd-amdhsa" "-mcpu=gfx900" "-filetype=obj" "-o" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-03076f.o" "C:\\Program Files\\LLVM\\bin\\lld.exe" "-flavor" "gnu" "-shared" "-o" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-630562.out" "C:\\Users\\aganea\\AppData\\Local\\Temp\\a-152940-gfx900-03076f.o" "d:\\llvm-project\\buildninjarel\\bin\\clang-offload-bundler" "-type=o" "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa-gfx900" "-inputs=nul,C:\\Users\\aganea\\AppData\\Local\\Temp\\a-630562.out" "-outputs=a.s"
If LLD is built at the same time as Clang, this error doesn't happen.