[PATCH] D70467: [Distro] Bypass distro detection on Windows

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 09:28:48 PST 2019


aganea added a comment.

In D70467#1752611 <https://reviews.llvm.org/D70467#1752611>, @rnk wrote:

> Hm, I guess it does happen. I think that condition should be restructured to only do all that BSD, PS4, Android, Gentoo etc logic if the format is ELF, if COFF, then always default to -faddrsig.


We're cross-compiling all our target platforms on Windows. It seems this patch would be still valid in that case:

  > clang -target x86_64-linux a.cpp

Would still call `DetectDistro()`, and unless I'm missing something, we wouldn't want it to lookup `C:\etc\lsb-release` even if it's there? Or people are really doing that to target a specific distro when compiling from Windows? It doesn't make sense from my POV.
The same argument applies to CUDA: the code in `clang/lib/Driver/ToolChains/Cuda.cpp:CudaInstallationDetector()` says "HostTriple" but it's actually the Target triple -- you can try my cmd-line above, it hits the Distro detect.
Unless you specify a non-real FS, I wouldn't want `DetectDistro` to return anything else than `Distro::UnknownDistro` when running on a non-Linux OS.
Would you have a different opinion or something I don't see?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70467/new/

https://reviews.llvm.org/D70467





More information about the cfe-commits mailing list