[llvm] [Support] Resolve symlinks in `getMainExecutable()` on Windows (PR #76304)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 24 13:01:15 PST 2023


aganea wrote:

> Seems reasonable at first glance. How should this behave with `subst` drives?

Since we're using `GetFinalPathNameByHandleW` it will always resolve to the canonical, non-subst path. My understanding is that `getMainExecutable()` does that on Linux as well. On Windows it wasn't the case, since mostly likely nobody uses `-DLLVM_USE_SYMLINKS=ON` because of the admin rights.
```
C:\git\llvm-project>subst Y: stage1_msvc_debug

C:\git\llvm-project>Y:

Y:\>bin\clang-cl.exe /c C:\git\a.cpp -###
clang version 18.0.0git (https://github.com/aganea/llvm-project.git 51d89243cdc1239e79a2829d2735c3ebdade0fed)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: Y:\bin
 (in-process)
 "C:\\git\\llvm-project\\stage1_msvc_debug\\bin\\llvm.exe" "clang-cl.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.38.33133" "-emit-obj" "-mrelax-all" "-mincremental-linker-compatible" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "a.cpp" "-mrelocation-model" (rest omitted)
```

https://github.com/llvm/llvm-project/pull/76304


More information about the llvm-commits mailing list