llvm-project/clang/test/Driver/Inputs
Martin Storsjö 02b25bd904 [clang] [MinGW] Improve/extend the gcc/sysroot detection logic
There are three functions that try to detect the right implicit
sysroot and libgcc directory setup to use
- One which looks for mingw sysroots located in
  <clangbin>/../<sysrootname>
- One which looks for a mingw-targeting gcc executables in the PATH
- One which looks in the <gccroot>/lib/gcc directory to find the
  right one to use, and the right specific triple used for arch
  specific directories in the gcc/libstdc++ install

These have mostly tried to look for executables named
"<arch>-w64-mingw32-gcc" or "mingw32-gcc" or subdirectories
named "<arch>-w64-mingw32" or "mingw32".

In the case of findClangRelativeSysroot, it also has looked
for directories with the name of the actual triple. This
was added in deff753627,
with the intent of looking for a directory matching exactly
the user provided literal triple - however the triple here
is the normalized one, not the one provided by the user on
the command line.

Improve and unify this logic somewhat:
- Always first look for things based on the literal triple
  provided by the user.
- Secondly look for things based on the normalized triple
  (which usually ends up as e.g. x86_64-w64-windows-gnu),
  accessed via the Triple which is passed to the constructor
- Then look for the common triple form <arch>-w64-mingw32

The literal triple provided by the user is available via
Driver::getTargetTriple(), but computeTargetTriple() may
change e.g. the architecture of it, so we need to
reapply the effective architecture on the literal triple
spelling from Driver::getTargetTriple().

Do this consistently for all of findGcc, findClangRelativeSysroot
and findGccLibDir (while keeping the existing plain "mingw32"
cases in findGcc and findGccLibDir too).

Fedora 37 started shipping mingw sysroots targeting UCRT,
in addition to the traditional msvcrt.dll, and these use
triples in the form <arch>-w64-mingw32ucrt - see
https://fedoraproject.org/wiki/Changes/F37MingwUCRT.

Thus, in addition to the existing default tested triples,
try looking for triples in the form <arch>-w64-mingw32ucrt,
to automatically find the UCRT sysroots on Fedora 37.
By explicitly setting a specific target on the Clang command
line, the user can be more explicit with which flavour is
to be preferred.

This should fix the main issue in
https://github.com/llvm/llvm-project/issues/59001.

Differential Revision: https://reviews.llvm.org/D138692
2022-11-29 23:16:09 +02:00
..
B_opt_tree
CUDA/usr/local/cuda
CUDA-macosx/usr/local/cuda
CUDA-new/usr/local/cuda [CUDA] Improve CUDA version detection and diagnostics. 2021-08-23 13:24:48 -07:00
CUDA-nolibdevice/usr/local/cuda
CUDA-symlinks
CUDA-unknown/usr/local/cuda [CUDA] Improve CUDA version detection and diagnostics. 2021-08-23 13:24:48 -07:00
CUDA-windows/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
CUDA_80/usr/local/cuda [CUDA] Improve CUDA version detection and diagnostics. 2021-08-23 13:24:48 -07:00
CUDA_90/usr/local/cuda [CUDA] Improve CUDA version detection and diagnostics. 2021-08-23 13:24:48 -07:00
CUDA_102/usr/local/cuda [CUDA] Extract CUDA version from cuda.h if version.txt is not found 2020-10-23 10:03:30 -07:00
CUDA_111/usr/local/cuda [CUDA] Extract CUDA version from cuda.h if version.txt is not found 2020-10-23 10:03:30 -07:00
DriverKit19.0.sdk [Clang][Driver] Refine/refactor DriverKit support 2022-08-26 16:06:24 -07:00
MacOSX10.14.sdk [clang][darwin] add support for remapping macOS availability to Mac Catalyst availability 2021-07-21 11:32:25 -07:00
MacOSX10.15.versioned.sdk [clang][driver][darwin] Add driver support for Mac Catalyst 2021-07-22 10:20:19 -07:00
WatchOS6.0.sdk [clang][darwin] add support for remapping macOS availability to Mac Catalyst availability 2021-07-21 11:32:25 -07:00
Windows [Driver] -B: don't search for target triple prefixes 2020-07-18 20:26:01 -07:00
aarch64-linux-gnu-tree [AArch64][Clang][Linux] Enable out-of-line atomics by default. 2021-01-29 17:44:45 +00:00
aix_ppc_tree
amdgpu-arch Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed" 2021-04-27 10:47:05 +00:00
ami_linux_tree
archlinux_i686_tree [Driver] Detect libstdc++ include paths for native gcc on 32-bit non-Debian Linux 2021-07-20 09:18:24 -07:00
baremetal_arm/include/c++
basic_android_ndk_tree
basic_android_tree
basic_avr_tree/usr [Driver] Improve linking options for target AVR 2022-06-15 02:57:31 +00:00
basic_avr_tree_2 [AVR][clang] Improve search for avr-libc installation path 2021-08-17 11:51:35 +08:00
basic_cross_hurd_tree/usr hurd: Clean up test 2021-04-27 13:19:17 -07:00
basic_cross_linux_tree/usr [Driver] Fix architecture triplets and search paths for Linux x32 2021-04-01 09:47:56 +01:00
basic_darwin_driverkit_sdk_usr_cxx_v1/System/DriverKit/usr [Clang] Add DriverKit support 2022-05-13 20:34:57 +01:00
basic_darwin_sdk_libstdcxx_aarch64/usr
basic_darwin_sdk_libstdcxx_arm/usr
basic_darwin_sdk_libstdcxx_ppc/usr
basic_darwin_sdk_libstdcxx_x86/usr
basic_darwin_sdk_no_libcxx/usr
basic_darwin_sdk_no_libstdcxx/usr
basic_darwin_sdk_usr/usr
basic_darwin_sdk_usr_and_usr_local/usr
basic_darwin_sdk_usr_cxx_v1/usr [clang] Don't look into <sysroot> for C++ headers if they are found alongside the toolchain 2020-10-09 12:41:41 -04:00
basic_darwin_sdk_usr_local/usr/local
basic_darwin_toolchain/usr
basic_darwin_toolchain_no_libcxx/usr/bin
basic_freebsd64_tree [Driver] Add --ld-path= and deprecate -fuse-ld=/abs/path and -fuse-ld=rel/path 2020-07-20 09:34:39 -07:00
basic_freebsd_libcxx_tree/usr [Clang][Driver] Fix include paths for `--sysroot /` on OpenBSD/FreeBSD 2022-07-22 14:30:32 +01:00
basic_freebsd_tree
basic_fuchsia_tree [clang][Fuchsia] Introduce compat multilibs 2021-05-11 15:45:38 -07:00
basic_hurd_tree hurd: Clean up test 2021-04-27 13:19:17 -07:00
basic_linux_libcxx_tree/usr [libc++] Support per-target __config_site in per-target runtime build 2021-04-28 14:27:16 -07:00
basic_linux_libcxxv2_tree/usr [libc++] Support per-target __config_site in per-target runtime build 2021-04-28 14:27:16 -07:00
basic_linux_libstdcxx_libcxxv2_tree/usr [libc++] Support per-target __config_site in per-target runtime build 2021-04-28 14:27:16 -07:00
basic_linux_libstdcxx_tree/usr [Clang][Driver] Fix include paths for `--sysroot /` on Linux 2022-05-27 16:51:36 +01:00
basic_linux_tree [Driver][Gnu] Support -shared -static: pass -shared to ld and use crtbeginS.o 2021-10-19 01:09:41 -07:00
basic_msp430_tree [MSP430] Actualize the toolchain description 2020-07-17 15:42:12 +03:00
basic_myriad_tree
basic_netbsd_tree/usr/lib
basic_openbsd_libcxx_tree/usr [Clang][Driver] Fix include paths for `--sysroot /` on OpenBSD/FreeBSD 2022-07-22 14:30:32 +01:00
basic_riscv32_nogcc_tree
basic_riscv32_tree [test][RISCV][Driver] Precommit tests for D128625 2022-06-29 13:25:56 +03:00
basic_riscv64_nogcc_tree
basic_riscv64_tree [test][RISCV][Driver] Precommit tests for D128625 2022-06-29 13:25:56 +03:00
basic_ve_tree [VE] Support multiple architectures installation 2021-12-06 19:56:41 +09:00
cl-libs
config
config2
cray_suse_gcc_tree
debian_6_mips64_tree [clang][MIPS] Fix search path for Debian multilib O32 2021-10-28 10:23:06 +03:00
debian_6_mips_tree
debian_i386_tree [Driver] Detect libstdc++ include paths for native gcc (-m32 and -m64) on Debian i386 2021-04-04 10:15:12 -07:00
debian_multiarch_tree [test] Bring back the improved arm and $sysroot/usr/include/i386-linux-gnu tests 2021-03-22 12:08:46 -07:00
debian_per_target_tree/usr/lib/llvm-14 [Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include/x86_64-linux-gnu/c++/v1 tests 2021-10-06 10:49:25 -07:00
debian_reduced_mips_tree
fake_install_tree
fedora_18_tree
fedora_21_tree/usr
fedora_31_riscv64_tree/usr
freescale_ppc64_tree
freescale_ppc_tree
fuse_ld_windows
gcc_version_parsing1
gcc_version_parsing2
gcc_version_parsing3
gcc_version_parsing4
gcc_version_parsing5
gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux [Driver] Support GCC detection for GCC compiled with --enable-version-specific-runtime-libs 2022-02-25 04:41:03 +00:00
gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux [Driver] Support GCC detection for GCC compiled with --enable-version-specific-runtime-libs 2022-02-25 04:41:03 +00:00
gentoo_linux_gcc_4.6.2_tree/usr
gentoo_linux_gcc_4.6.4_tree/usr
gentoo_linux_gcc_4.9.3_tree/usr
gentoo_linux_gcc_4.9.x_tree
gentoo_linux_gcc_multi_version_tree
hexagon_tree/Tools
hip_dev_lib [OpenMP] Change amdgcn to amdgpu in device library handling 2022-02-04 20:51:05 -05:00
hip_multiple_inputs Recommit "[HIP] Add option --gpu-instrument-lib=" 2020-10-04 21:41:43 -04:00
hipspv [HIPSPV][3/4] Enable SPIR-V emission for HIP 2021-12-20 10:45:09 -05:00
hipspv-dev-lib [HIPSPV][3/4] Enable SPIR-V emission for HIP 2021-12-20 10:45:09 -05:00
iPhoneOS13.0.sdk [clang][darwin] add support for remapping macOS availability to Mac Catalyst availability 2021-07-21 11:32:25 -07:00
libomptarget [openmp] No longer use LIBRARY_PATH to find devicertl 2021-09-09 17:16:41 +01:00
lld [clang+lld] Pass -platform_version args to ld64.lld 2021-03-02 12:52:54 -05:00
mingw_arch_tree/usr
mingw_clang_tree/mingw32 [clang] [MinGW] Consider the per-target libc++ include directory too 2021-08-12 13:27:09 +03:00
mingw_fedora_tree/usr [clang] [MinGW] Improve/extend the gcc/sysroot detection logic 2022-11-29 23:16:09 +02:00
mingw_mingw_builds_tree/mingw32
mingw_mingw_org_tree/mingw
mingw_msys2_tree/msys64/mingw32
mingw_opensuse_tree/usr
mingw_ubuntu_posix_tree/usr [clang] [MinGW] Fix gcc version detection/picking 2021-05-28 11:44:20 +03:00
mingw_ubuntu_tree/usr
mips_cs_tree
mips_fsf_tree
mips_img_tree
mips_img_v2_tree
mips_mti_linux
mips_mti_tree
module
montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0
multiarch_freebsd64_tree
multilib_32bit_linux_tree [Driver] Fix architecture triplets and search paths for Linux x32 2021-04-01 09:47:56 +01:00
multilib_64bit_linux_tree [Driver] Fix architecture triplets and search paths for Linux x32 2021-04-01 09:47:56 +01:00
multilib_arm_linux_tree [test] Bring back the improved arm and $sysroot/usr/include/i386-linux-gnu tests 2021-03-22 12:08:46 -07:00
multilib_csky_linux_sdk [Clang][CSKY] Add the CSKY target and compiler driver 2022-04-06 11:37:37 +08:00
multilib_loongarch_linux_sdk [Clang][LoongArch] Add initial LoongArch target and driver support 2022-08-23 13:47:22 +08:00
multilib_riscv_elf_sdk
multilib_riscv_linux_sdk
openembedded_aarch64_linux_tree/usr
openembedded_arm_linux_tree/usr
openmp_static_device_link [OpenMP] Don't pass empty files to nvlink 2022-01-20 13:12:02 -05:00
opensuse_42.2_aarch64_tree/usr/lib64
opensuse_tumbleweed_armv6hl_tree/usr/lib
opensuse_tumbleweed_armv7hl_tree/usr/lib
opensuse_tumbleweed_ppc_tree/usr/lib
opensuse_tumbleweed_riscv64_tree/usr/lib64
powerpc64le-linux-gnu-tree [PowerPC] Fix check for ieeelongdouble support 2022-10-27 10:36:37 +02:00
prefixed_tools_tree
resource_dir [Clang] Add DriverKit support 2022-05-13 20:34:57 +01:00
resource_dir_with_arch_subdir/lib/linux
resource_dir_with_per_target_subdir [Driver] Support linking to compiler-rt for target AVR 2022-08-16 09:22:50 +08:00
resource_dir_with_per_target_subdir_debian/lib [Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include/x86_64-linux-gnu/c++/v1 tests 2021-10-06 10:49:25 -07:00
rocm [HIP] File device library ABI version file name 2022-02-28 16:24:50 -05:00
rocm-invalid [HIP] Support device sanitizer 2021-02-18 23:30:25 -05:00
rocm-spack [HIP] Fix spack HIP device lib detection 2021-06-04 09:12:41 -04:00
scei-ps4_tree/target
solaris_sparc_tree/usr
solaris_x86_tree/usr
suse_10.3_ppc64_tree
ubuntu_11.04_multiarch_tree
ubuntu_12.04_LTS_multiarch_tree
ubuntu_14.04_multiarch_tree
ubuntu_14.04_multiarch_tree2
x86-64_ubuntu_13.10
cc1-response.txt
config-1.cfg
config-2.cfg
config-2a.cfg
config-3.cfg
config-4.cfg
config-5.cfg
config-6.cfg [Driver] Enable nested configuration files 2022-11-16 13:32:27 +07:00
dummy-bc.bc [OpenMP] Add better testing for the linker wrapper 2022-04-19 18:37:09 -04:00
dummy-elf.o [OpenMP] Add better testing for the linker wrapper 2022-04-19 18:37:09 -04:00
empty-elf-template.yaml [clang-offload-wrapper] Add standard notes for ELF offload images 2021-08-16 13:09:01 -07:00
empty-x86_64-apple-darwin.yaml [mac/arm] fix clang/test/Driver/darwin-ld-dedup.c 2020-11-23 13:32:29 -05:00
empty.cfg
empty.cpp [HIP] Fix job action offloading kind for mixed HIP/C++ compilation 2022-03-04 15:34:02 -05:00
empty.hip [HIP] Fix job action offloading kind for mixed HIP/C++ compilation 2022-03-04 15:34:02 -05:00
file.ll
file.prof
header-unit-01.hh [C++20][Modules][Driver][HU 1/N] Initial handling for -xc++-{system,user}-header. 2022-04-22 09:24:29 +01:00
header0.h [clang][test] Make headers unique to avoid linking issues 2022-10-06 10:09:22 -07:00
header1.h [clang][test] Make headers unique to avoid linking issues 2022-10-06 10:09:22 -07:00
header2.h [clang][test] Make headers unique to avoid linking issues 2022-10-06 10:09:22 -07:00
header3.h [clang][test] Make headers unique to avoid linking issues 2022-10-06 10:09:22 -07:00
header4.h [clang][test] Make headers unique to avoid linking issues 2022-10-06 10:09:22 -07:00
in.so
inc-inexistent.rsp [Clang] Check for response file existence prior to check for recursion 2022-11-03 14:49:58 +07:00
pass-plugin.so [HIPSPV][3/4] Enable SPIR-V emission for HIP 2021-12-20 10:45:09 -05:00
pchfile.cpp
pchfile.h
rewrite-1.map
rewrite-2.map
rewrite.map
wildcard1.c
wildcard2.c