[clang] 36430d4 - [Driver] Use normalized triples for per-target runtimes

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 27 22:50:18 PDT 2021


Author: Petr Hosek
Date: 2021-04-27T22:31:36-07:00
New Revision: 36430d44edba9063a08493c89864edf5f071d08c

URL: https://github.com/llvm/llvm-project/commit/36430d44edba9063a08493c89864edf5f071d08c
DIFF: https://github.com/llvm/llvm-project/commit/36430d44edba9063a08493c89864edf5f071d08c.diff

LOG: [Driver] Use normalized triples for per-target runtimes

This is a partial revert of b4537c3f51bc6c011ddd9c10b80043ac4ce16a01
based on the discussion in https://reviews.llvm.org/D101194. Rather
than using the getMultiarchTriple, we use the getTripleString.

Added: 
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables/libc++.so
    clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-unknown-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan-preinit.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.fuzzer.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.lsan.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.profile.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.scudo.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray-basic.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan-preinit.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.fuzzer.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.lsan.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.profile.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.scudo.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray-basic.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a

Modified: 
    clang/cmake/caches/Fuchsia-stage2.cmake
    clang/lib/Driver/ToolChain.cpp
    clang/lib/Driver/ToolChains/Fuchsia.cpp
    clang/lib/Driver/ToolChains/Fuchsia.h
    clang/lib/Driver/ToolChains/Linux.cpp
    clang/test/Driver/fuchsia.c
    clang/test/Driver/fuchsia.cpp
    clang/test/Driver/linux-per-target-runtime-dir.c
    clang/test/Driver/print-file-name.c
    libcxx/utils/ci/run-buildbot

Removed: 
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+noexcept/libc++.so
    clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables/libc++.so
    clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan-preinit.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.fuzzer.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.lsan.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.profile.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.scudo.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray-basic.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan-preinit.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.builtins.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.fuzzer.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.lsan.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.profile.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.scudo.so
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray-basic.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray.a
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/.keep
    clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/libclang_rt.builtins.a


################################################################################
diff  --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index b59c245d15910..a9ac3ce5d9ceb 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -91,19 +91,15 @@ if(WIN32)
   set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
 endif()
 
-foreach(target aarch64-linux-gnu;arm-linux-gnueabihf;i386-linux-gnu;x86_64-linux-gnu)
-  set(LINUX_aarch64-linux-gnu_TARGET aarch64-linux-gnu)
-  set(LINUX_arm-linux-gnueabihf_TARGET armv7-linux-gnueabihf)
-  set(LINUX_i386-linux-gnu_TARGET i386-linux-gnu)
-  set(LINUX_x86_64-linux-gnu_TARGET x86_64-linux-gnu)
+foreach(target aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unknown-linux-gnu;x86_64-unknown-linux-gnu)
   if(LINUX_${target}_SYSROOT)
     # Set the per-target builtins options.
     list(APPEND BUILTIN_TARGETS "${target}")
     set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
     set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-    set(BUILTINS_${target}_CMAKE_C_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
-    set(BUILTINS_${target}_CMAKE_CXX_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
-    set(BUILTINS_${target}_CMAKE_ASM_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "")
+    set(BUILTINS_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "")
     set(BUILTINS_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
     set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
     set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
@@ -113,9 +109,9 @@ foreach(target aarch64-linux-gnu;arm-linux-gnueabihf;i386-linux-gnu;x86_64-linux
     list(APPEND RUNTIME_TARGETS "${target}")
     set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
     set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-    set(RUNTIMES_${target}_CMAKE_C_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
-    set(RUNTIMES_${target}_CMAKE_CXX_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
-    set(RUNTIMES_${target}_CMAKE_ASM_FLAGS "--target=${LINUX_${target}_TARGET}" CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "")
+    set(RUNTIMES_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "")
     set(RUNTIMES_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
     set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
     set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
@@ -144,17 +140,17 @@ foreach(target aarch64-linux-gnu;arm-linux-gnueabihf;i386-linux-gnu;x86_64-linux
 endforeach()
 
 if(FUCHSIA_SDK)
-  set(FUCHSIA_aarch64-fuchsia_NAME arm64)
-  set(FUCHSIA_i386-fuchsia_NAME x64)
-  set(FUCHSIA_x86_64-fuchsia_NAME x64)
-  set(FUCHSIA_riscv64-fuchsia_NAME riscv64)
-  foreach(target i386-fuchsia;x86_64-fuchsia;aarch64-fuchsia;riscv64-fuchsia)
+  set(FUCHSIA_aarch64-unknown-fuchsia_NAME arm64)
+  set(FUCHSIA_i386-unknown-fuchsia_NAME x64)
+  set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64)
+  set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64)
+  foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
     set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/fdio/include")
     set(FUCHSIA_${target}_LINKER_FLAGS "-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib")
     set(FUCHSIA_${target}_SYSROOT "${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot")
   endforeach()
 
-  foreach(target i386-fuchsia;x86_64-fuchsia;aarch64-fuchsia;riscv64-fuchsia)
+  foreach(target i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia)
     # Set the per-target builtins options.
     list(APPEND BUILTIN_TARGETS "${target}")
     set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
@@ -168,7 +164,7 @@ if(FUCHSIA_SDK)
     set(BUILTINS_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
   endforeach()
 
-  foreach(target x86_64-fuchsia;aarch64-fuchsia)
+  foreach(target x86_64-unknown-fuchsia;aarch64-unknown-fuchsia)
     # Set the per-target runtimes options.
     list(APPEND RUNTIME_TARGETS "${target}")
     set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
@@ -242,13 +238,13 @@ if(FUCHSIA_SDK)
   endforeach()
 
   set(LLVM_RUNTIME_MULTILIBS "asan;noexcept;asan+noexcept;relative-vtables;relative-vtables+noexcept;relative-vtables+asan;relative-vtables+asan+noexcept" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_asan_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_noexcept_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_asan+noexcept_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_relative-vtables_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_relative-vtables+noexcept_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
-  set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan+noexcept_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_asan_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_asan+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_relative-vtables_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_relative-vtables+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
+  set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
 endif()
 
 set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")

diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index f33d5c9c84dcf..88bc640a0b2dd 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -75,6 +75,14 @@ ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
                      const ArgList &Args)
     : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
       CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
+  std::string RuntimePath = getRuntimePath();
+  if (getVFS().exists(RuntimePath))
+    getLibraryPaths().push_back(RuntimePath);
+
+  std::string StdlibPath = getStdlibPath();
+  if (getVFS().exists(StdlibPath))
+    getFilePaths().push_back(StdlibPath);
+
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
     getFilePaths().push_back(CandidateLibPath);
@@ -475,14 +483,13 @@ const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
 
 std::string ToolChain::getRuntimePath() const {
   SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, "lib", getMultiarchTriple(D, Triple, D.SysRoot));
+  llvm::sys::path::append(P, "lib", getTripleString());
   return std::string(P.str());
 }
 
 std::string ToolChain::getStdlibPath() const {
   SmallString<128> P(D.Dir);
-  llvm::sys::path::append(P, "..", "lib",
-                          getMultiarchTriple(D, Triple, D.SysRoot));
+  llvm::sys::path::append(P, "..", "lib", getTripleString());
   return std::string(P.str());
 }
 

diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index dfd91eced0017..6ee367ab4ecc6 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -27,7 +27,6 @@ using namespace clang;
 using namespace llvm::opt;
 
 using tools::addMultilibFlag;
-using tools::addPathIfExists;
 
 void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
                                    const InputInfo &Output,
@@ -182,10 +181,6 @@ Fuchsia::Fuchsia(const Driver &D, const llvm::Triple &Triple,
   if (getDriver().getInstalledDir() != D.Dir)
     getProgramPaths().push_back(D.Dir);
 
-  addPathIfExists(D, getRuntimePath(), getLibraryPaths());
-
-  addPathIfExists(D, getStdlibPath(), getFilePaths());
-
   if (!D.SysRoot.empty()) {
     SmallString<128> P(D.SysRoot);
     llvm::sys::path::append(P, "lib");
@@ -279,15 +274,6 @@ Fuchsia::Fuchsia(const Driver &D, const llvm::Triple &Triple,
           getFilePaths().insert(getFilePaths().begin(), Path);
 }
 
-/// Following the conventions in https://wiki.debian.org/Multiarch/Tuples,
-/// we remove the vendor field to form the multiarch triple.
-std::string Fuchsia::getMultiarchTriple(const Driver &D,
-                                        const llvm::Triple &TargetTriple,
-                                        StringRef SysRoot) const {
-    return (TargetTriple.getArchName() + "-" +
-            TargetTriple.getOSAndEnvironmentName()).str();
-}
-
 std::string Fuchsia::ComputeEffectiveClangTriple(const ArgList &Args,
                                                  types::ID InputType) const {
   llvm::Triple Triple(ComputeLLVMTriple(Args, InputType));

diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.h b/clang/lib/Driver/ToolChains/Fuchsia.h
index c49213c7b735a..07adf9b7101d8 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.h
+++ b/clang/lib/Driver/ToolChains/Fuchsia.h
@@ -65,10 +65,6 @@ class LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain {
     return LangOptions::SSPStrong;
   }
 
-  std::string getMultiarchTriple(const Driver &D,
-                                 const llvm::Triple &TargetTriple,
-                                 StringRef SysRoot) const override;
-
   std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
                                           types::ID InputType) const override;
 

diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 4df83db3350d5..e855d337ae64c 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -253,8 +253,6 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   if (IsAndroid || Distro.IsOpenSUSE())
     ExtraOpts.push_back("--enable-new-dtags");
 
-  addPathIfExists(D, getRuntimePath(), getLibraryPaths());
-
   // The selection of paths to try here is designed to match the patterns which
   // the GCC driver itself uses, as this is part of the GCC-compatible driver.
   // This was determined by running GCC in a fake filesystem, creating all
@@ -262,8 +260,6 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   // to the link paths.
   path_list &Paths = getFilePaths();
 
-  addPathIfExists(D, getStdlibPath(), Paths);
-
   const std::string OSLibDir = std::string(getOSLibDir(Triple, Args));
   const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
 

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/asan/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/asan/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-fuchsia/relative-vtables/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/aarch64-unknown-fuchsia/relative-vtables/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/asan/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/asan/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/hwasan/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/hwasan/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+asan/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+asan/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+hwasan/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+hwasan/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+noexcept/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+noexcept/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables+noexcept/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables+noexcept/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables/libc++.so b/clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables/libc++.so
similarity index 100%
rename from clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-fuchsia/relative-vtables/libc++.so
rename to clang/test/Driver/Inputs/basic_fuchsia_tree/lib/x86_64-unknown-fuchsia/relative-vtables/libc++.so

diff  --git a/clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-unknown-linux-gnu/.keep
similarity index 100%
rename from clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-linux-gnu/.keep
rename to clang/test/Driver/Inputs/basic_linux_libcxx_tree/usr/lib/x86_64-unknown-linux-gnu/.keep

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/.keep b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/.keep
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/.keep
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/.keep

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan-preinit.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan-preinit.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan-preinit.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan-preinit.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan.so b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan.so
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.asan.so
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.asan.so

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.builtins.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.builtins.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.builtins.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.builtins.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.fuzzer.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.fuzzer.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.fuzzer.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.fuzzer.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.lsan.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.lsan.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.lsan.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.lsan.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.profile.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.profile.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.profile.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.profile.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.scudo.so b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.scudo.so
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.scudo.so
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.scudo.so

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray-basic.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray-basic.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray-basic.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray-basic.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-fuchsia/libclang_rt.xray.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/aarch64-unknown-fuchsia/libclang_rt.xray.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/.keep
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/.keep
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/.keep

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/libclang_rt.builtins.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-linux-gnu/libclang_rt.builtins.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-fuchsia/libclang_rt.builtins.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-fuchsia/libclang_rt.builtins.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-fuchsia/libclang_rt.builtins.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/riscv64-unknown-fuchsia/libclang_rt.builtins.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/.keep b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/.keep
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/.keep
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/.keep

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan-preinit.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan-preinit.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan-preinit.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan-preinit.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan.so b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.asan.so
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.builtins.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.builtins.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.builtins.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.builtins.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.fuzzer.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.fuzzer.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.fuzzer.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.fuzzer.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.lsan.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.lsan.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.lsan.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.lsan.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.profile.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.profile.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.profile.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.profile.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.scudo.so b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.scudo.so
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.scudo.so
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.scudo.so

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray-basic.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray-basic.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray-basic.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray-basic.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-fuchsia/libclang_rt.xray.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-fuchsia/libclang_rt.xray.a

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/.keep
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/.keep
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/.keep

diff  --git a/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/libclang_rt.builtins.a b/clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a
similarity index 100%
rename from clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-linux-gnu/libclang_rt.builtins.a
rename to clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a

diff  --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index 5d3b4c8d9fe34..899bb6c87c02b 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -1,12 +1,12 @@
-// RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-fuchsia \
+// RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
-// RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-fuchsia \
+// RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
-// RUN: %clang %s -### -no-canonical-prefixes --target=riscv64-fuchsia \
+// RUN: %clang %s -### -no-canonical-prefixes --target=riscv64-unknown-fuchsia \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-RISCV64 %s
@@ -33,66 +33,66 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|\\\\}}lib"
-// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
-// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
-// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
 // CHECK-NOT: crtn.o
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -rtlib=libgcc -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -rtlib=libgcc -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-RTLIB
 // CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc'
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -static -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -static -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lc"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -shared -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -shared -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-SHARED
 // CHECK-SHARED-NOT: "-pie"
 // CHECK-SHARED: "-shared"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -r -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -r -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-RELOCATABLE
 // CHECK-RELOCATABLE-NOT: "-pie"
 // CHECK-RELOCATABLE-NOT: "--build-id"
 // CHECK-RELOCATABLE: "-r"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -nodefaultlibs -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -nodefaultlibs -fuse-ld=lld 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     | FileCheck %s -check-prefix=CHECK-NODEFAULTLIBS
 // CHECK-NODEFAULTLIBS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-NODEFAULTLIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-NODEFAULTLIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
 // CHECK-NODEFAULTLIBS-NOT: "-lc"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -nostdlib -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -nostdlib -fuse-ld=lld 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     | FileCheck %s -check-prefix=CHECK-NOSTDLIB
 // CHECK-NOSTDLIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-NOSTDLIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-NOSTDLIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
 // CHECK-NOSTDLIB-NOT: "-lc"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia -nolibc -fuse-ld=lld 2>&1 \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia -nolibc -fuse-ld=lld 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     | FileCheck %s -check-prefix=CHECK-NOLIBC
 // CHECK-NOLIBC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-NOLIBC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-NOLIBC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
 // CHECK-NOLIBC-NOT: "-lc"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=safe-stack 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-SAFESTACK
 // CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SAFESTACK: "-fsanitize=safe-stack"
-// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.safestack.a"
+// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.safestack.a"
 // CHECK-SAFESTACK-NOT: "__safestack_init"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=address 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -101,10 +101,10 @@
 // CHECK-ASAN-X86: "-fsanitize=address"
 // CHECK-ASAN-X86: "-fsanitize-address-globals-dead-stripping"
 // CHECK-ASAN-X86: "-dynamic-linker" "asan/ld.so.1"
-// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.asan.so"
-// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
+// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan.so"
+// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fsanitize=address 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -113,10 +113,10 @@
 // CHECK-ASAN-AARCH64: "-fsanitize=address,shadow-call-stack"
 // CHECK-ASAN-AARCH64: "-fsanitize-address-globals-dead-stripping"
 // CHECK-ASAN-AARCH64: "-dynamic-linker" "asan/ld.so.1"
-// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.asan.so"
-// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
+// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan.so"
+// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=address -fPIC -shared 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -124,28 +124,28 @@
 // CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ASAN-SHARED: "-fsanitize=address"
 // CHECK-ASAN-SHARED: "-fsanitize-address-globals-dead-stripping"
-// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.asan.so"
-// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
+// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan.so"
+// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.asan-preinit.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=fuzzer 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-FUZZER-X86
 // CHECK-FUZZER-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-X86: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack"
-// CHECK-FUZZER-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.fuzzer.a"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fsanitize=fuzzer 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-FUZZER-AARCH64
 // CHECK-FUZZER-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-AARCH64: "-fsanitize=fuzzer,fuzzer-no-link,shadow-call-stack"
-// CHECK-FUZZER-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.fuzzer.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=scudo 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -153,9 +153,9 @@
 // CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo"
 // CHECK-SCUDO-X86: "-pie"
-// CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
+// CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fsanitize=scudo 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -163,18 +163,18 @@
 // CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-AARCH64: "-fsanitize=shadow-call-stack,scudo"
 // CHECK-SCUDO-AARCH64: "-pie"
-// CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
+// CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=scudo -fPIC -shared 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED
 // CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-SHARED: "-fsanitize=safe-stack,scudo"
-// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
+// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.scudo.so"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fsanitize=leak 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -182,9 +182,9 @@
 // CHECK-LSAN-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LSAN-AARCH64: "-fsanitize=leak,shadow-call-stack"
 // CHECK-LSAN-AARCH64: "-pie"
-// CHECK-LSAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
+// CHECK-LSAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fsanitize=leak 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
@@ -192,45 +192,45 @@
 // CHECK-LSAN-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LSAN-X86: "-fsanitize=leak,safe-stack"
 // CHECK-LSAN-X86: "-pie"
-// CHECK-LSAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
+// CHECK-LSAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fsanitize=leak -fPIC -shared 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-LSAN-SHARED
 // CHECK-LSAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LSAN-SHARED: "-fsanitize=leak,shadow-call-stack"
-// CHECK-LSAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
+// CHECK-LSAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.lsan.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fxray-instrument -fxray-modes=xray-basic \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-XRAY-X86
 // CHECK-XRAY-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-XRAY-X86: "-fxray-instrument"
-// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.xray.a"
-// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.xray-basic.a"
+// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.xray.a"
+// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.xray-basic.a"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fxray-instrument -fxray-modes=xray-basic \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-XRAY-AARCH64
 // CHECK-XRAY-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-XRAY-AARCH64: "-fxray-instrument"
-// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.xray.a"
-// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.xray-basic.a"
+// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.xray.a"
+// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.xray-basic.a"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -O3 -flto -mcpu=cortex-a53 2>&1 \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-LTO
 // CHECK-LTO: "-plugin-opt=mcpu=cortex-a53"
 // CHECK-LTO: "-plugin-opt=O3"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -flto=thin -flto-jobs=8 2>&1 \
 // RUN:     -fuse-ld=lld \
 // RUN:     | FileCheck %s -check-prefix=CHECK-THINLTO
@@ -238,25 +238,25 @@
 // CHECK-THINLTO: "-plugin-opt=thinlto"
 // CHECK-THINLTO: "-plugin-opt=jobs=8"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -gsplit-dwarf -g -c %s 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF
 // CHECK-SPLIT-DWARF: "-split-dwarf-output" "fuchsia.dwo"
 
-// RUN: %clang %s -### --target=aarch64-fuchsia \
+// RUN: %clang %s -### --target=aarch64-unknown-fuchsia \
 // RUN:     -fprofile-instr-generate -fcoverage-mapping \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-PROFRT-AARCH64
 // CHECK-PROFRT-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-PROFRT-AARCH64: "-u__llvm_profile_runtime"
-// CHECK-PROFRT-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.profile.a"
+// CHECK-PROFRT-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.profile.a"
 
-// RUN: %clang %s -### --target=x86_64-fuchsia \
+// RUN: %clang %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -fprofile-instr-generate -fcoverage-mapping \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-PROFRT-X86_64
 // CHECK-PROFRT-X86_64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-PROFRT-X86_64: "-u__llvm_profile_runtime"
-// CHECK-PROFRT-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.profile.a"
+// CHECK-PROFRT-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.profile.a"

diff  --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index dc06984b88205..e38c70693a0a4 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -1,14 +1,14 @@
-// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-fuchsia \
+// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
-// RUN: %clangxx %s -### -no-canonical-prefixes --target=aarch64-fuchsia \
+// RUN: %clangxx %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
-// RUN: %clangxx %s -### -no-canonical-prefixes --target=riscv64-fuchsia \
+// RUN: %clangxx %s -### -no-canonical-prefixes --target=riscv64-unknown-fuchsia \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
@@ -36,9 +36,9 @@
 // CHECK: "-lc++"
 // CHECK: "-lm"
 // CHECK: "--pop-state"
-// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
-// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
-// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
+// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
 // CHECK-NOT: crtn.o
@@ -60,97 +60,97 @@
 // CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
 
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -nostdlib++ -fuse-ld=lld 2>&1 \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ -fuse-ld=lld 2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX
 // CHECK-NOSTDLIBXX-NOT: "-lc++"
 // CHECK-NOSTDLIBXX-NOT: "-lm"
 // CHECK-NOSTDLIBXX: "-lc"
 
-// RUN: %clangxx %s -### --target=x86_64-fuchsia \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=address \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fsanitize=address \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-exceptions \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-exceptions \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-NOEXCEPT-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=address -fno-exceptions \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fsanitize=address -fno-exceptions \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-NOEXCEPT-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fsanitize=address \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -fsanitize=address \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions -fsanitize=address \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions -fsanitize=address \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables -fexperimental-relative-c++-abi-vtables \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables -fexperimental-relative-c++-abi-vtables \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=hwaddress \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fsanitize=hwaddress \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-HWASAN-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=hwaddress -fno-exceptions \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fsanitize=hwaddress -fno-exceptions \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-HWASAN-NOEXCEPT-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fsanitize=hwaddress \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -fsanitize=hwaddress \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-X86
-// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions -fsanitize=hwaddress \
+// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions -fsanitize=hwaddress \
 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -fuse-ld=lld 2>&1\
 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-NOEXCEPT-X86
 // CHECK-MULTILIB-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
-// CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}asan"
-// CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}noexcept"
-// CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}asan+noexcept"
-// CHECK-MULTILIB-RELATIVE-VTABLES-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables"
-// CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables+noexcept"
-// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables+asan"
-// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables+asan+noexcept"
-// CHECK-MULTILIB-HWASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}hwasan"
-// CHECK-MULTILIB-HWASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}hwasan+noexcept"
-// CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables+hwasan"
-// CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}relative-vtables+hwasan+noexcept"
-// CHECK-MULTILIB-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia"
+// CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}asan"
+// CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}noexcept"
+// CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}asan+noexcept"
+// CHECK-MULTILIB-RELATIVE-VTABLES-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables"
+// CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables+noexcept"
+// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables+asan"
+// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables+asan+noexcept"
+// CHECK-MULTILIB-HWASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}hwasan"
+// CHECK-MULTILIB-HWASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}hwasan+noexcept"
+// CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables+hwasan"
+// CHECK-MULTILIB-RELATIVE-VTABLES-HWASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}relative-vtables+hwasan+noexcept"
+// CHECK-MULTILIB-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia"

diff  --git a/clang/test/Driver/linux-per-target-runtime-dir.c b/clang/test/Driver/linux-per-target-runtime-dir.c
index ee90fb69d566e..5fbc7163132ab 100644
--- a/clang/test/Driver/linux-per-target-runtime-dir.c
+++ b/clang/test/Driver/linux-per-target-runtime-dir.c
@@ -1,5 +1,5 @@
 // RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:     -stdlib=libc++ \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:     -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
@@ -12,16 +12,16 @@
 // CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "{{.*}}/../include/c++/v1"
 // CHECK-PER-TARGET-RUNTIME: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
 // CHECK-PER-TARGET-RUNTIME: "--sysroot=[[SYSROOT]]"
-// CHECK-PER-TARGET-RUNTIME: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-linux-gnu"
+// CHECK-PER-TARGET-RUNTIME: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-linux-gnu"
 
 // RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
-// CHECK-CLANGRT-X8664: lib{{/|\\}}x86_64-linux-gnu{{/|\\}}libclang_rt.builtins.a
+// CHECK-CLANGRT-X8664: lib{{/|\\}}x86_64-unknown-linux-gnu{{/|\\}}libclang_rt.builtins.a
 
 // RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
-// CHECK-FILE-NAME-X8664: lib{{/|\\}}x86_64-linux-gnu{{/|\\}}libclang_rt.builtins.a
+// CHECK-FILE-NAME-X8664: lib{{/|\\}}x86_64-unknown-linux-gnu{{/|\\}}libclang_rt.builtins.a

diff  --git a/clang/test/Driver/print-file-name.c b/clang/test/Driver/print-file-name.c
index afdaeeca48389..1043881fe90be 100644
--- a/clang/test/Driver/print-file-name.c
+++ b/clang/test/Driver/print-file-name.c
@@ -2,18 +2,18 @@
 
 // RUN: %clang -print-file-name=share/asan_blacklist.txt 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:   | FileCheck --check-prefix=CHECK-RESOURCE-DIR %s
 // CHECK-RESOURCE-DIR: resource_dir{{/|\\}}share{{/|\\}}asan_blacklist.txt
 
 // RUN: %clang -print-file-name=libclang_rt.builtins.a 2>&1 \
 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:   | FileCheck --check-prefix=CHECK-COMPILER-RT %s
-// CHECK-COMPILER-RT: resource_dir_with_per_target_subdir{{/|\\}}lib{{/|\\}}x86_64-linux-gnu{{/|\\}}libclang_rt.builtins.a
+// CHECK-COMPILER-RT: resource_dir_with_per_target_subdir{{/|\\}}lib{{/|\\}}x86_64-unknown-linux-gnu{{/|\\}}libclang_rt.builtins.a
 
 // RUN: %clang -print-file-name=include/c++/v1 2>&1 \
 // RUN:     -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
-// RUN:     --target=x86_64-linux-gnu \
+// RUN:     --target=x86_64-unknown-linux-gnu \
 // RUN:   | FileCheck --check-prefix=CHECK-INSTALL-DIR %s
 // CHECK-INSTALL-DIR: basic_linux_libcxx_tree{{/|\\}}usr{{/|\\}}bin{{/|\\}}..{{/|\\}}include{{/|\\}}c++{{/|\\}}v1

diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index c75711af546f8..a327b938d7a0e 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -387,7 +387,7 @@ runtimes-build)
           -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
           -DLLVM_ENABLE_PROJECTS="clang" \
           -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-          -DLLVM_RUNTIME_TARGETS="x86_64-linux-gnu"
+          -DLLVM_RUNTIME_TARGETS="x86_64-unknown-linux-gnu"
 
     echo "+++ Running the libc++ and libc++abi tests"
     ${NINJA} -C "${BUILD_DIR}" check-runtimes


        


More information about the cfe-commits mailing list