Date: Saturday, December 5, 2020 @ 19:08:03
  Author: foutrelis
Revision: 770919

archrelease: copy trunk to multilib-x86_64

Added:
  lib32-clang/repos/multilib-x86_64/PKGBUILD
    (from rev 770918, lib32-clang/trunk/PKGBUILD)
  lib32-clang/repos/multilib-x86_64/cuda-version-detection.patch
    (from rev 770918, lib32-clang/trunk/cuda-version-detection.patch)
  lib32-clang/repos/multilib-x86_64/enable-SSP-and-PIE-by-default.patch
    (from rev 770918, lib32-clang/trunk/enable-SSP-and-PIE-by-default.patch)
Deleted:
  lib32-clang/repos/multilib-x86_64/PKGBUILD
  lib32-clang/repos/multilib-x86_64/enable-SSP-and-PIE-by-default.patch

-------------------------------------+
 PKGBUILD                            |  189 ++++-----
 cuda-version-detection.patch        |  378 +++++++++++++++++++
 enable-SSP-and-PIE-by-default.patch |  672 +++++++++++++++++-----------------
 3 files changed, 810 insertions(+), 429 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD    2020-12-05 19:07:56 UTC (rev 770918)
+++ PKGBUILD    2020-12-05 19:08:03 UTC (rev 770919)
@@ -1,93 +0,0 @@
-# Maintainer: Evangelos Foutras <evange...@foutrelis.com>
-# Contributor: Jan "heftig" Steffens <jan.steff...@gmail.com>
-
-pkgname=lib32-clang
-pkgver=11.0.0
-pkgrel=1
-pkgdesc="C language family frontend for LLVM (32-bit)"
-arch=('x86_64')
-url="https://clang.llvm.org/";
-license=('custom:Apache 2.0 with LLVM Exception')
-depends=('lib32-llvm-libs' 'gcc-multilib')
-makedepends=('lib32-llvm' 'cmake' 'ninja' 'python')
-_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
-source=($_source_base/clang-$pkgver.src.tar.xz{,.sig}
-        $_source_base/llvm-$pkgver.src.tar.xz{,.sig}
-        enable-SSP-and-PIE-by-default.patch)
-sha256sums=('0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209'
-            'SKIP'
-            '913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469'
-            'SKIP'
-            '248a0e8609b00689e82ce5e05e1de58b7c8ae09a35bbb9625e9069e1f13d2fec')
-validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg 
<h...@chromium.org>
-validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard 
<tstel...@redhat.com>
-
-# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
-# installing static libraries; inspired by Gentoo
-_get_distribution_components() {
-  local target
-  ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r 
target; do
-    case $target in
-      clang-libraries|distribution)
-        continue
-        ;;
-      clang-tidy-headers)
-        continue
-        ;;
-      clang|clangd|clang-*)
-        ;;
-      clang*|findAllSymbols)
-        continue
-        ;;
-    esac
-    echo $target
-  done
-}
-
-prepare() {
-  cd "$srcdir/clang-$pkgver.src"
-  mkdir build
-  patch -Np2 -i ../enable-SSP-and-PIE-by-default.patch
-}
-
-build() {
-  cd "$srcdir/clang-$pkgver.src/build"
-
-  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
-
-  local cmake_args=(
-    -G Ninja
-    -DCMAKE_BUILD_TYPE=Release
-    -DCMAKE_INSTALL_PREFIX=/usr
-    -DPYTHON_EXECUTABLE=/usr/bin/python
-    -DLLVM_LIBDIR_SUFFIX=32
-    -DCMAKE_C_FLAGS:STRING=-m32
-    -DCMAKE_CXX_FLAGS:STRING=-m32
-    -DLLVM_CONFIG="/usr/bin/llvm-config32"
-    -DLLVM_LINK_LLVM_DYLIB=ON
-    -DCLANG_LINK_CLANG_DYLIB=ON
-    -DLLVM_ENABLE_RTTI=ON
-    -DLLVM_BUILD_TESTS=OFF
-    -DLLVM_INCLUDE_DOCS=OFF
-    -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
-  )
-
-  cmake .. "${cmake_args[@]}"
-  local distribution_components=$(_get_distribution_components | paste -sd\;)
-  test -n "$distribution_components"
-  cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
-
-  cmake .. "${cmake_args[@]}"
-  ninja
-}
-
-package() {
-  cd "$srcdir/clang-$pkgver.src/build"
-
-  DESTDIR="$pkgdir" ninja install-distribution
-  rm -rf "$pkgdir"/usr/{bin,include,libexec,share}
-
-  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-}
-
-# vim:set ts=2 sw=2 et:

Copied: lib32-clang/repos/multilib-x86_64/PKGBUILD (from rev 770918, 
lib32-clang/trunk/PKGBUILD)
===================================================================
--- PKGBUILD                            (rev 0)
+++ PKGBUILD    2020-12-05 19:08:03 UTC (rev 770919)
@@ -0,0 +1,96 @@
+# Maintainer: Evangelos Foutras <evange...@foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steff...@gmail.com>
+
+pkgname=lib32-clang
+pkgver=11.0.0
+pkgrel=2
+pkgdesc="C language family frontend for LLVM (32-bit)"
+arch=('x86_64')
+url="https://clang.llvm.org/";
+license=('custom:Apache 2.0 with LLVM Exception')
+depends=('lib32-llvm-libs' 'gcc-multilib')
+makedepends=('lib32-llvm' 'cmake' 'ninja' 'python')
+_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
+source=($_source_base/clang-$pkgver.src.tar.xz{,.sig}
+        $_source_base/llvm-$pkgver.src.tar.xz{,.sig}
+        cuda-version-detection.patch
+        enable-SSP-and-PIE-by-default.patch)
+sha256sums=('0f96acace1e8326b39f220ba19e055ba99b0ab21c2475042dbc6a482649c5209'
+            'SKIP'
+            '913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469'
+            'SKIP'
+            '757dc5a288f6847d38e320c364d48fb6454aef25514b2346030b623842ac904e'
+            '248a0e8609b00689e82ce5e05e1de58b7c8ae09a35bbb9625e9069e1f13d2fec')
+validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg 
<h...@chromium.org>
+validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard 
<tstel...@redhat.com>
+
+# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
+# installing static libraries; inspired by Gentoo
+_get_distribution_components() {
+  local target
+  ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r 
target; do
+    case $target in
+      clang-libraries|distribution)
+        continue
+        ;;
+      clang-tidy-headers)
+        continue
+        ;;
+      clang|clangd|clang-*)
+        ;;
+      clang*|findAllSymbols)
+        continue
+        ;;
+    esac
+    echo $target
+  done
+}
+
+prepare() {
+  cd "$srcdir/clang-$pkgver.src"
+  mkdir build
+  patch -Np2 -i ../cuda-version-detection.patch
+  patch -Np2 -i ../enable-SSP-and-PIE-by-default.patch
+}
+
+build() {
+  cd "$srcdir/clang-$pkgver.src/build"
+
+  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
+
+  local cmake_args=(
+    -G Ninja
+    -DCMAKE_BUILD_TYPE=Release
+    -DCMAKE_INSTALL_PREFIX=/usr
+    -DPYTHON_EXECUTABLE=/usr/bin/python
+    -DLLVM_LIBDIR_SUFFIX=32
+    -DCMAKE_C_FLAGS:STRING=-m32
+    -DCMAKE_CXX_FLAGS:STRING=-m32
+    -DLLVM_CONFIG="/usr/bin/llvm-config32"
+    -DLLVM_LINK_LLVM_DYLIB=ON
+    -DCLANG_LINK_CLANG_DYLIB=ON
+    -DLLVM_ENABLE_RTTI=ON
+    -DLLVM_BUILD_TESTS=OFF
+    -DLLVM_INCLUDE_DOCS=OFF
+    -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
+  )
+
+  cmake .. "${cmake_args[@]}"
+  local distribution_components=$(_get_distribution_components | paste -sd\;)
+  test -n "$distribution_components"
+  cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
+
+  cmake .. "${cmake_args[@]}"
+  ninja
+}
+
+package() {
+  cd "$srcdir/clang-$pkgver.src/build"
+
+  DESTDIR="$pkgdir" ninja install-distribution
+  rm -rf "$pkgdir"/usr/{bin,include,libexec,share}
+
+  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:

Copied: lib32-clang/repos/multilib-x86_64/cuda-version-detection.patch (from 
rev 770918, lib32-clang/trunk/cuda-version-detection.patch)
===================================================================
--- cuda-version-detection.patch                                (rev 0)
+++ cuda-version-detection.patch        2020-12-05 19:08:03 UTC (rev 770919)
@@ -0,0 +1,378 @@
+From d50044e809d2c15c56df0ea808f047a2c81d7344 Mon Sep 17 00:00:00 2001
+From: Artem Belevich <t...@google.com>
+Date: Mon, 19 Oct 2020 16:41:51 -0700
+Subject: [PATCH 1/2] [CUDA] Improve clang's ability to detect recent CUDA
+ versions.
+
+CUDA-11.1 does not carry version.txt which causes clang to assume that it's
+CUDA-7.0, which used to be the only CUDA version w/o version.txt.
+
+In order to tell CUDA-7.0 apart from the new versions, clang now probes for the
+presence of libdevice.10.bc which is not present in the old CUDA versions.
+
+This should keep Clang working for CUDA-11.1.
+
+PR47332: https://bugs.llvm.org/show_bug.cgi?id=47332
+
+Differential Revision: https://reviews.llvm.org/D89752
+
+(cherry picked from commit 65d206484c54177641d4b11d42cab1f1acc8c0c7)
+---
+ clang/lib/Driver/ToolChains/Cuda.cpp                  | 11 ++++++++---
+ .../Driver/Inputs/CUDA_111/usr/local/cuda/bin/.keep   |  0
+ .../Inputs/CUDA_111/usr/local/cuda/include/.keep      |  0
+ .../Driver/Inputs/CUDA_111/usr/local/cuda/lib/.keep   |  0
+ .../Driver/Inputs/CUDA_111/usr/local/cuda/lib64/.keep |  0
+ .../usr/local/cuda/nvvm/libdevice/libdevice.10.bc     |  0
+ clang/test/Driver/cuda-version-check.cu               |  7 ++++++-
+ 7 files changed, 14 insertions(+), 4 deletions(-)
+ create mode 100644 clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/bin/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/.keep
+ create mode 100644 clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib64/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
+
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
+index 110a0bca9bc1..cfd9dae0fa91 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -155,9 +155,14 @@ CudaInstallationDetector::CudaInstallationDetector(
+     llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
+         FS.getBufferForFile(InstallPath + "/version.txt");
+     if (!VersionFile) {
+-      // CUDA 7.0 doesn't have a version.txt, so guess that's our version if
+-      // version.txt isn't present.
+-      Version = CudaVersion::CUDA_70;
++      // CUDA 7.0 and CUDA 11.1+ do not have version.txt file.
++      // Use libdevice file to distinguish 7.0 from the new versions.
++      if (FS.exists(LibDevicePath + "/libdevice.10.bc")) {
++        Version = CudaVersion::LATEST;
++        DetectedVersionIsNotSupported = Version > 
CudaVersion::LATEST_SUPPORTED;
++      } else {
++        Version = CudaVersion::CUDA_70;
++      }
+     } else {
+       ParseCudaVersionFile((*VersionFile)->getBuffer());
+     }
+diff --git a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/bin/.keep 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/bin/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/.keep 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib/.keep 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib64/.keep 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/lib64/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git 
a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/cuda-version-check.cu 
b/clang/test/Driver/cuda-version-check.cu
+index a09b248304f2..1e6af029202f 100644
+--- a/clang/test/Driver/cuda-version-check.cu
++++ b/clang/test/Driver/cuda-version-check.cu
+@@ -10,6 +10,11 @@
+ // RUN:    FileCheck %s --check-prefix=OK
+ // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
+ // RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION
++// CUDA versions after 11.0 (update 1) do not carry version.txt file. Make 
sure
++// we still detect them as a new version and handle them the same as we handle
++// other new CUDA versions.
++// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA_111/usr/local/cuda 2>&1 %s | \
++// RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION
+ // Make sure that we don't warn about CUDA version during C++ compilation.
+ // RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
+ // RUN:    --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
+@@ -65,5 +70,5 @@
+ // ERR_SM61: error: GPU arch sm_61 {{.*}}
+ // ERR_SM61-NOT: error: GPU arch sm_61
+ 
+-// UNKNOWN_VERSION: Unknown CUDA version 999.999. Assuming the latest 
supported version
++// UNKNOWN_VERSION: Unknown CUDA version {{.*}}. Assuming the latest 
supported version
+ // UNKNOWN_VERSION_CXX-NOT: Unknown CUDA version
+
+From 06f479cba3a09ef47326ea69e719d2aa1c0fba4c Mon Sep 17 00:00:00 2001
+From: Artem Belevich <t...@google.com>
+Date: Tue, 20 Oct 2020 15:11:38 -0700
+Subject: [PATCH 2/2] [CUDA] Extract CUDA version from cuda.h if version.txt is
+ not found
+
+If CUDA version can not be determined based on version.txt file, attempt to 
find
+CUDA_VERSION macro in cuda.h.
+
+This is a follow-up to D89752,
+
+Differntial Revision: https://reviews.llvm.org/D89832
+
+(cherry picked from commit e7fe125b776bf08d95e60ff3354a5c836218a0e6)
+---
+ .../clang/Basic/DiagnosticDriverKinds.td      |   2 +-
+ clang/lib/Driver/ToolChains/Cuda.cpp          | 118 +++++++++++++-----
+ clang/lib/Driver/ToolChains/Cuda.h            |   3 -
+ .../Inputs/CUDA_102/usr/local/cuda/bin/.keep  |   0
+ .../CUDA_102/usr/local/cuda/include/.keep     |   0
+ .../Inputs/CUDA_102/usr/local/cuda/lib/.keep  |   0
+ .../CUDA_102/usr/local/cuda/lib64/.keep       |   0
+ .../local/cuda/nvvm/libdevice/libdevice.10.bc |   0
+ .../CUDA_102/usr/local/cuda/version.txt       |   1 +
+ .../CUDA_111/usr/local/cuda/include/cuda.h    |   7 ++
+ clang/test/Driver/cuda-version-check.cu       |  14 ++-
+ 11 files changed, 108 insertions(+), 37 deletions(-)
+ create mode 100644 clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/bin/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/include/.keep
+ create mode 100644 clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib64/.keep
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/version.txt
+ create mode 100644 
clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/cuda.h
+
+diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
+index 558639ecad6a..acdad15cdf6c 100644
+--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
++++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
+@@ -69,7 +69,7 @@ def err_drv_cuda_version_unsupported : Error<
+   "install, pass a different GPU arch with --cuda-gpu-arch, or pass "
+   "--no-cuda-version-check.">;
+ def warn_drv_unknown_cuda_version: Warning<
+-  "Unknown CUDA version %0. Assuming the latest supported version %1">,
++  "Unknown CUDA version. %0 Assuming the latest supported version %1">,
+   InGroup<CudaUnknownVersion>;
+ def err_drv_cuda_host_arch : Error<"unsupported architecture '%0' for host 
compilation.">;
+ def err_drv_mix_cuda_hip : Error<"Mixed Cuda and HIP compilation is not 
supported.">;
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
+index cfd9dae0fa91..ffc606dd554b 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -16,6 +16,7 @@
+ #include "clang/Driver/Driver.h"
+ #include "clang/Driver/DriverDiagnostic.h"
+ #include "clang/Driver/Options.h"
++#include "llvm/ADT/Optional.h"
+ #include "llvm/Option/ArgList.h"
+ #include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/Host.h"
+@@ -32,29 +33,80 @@ using namespace clang::driver::tools;
+ using namespace clang;
+ using namespace llvm::opt;
+ 
++namespace {
++struct CudaVersionInfo {
++  std::string DetectedVersion;
++  CudaVersion Version;
++};
+ // Parses the contents of version.txt in an CUDA installation.  It should
+ // contain one line of the from e.g. "CUDA Version 7.5.2".
+-void CudaInstallationDetector::ParseCudaVersionFile(llvm::StringRef V) {
+-  Version = CudaVersion::UNKNOWN;
++CudaVersionInfo parseCudaVersionFile(llvm::StringRef V) {
++  V = V.trim();
+   if (!V.startswith("CUDA Version "))
+-    return;
++    return {V.str(), CudaVersion::UNKNOWN};
+   V = V.substr(strlen("CUDA Version "));
+   SmallVector<StringRef,4> VersionParts;
+   V.split(VersionParts, '.');
+-  if (VersionParts.size() < 2)
+-    return;
+-  DetectedVersion = join_items(".", VersionParts[0], VersionParts[1]);
+-  Version = CudaStringToVersion(DetectedVersion);
+-  if (Version != CudaVersion::UNKNOWN) {
+-    // TODO(tra): remove the warning once we have all features of 10.2 and 
11.0
+-    // implemented.
+-    DetectedVersionIsNotSupported = Version > CudaVersion::LATEST_SUPPORTED;
+-    return;
+-  }
++  return {"version.txt: " + V.str() + ".",
++          VersionParts.size() < 2
++              ? CudaVersion::UNKNOWN
++              : CudaStringToVersion(
++                    join_items(".", VersionParts[0], VersionParts[1]))};
++}
++
++CudaVersion getCudaVersion(uint32_t raw_version) {
++  if (raw_version < 7050)
++    return CudaVersion::CUDA_70;
++  if (raw_version < 8000)
++    return CudaVersion::CUDA_75;
++  if (raw_version < 9000)
++    return CudaVersion::CUDA_80;
++  if (raw_version < 9010)
++    return CudaVersion::CUDA_90;
++  if (raw_version < 9020)
++    return CudaVersion::CUDA_91;
++  if (raw_version < 10000)
++    return CudaVersion::CUDA_92;
++  if (raw_version < 10010)
++    return CudaVersion::CUDA_100;
++  if (raw_version < 10020)
++    return CudaVersion::CUDA_101;
++  if (raw_version < 11000)
++    return CudaVersion::CUDA_102;
++  if (raw_version < 11010)
++    return CudaVersion::CUDA_110;
++  return CudaVersion::LATEST;
++}
+ 
+-  Version = CudaVersion::LATEST_SUPPORTED;
+-  DetectedVersionIsNotSupported = true;
++CudaVersionInfo parseCudaHFile(llvm::StringRef Input) {
++  // Helper lambda which skips the words if the line starts with them or 
returns
++  // None otherwise.
++  auto StartsWithWords =
++      [](llvm::StringRef Line,
++         const SmallVector<StringRef, 3> words) -> llvm::Optional<StringRef> {
++    for (StringRef word : words) {
++      if (!Line.consume_front(word))
++        return {};
++      Line = Line.ltrim();
++    }
++    return Line;
++  };
++
++  Input = Input.ltrim();
++  while (!Input.empty()) {
++    if (auto Line =
++            StartsWithWords(Input.ltrim(), {"#", "define", "CUDA_VERSION"})) {
++      uint32_t RawVersion;
++      Line->consumeInteger(10, RawVersion);
++      return {"cuda.h: CUDA_VERSION=" + Twine(RawVersion).str() + ".",
++              getCudaVersion(RawVersion)};
++    }
++    // Find next non-empty line.
++    Input = Input.drop_front(Input.find_first_of("\n\r")).ltrim();
++  }
++  return {"cuda.h: CUDA_VERSION not found.", CudaVersion::UNKNOWN};
+ }
++} // namespace
+ 
+ void CudaInstallationDetector::WarnIfUnsupportedVersion() {
+   if (DetectedVersionIsNotSupported)
+@@ -152,21 +204,31 @@ CudaInstallationDetector::CudaInstallationDetector(
+     else
+       continue;
+ 
+-    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
+-        FS.getBufferForFile(InstallPath + "/version.txt");
+-    if (!VersionFile) {
+-      // CUDA 7.0 and CUDA 11.1+ do not have version.txt file.
+-      // Use libdevice file to distinguish 7.0 from the new versions.
+-      if (FS.exists(LibDevicePath + "/libdevice.10.bc")) {
+-        Version = CudaVersion::LATEST;
+-        DetectedVersionIsNotSupported = Version > 
CudaVersion::LATEST_SUPPORTED;
+-      } else {
+-        Version = CudaVersion::CUDA_70;
+-      }
+-    } else {
+-      ParseCudaVersionFile((*VersionFile)->getBuffer());
++    CudaVersionInfo VersionInfo = {"", CudaVersion::UNKNOWN};
++    if (auto VersionFile = FS.getBufferForFile(InstallPath + "/version.txt"))
++      VersionInfo = parseCudaVersionFile((*VersionFile)->getBuffer());
++    // If version file didn't give us the version, try to find it in cuda.h
++    if (VersionInfo.Version == CudaVersion::UNKNOWN)
++      if (auto CudaHFile = FS.getBufferForFile(InstallPath + 
"/include/cuda.h"))
++        VersionInfo = parseCudaHFile((*CudaHFile)->getBuffer());
++    // As the last resort, make an educated guess between CUDA-7.0, (which had
++    // no version.txt file and had old-style libdevice bitcode ) and an 
unknown
++    // recent CUDA version (no version.txt, new style bitcode).
++    if (VersionInfo.Version == CudaVersion::UNKNOWN) {
++      VersionInfo.Version = (FS.exists(LibDevicePath + "/libdevice.10.bc"))
++                                ? Version = CudaVersion::LATEST
++                                : Version = CudaVersion::CUDA_70;
++      VersionInfo.DetectedVersion =
++          "No version found in version.txt or cuda.h.";
+     }
+ 
++    Version = VersionInfo.Version;
++    DetectedVersion = VersionInfo.DetectedVersion;
++
++    // TODO(tra): remove the warning once we have all features of 10.2
++    // and 11.0 implemented.
++    DetectedVersionIsNotSupported = Version > CudaVersion::LATEST_SUPPORTED;
++
+     if (Version >= CudaVersion::CUDA_90) {
+       // CUDA-9+ uses single libdevice file for all GPU variants.
+       std::string FilePath = LibDevicePath + "/libdevice.10.bc";
+diff --git a/clang/lib/Driver/ToolChains/Cuda.h 
b/clang/lib/Driver/ToolChains/Cuda.h
+index 873eb7338a30..bbf272c468a5 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.h
++++ b/clang/lib/Driver/ToolChains/Cuda.h
+@@ -78,9 +78,6 @@ public:
+     return LibDeviceMap.lookup(Gpu);
+   }
+   void WarnIfUnsupportedVersion();
+-
+-private:
+-  void ParseCudaVersionFile(llvm::StringRef V);
+ };
+ 
+ namespace tools {
+diff --git a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/bin/.keep 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/bin/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/include/.keep 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/include/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib/.keep 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib64/.keep 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/lib64/.keep
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git 
a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/nvvm/libdevice/libdevice.10.bc
+new file mode 100644
+index 000000000000..e69de29bb2d1
+diff --git a/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/version.txt 
b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/version.txt
+new file mode 100644
+index 000000000000..cd34d385ddf5
+--- /dev/null
++++ b/clang/test/Driver/Inputs/CUDA_102/usr/local/cuda/version.txt
+@@ -0,0 +1 @@
++CUDA Version 10.2.333
+diff --git a/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/cuda.h 
b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/cuda.h
+new file mode 100644
+index 000000000000..6ce5b747561d
+--- /dev/null
++++ b/clang/test/Driver/Inputs/CUDA_111/usr/local/cuda/include/cuda.h
+@@ -0,0 +1,7 @@
++//
++// Placeholder file for testing CUDA version detection
++//
++
++#define CUDA_VERSION 11010
++
++//
+diff --git a/clang/test/Driver/cuda-version-check.cu 
b/clang/test/Driver/cuda-version-check.cu
+index 1e6af029202f..bc04794375a9 100644
+--- a/clang/test/Driver/cuda-version-check.cu
++++ b/clang/test/Driver/cuda-version-check.cu
+@@ -8,13 +8,15 @@
+ // RUN:    FileCheck %s --check-prefix=OK
+ // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
+ // RUN:    FileCheck %s --check-prefix=OK
++// Test version guess when no version.txt or cuda.h are found
+ // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
+ // RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION
+-// CUDA versions after 11.0 (update 1) do not carry version.txt file. Make 
sure
+-// we still detect them as a new version and handle them the same as we handle
+-// other new CUDA versions.
++// Unknown version with version.txt present
++// RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA_102/usr/local/cuda 2>&1 %s | \
++// RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION_V
++// Unknown version with no version.txt but with version info present in cuda.h
+ // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 
--cuda-path=%S/Inputs/CUDA_111/usr/local/cuda 2>&1 %s | \
+-// RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION
++// RUN:    FileCheck %s --check-prefix=UNKNOWN_VERSION_H
+ // Make sure that we don't warn about CUDA version during C++ compilation.
+ // RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \
+ // RUN:    --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \
+@@ -70,5 +72,7 @@
+ // ERR_SM61: error: GPU arch sm_61 {{.*}}
+ // ERR_SM61-NOT: error: GPU arch sm_61
+ 
+-// UNKNOWN_VERSION: Unknown CUDA version {{.*}}. Assuming the latest 
supported version
++// UNKNOWN_VERSION_V: Unknown CUDA version. version.txt:{{.*}}. Assuming the 
latest supported version
++// UNKNOWN_VERSION_H: Unknown CUDA version. cuda.h: CUDA_VERSION={{.*}}. 
Assuming the latest supported version
++// UNKNOWN_VERSION: Unknown CUDA version. No version found in version.txt or 
cuda.h. Assuming the latest supported version
+ // UNKNOWN_VERSION_CXX-NOT: Unknown CUDA version

Deleted: enable-SSP-and-PIE-by-default.patch
===================================================================
--- enable-SSP-and-PIE-by-default.patch 2020-12-05 19:07:56 UTC (rev 770918)
+++ enable-SSP-and-PIE-by-default.patch 2020-12-05 19:08:03 UTC (rev 770919)
@@ -1,336 +0,0 @@
-From bb7bdc61f8a80db9aa16370d9c9fd0ae7be825cc Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evange...@foutrelis.com>
-Date: Mon, 12 Oct 2020 16:40:41 +0300
-Subject: [PATCH] Enable SSP and PIE by default
-
-This is a minimal set of changes needed to make clang use SSP and PIE by
-default on Arch Linux. Tests that were easy to adjust have been changed
-accordingly; only test/Driver/linux-ld.c has been marked as "expected
-failure" due to the number of changes it would require (mostly replacing
-crtbegin.o with crtbeginS.o).
-
-Doing so is needed in order to align clang with the new default GCC
-behavior in Arch which generates PIE executables by default and also
-defaults to -fstack-protector-strong. It is not meant to be a long term
-solution, but a simple temporary fix.
-
-Hopefully these changes will be obsoleted by the introduction upstream
-of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
----
- clang/lib/Driver/ToolChains/Linux.cpp     | 14 ++++++++++++--
- clang/lib/Driver/ToolChains/Linux.h       |  1 +
- clang/test/Driver/cross-linux.c           | 16 ++++++++--------
- clang/test/Driver/env.c                   |  2 +-
- clang/test/Driver/fsanitize.c             | 14 +++++++-------
- clang/test/Driver/gcc-toolchain.cpp       |  2 +-
- clang/test/Driver/hexagon-toolchain-elf.c |  2 +-
- clang/test/Driver/linux-as.c              |  4 ++--
- clang/test/Driver/linux-ld.c              |  2 ++
- clang/test/Driver/ppc-abi.c               | 16 +++++++++-------
- clang/test/Driver/riscv32-toolchain.c     |  4 ++--
- clang/test/Driver/riscv64-toolchain.c     |  4 ++--
- clang/test/Driver/stack-protector.c       |  4 ++--
- 13 files changed, 50 insertions(+), 35 deletions(-)
-
-diff --git a/clang/lib/Driver/ToolChains/Linux.cpp 
b/clang/lib/Driver/ToolChains/Linux.cpp
-index 180350476c3..119f32ceec6 100644
---- a/clang/lib/Driver/ToolChains/Linux.cpp
-+++ b/clang/lib/Driver/ToolChains/Linux.cpp
-@@ -819,8 +819,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
- }
- 
- bool Linux::isPIEDefault() const {
--  return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
--          getTriple().isMusl() || getSanitizerArgs().requiresPIE();
-+  const bool IsMips = getTriple().isMIPS();
-+  const bool IsAndroid = getTriple().isAndroid();
-+
-+  if (IsMips || IsAndroid)
-+    return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
-+            getTriple().isMusl() || getSanitizerArgs().requiresPIE();
-+
-+  return true;
-+}
-+
-+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
-+  return 2;
- }
- 
- bool Linux::isNoExecStackDefault() const {
-diff --git a/clang/lib/Driver/ToolChains/Linux.h 
b/clang/lib/Driver/ToolChains/Linux.h
-index 6b16b0e6499..d0024110aef 100644
---- a/clang/lib/Driver/ToolChains/Linux.h
-+++ b/clang/lib/Driver/ToolChains/Linux.h
-@@ -39,6 +39,7 @@ public:
-   bool isPIEDefault() const override;
-   bool isNoExecStackDefault() const override;
-   bool IsMathErrnoDefault() const override;
-+  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
-   SanitizerMask getSupportedSanitizers() const override;
-   void addProfileRTLibs(const llvm::opt::ArgList &Args,
-                         llvm::opt::ArgStringList &CmdArgs) const override;
-diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c
-index 6c2dab26069..c28c5653e34 100644
---- a/clang/test/Driver/cross-linux.c
-+++ b/clang/test/Driver/cross-linux.c
-@@ -42,8 +42,8 @@
- // CHECK-MULTI32-I386: 
"{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
- // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
- // CHECK-MULTI32-I386: "-m" "elf_i386"
--// CHECK-MULTI32-I386: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
--// CHECK-MULTI32-I386: "-L[[gcc_install]]"
-+// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o"
-+// CHECK-MULTI32-I386: 
"-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]"
- // CHECK-MULTI32-I386: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32"
- // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
- // CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
-@@ -60,8 +60,8 @@
- // CHECK-MULTI32-X86-64: 
"{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
- // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
- // CHECK-MULTI32-X86-64: "-m" "elf_x86_64"
--// CHECK-MULTI32-X86-64: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o"
--// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64"
-+// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o"
-+// CHECK-MULTI32-X86-64: 
"-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64"
- // CHECK-MULTI32-X86-64: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64"
- // CHECK-MULTI32-X86-64: "-L[[gcc_install]]"
- // CHECK-MULTI32-X86-64: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
-@@ -79,8 +79,8 @@
- // CHECK-MULTI64-I386: 
"{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
- // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
- // CHECK-MULTI64-I386: "-m" "elf_i386"
--// CHECK-MULTI64-I386: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o"
--// CHECK-MULTI64-I386: "-L[[gcc_install]]/32"
-+// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o"
-+// CHECK-MULTI64-I386: 
"-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32"
- // CHECK-MULTI64-I386: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32"
- // CHECK-MULTI64-I386: "-L[[gcc_install]]"
- // CHECK-MULTI64-I386: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
-@@ -98,8 +98,8 @@
- // CHECK-MULTI64-X86-64: 
"{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
- // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
- // CHECK-MULTI64-X86-64: "-m" "elf_x86_64"
--// CHECK-MULTI64-X86-64: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
--// CHECK-MULTI64-X86-64: "-L[[gcc_install]]"
-+// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o"
-+// CHECK-MULTI64-X86-64: 
"-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]"
- // CHECK-MULTI64-X86-64: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64"
- // CHECK-MULTI64-X86-64: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
- // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
-diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
-index 0371bc91c4a..ea89f525121 100644
---- a/clang/test/Driver/env.c
-+++ b/clang/test/Driver/env.c
-@@ -20,7 +20,7 @@
- //
- // CHECK-LD-32-NOT: warning:
- // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
--// CHECK-LD-32: 
"{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
-+// CHECK-LD-32: "crtbeginS.o"
- // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
- // CHECK-LD-32: 
"-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
- // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
-diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
-index 7340bfb35e4..681bb90b50e 100644
---- a/clang/test/Driver/fsanitize.c
-+++ b/clang/test/Driver/fsanitize.c
-@@ -329,15 +329,15 @@
- // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr 
-fsanitize=undefined,address %s -### 2>&1
- // OK
- 
--// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
--// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-+// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
- // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIE
- // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
- // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIC-NO-PIE
- // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-PIE
- // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIE
--// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
--// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
-+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
-+// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
- 
- // CHECK-NO-PIE-NOT: "-pie"
- // CHECK-NO-PIE: "-mrelocation-model" "static"
-@@ -662,12 +662,12 @@
- // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s 
-check-prefix=NOSP
- // NOSP-NOT: "-fsanitize=safe-stack"
- 
--// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=NO-SP
-+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=SP
- // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP-ASAN
- // RUN: %clang -target x86_64-linux-gnu -fstack-protector 
-fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
- // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
--// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
--// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
-+// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP
-+// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP
- // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
- // NO-SP-NOT: stack-protector
- // NO-SP: "-fsanitize=safe-stack"
-diff --git a/clang/test/Driver/gcc-toolchain.cpp 
b/clang/test/Driver/gcc-toolchain.cpp
-index 6c872f4255c..f5006d1dd9a 100644
---- a/clang/test/Driver/gcc-toolchain.cpp
-+++ b/clang/test/Driver/gcc-toolchain.cpp
-@@ -26,6 +26,6 @@
- // the same precise formatting of the path as the '-internal-system' flags
- // above, so we just blanket wildcard match the 'crtbegin.o'.
- // CHECK: "{{[^"]*}}ld{{(.exe)?}}"
--// CHECK: 
"{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
-+// CHECK: "crtbeginS.o"
- // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
- // CHECK: 
"-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
-diff --git a/clang/test/Driver/hexagon-toolchain-elf.c 
b/clang/test/Driver/hexagon-toolchain-elf.c
-index cc11f9fcba9..1fe8b5db587 100644
---- a/clang/test/Driver/hexagon-toolchain-elf.c
-+++ b/clang/test/Driver/hexagon-toolchain-elf.c
-@@ -487,7 +487,7 @@
- // RUN:   %s 2>&1 \
- // RUN:   | FileCheck -check-prefix=CHECK042 %s
- // CHECK042:      "-cc1"
--// CHECK042:      "-mrelocation-model" "static"
-+// CHECK042:      "-mrelocation-model" "pic"
- // CHECK042:      "-mllvm" "-hexagon-small-data-threshold=8"
- // CHECK042-NEXT: llvm-mc
- // CHECK042:      "-gpsize=8"
-diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
-index 0959bd7ba0a..4056a672b6f 100644
---- a/clang/test/Driver/linux-as.c
-+++ b/clang/test/Driver/linux-as.c
-@@ -164,7 +164,7 @@
- // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
- //
- // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
--// RUN:   -no-integrated-as -c %s 2>&1 \
-+// RUN:   -no-integrated-as -fno-pic -c %s 2>&1 \
- // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9 %s
- // CHECK-SPARCV9: as
- // CHECK-SPARCV9: -64
-@@ -173,7 +173,7 @@
- // CHECK-SPARCV9: -o
- //
- // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
--// RUN:   -no-integrated-as -fpic -c %s 2>&1 \
-+// RUN:   -no-integrated-as -c %s 2>&1 \
- // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
- // CHECK-SPARCV9PIC: as
- // CHECK-SPARCV9PIC: -64
-diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
-index ec539522c25..caf96020a15 100644
---- a/clang/test/Driver/linux-ld.c
-+++ b/clang/test/Driver/linux-ld.c
-@@ -1,3 +1,5 @@
-+// XFAIL: linux
-+
- // General tests that ld invocations on Linux targets sane. Note that we use
- // sysroot to make these tests independent of the host system.
- //
-diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
-index aef8d8576ad..ec595f4cd96 100644
---- a/clang/test/Driver/ppc-abi.c
-+++ b/clang/test/Driver/ppc-abi.c
-@@ -1,9 +1,9 @@
- // Check passing PowerPC ABI options to the backend.
- 
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
--// RUN:   | FileCheck -check-prefix=CHECK-ELFv1 %s
-+// RUN:   | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
--// RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
-+// RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
- // RUN:   -mabi=elfv1-qpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
-@@ -11,9 +11,9 @@
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
- // RUN:   -mcpu=a2 -mqpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
--// RUN:   -mcpu=a2q -mno-qpx | FileCheck -check-prefix=CHECK-ELFv1 %s
-+// RUN:   -mcpu=a2q -mno-qpx | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
- // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
--// RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE %s
-+// RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE-PIE %s
- 
- // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
- // RUN:   | FileCheck -check-prefix=CHECK-ELFv2 %s
-@@ -33,11 +33,13 @@
- 
- // CHECK-ELFv1: "-mrelocation-model" "static"
- // CHECK-ELFv1: "-target-abi" "elfv1"
--// CHECK-ELFv1-LE: "-mrelocation-model" "static"
-+// CHECK-ELFv1-PIE: "-mrelocation-model" "pic" "-pic-level" "2"
-+// CHECK-ELFv1-PIE: "-target-abi" "elfv1"
-+// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv1-LE: "-target-abi" "elfv1"
--// CHECK-ELFv1-QPX: "-mrelocation-model" "static"
-+// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
--// CHECK-ELFv2: "-mrelocation-model" "static"
-+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv2: "-target-abi" "elfv2"
- // CHECK-ELFv2-BE: "-mrelocation-model" "static"
- // CHECK-ELFv2-BE: "-target-abi" "elfv2"
-diff --git a/clang/test/Driver/riscv32-toolchain.c 
b/clang/test/Driver/riscv32-toolchain.c
-index b83c9aafcbf..15b6f6496b2 100644
---- a/clang/test/Driver/riscv32-toolchain.c
-+++ b/clang/test/Driver/riscv32-toolchain.c
-@@ -81,7 +81,7 @@
- // C-RV32-LINUX-MULTI-ILP32: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
- // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv"
- // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" 
"/lib/ld-linux-riscv32-ilp32.so.1"
--// C-RV32-LINUX-MULTI-ILP32: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o"
-+// C-RV32-LINUX-MULTI-ILP32: "crtbeginS.o"
- // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
- // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
- // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
-@@ -96,7 +96,7 @@
- // C-RV32-LINUX-MULTI-ILP32D: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
- // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
- // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" 
"/lib/ld-linux-riscv32-ilp32d.so.1"
--// C-RV32-LINUX-MULTI-ILP32D: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o"
-+// C-RV32-LINUX-MULTI-ILP32D: "crtbeginS.o"
- // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
- // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
- // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
-diff --git a/clang/test/Driver/riscv64-toolchain.c 
b/clang/test/Driver/riscv64-toolchain.c
-index 5df069eb9fd..2617551ec35 100644
---- a/clang/test/Driver/riscv64-toolchain.c
-+++ b/clang/test/Driver/riscv64-toolchain.c
-@@ -81,7 +81,7 @@
- // C-RV64-LINUX-MULTI-LP64: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
- // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
- // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" 
"/lib/ld-linux-riscv64-lp64.so.1"
--// C-RV64-LINUX-MULTI-LP64: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o"
-+// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o"
- // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
- // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
- // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
-@@ -96,7 +96,7 @@
- // C-RV64-LINUX-MULTI-LP64D: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
- // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
- // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" 
"/lib/ld-linux-riscv64-lp64d.so.1"
--// C-RV64-LINUX-MULTI-LP64D: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o"
-+// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o"
- // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d"
- // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
- // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
-diff --git a/clang/test/Driver/stack-protector.c 
b/clang/test/Driver/stack-protector.c
-index a3e40b50eed..dfffe0d6cf8 100644
---- a/clang/test/Driver/stack-protector.c
-+++ b/clang/test/Driver/stack-protector.c
-@@ -3,11 +3,11 @@
- // NOSSP-NOT: "-stack-protector-buffer-size" 
- 
- // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | 
FileCheck %s -check-prefix=SSP
--// SSP: "-stack-protector" "1"
-+// SSP: "-stack-protector" "2"
- // SSP-NOT: "-stack-protector-buffer-size" 
- 
- // RUN: %clang -target i386-unknown-linux -fstack-protector --param 
ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
--// SSP-BUF: "-stack-protector" "1"
-+// SSP-BUF: "-stack-protector" "2"
- // SSP-BUF: "-stack-protector-buffer-size" "16" 
- 
- // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s 
-check-prefix=OPENBSD

Copied: lib32-clang/repos/multilib-x86_64/enable-SSP-and-PIE-by-default.patch 
(from rev 770918, lib32-clang/trunk/enable-SSP-and-PIE-by-default.patch)
===================================================================
--- enable-SSP-and-PIE-by-default.patch                         (rev 0)
+++ enable-SSP-and-PIE-by-default.patch 2020-12-05 19:08:03 UTC (rev 770919)
@@ -0,0 +1,336 @@
+From bb7bdc61f8a80db9aa16370d9c9fd0ae7be825cc Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evange...@foutrelis.com>
+Date: Mon, 12 Oct 2020 16:40:41 +0300
+Subject: [PATCH] Enable SSP and PIE by default
+
+This is a minimal set of changes needed to make clang use SSP and PIE by
+default on Arch Linux. Tests that were easy to adjust have been changed
+accordingly; only test/Driver/linux-ld.c has been marked as "expected
+failure" due to the number of changes it would require (mostly replacing
+crtbegin.o with crtbeginS.o).
+
+Doing so is needed in order to align clang with the new default GCC
+behavior in Arch which generates PIE executables by default and also
+defaults to -fstack-protector-strong. It is not meant to be a long term
+solution, but a simple temporary fix.
+
+Hopefully these changes will be obsoleted by the introduction upstream
+of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
+---
+ clang/lib/Driver/ToolChains/Linux.cpp     | 14 ++++++++++++--
+ clang/lib/Driver/ToolChains/Linux.h       |  1 +
+ clang/test/Driver/cross-linux.c           | 16 ++++++++--------
+ clang/test/Driver/env.c                   |  2 +-
+ clang/test/Driver/fsanitize.c             | 14 +++++++-------
+ clang/test/Driver/gcc-toolchain.cpp       |  2 +-
+ clang/test/Driver/hexagon-toolchain-elf.c |  2 +-
+ clang/test/Driver/linux-as.c              |  4 ++--
+ clang/test/Driver/linux-ld.c              |  2 ++
+ clang/test/Driver/ppc-abi.c               | 16 +++++++++-------
+ clang/test/Driver/riscv32-toolchain.c     |  4 ++--
+ clang/test/Driver/riscv64-toolchain.c     |  4 ++--
+ clang/test/Driver/stack-protector.c       |  4 ++--
+ 13 files changed, 50 insertions(+), 35 deletions(-)
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp 
b/clang/lib/Driver/ToolChains/Linux.cpp
+index 180350476c3..119f32ceec6 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -819,8 +819,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
+ }
+ 
+ bool Linux::isPIEDefault() const {
+-  return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
+-          getTriple().isMusl() || getSanitizerArgs().requiresPIE();
++  const bool IsMips = getTriple().isMIPS();
++  const bool IsAndroid = getTriple().isAndroid();
++
++  if (IsMips || IsAndroid)
++    return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
++            getTriple().isMusl() || getSanitizerArgs().requiresPIE();
++
++  return true;
++}
++
++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
++  return 2;
+ }
+ 
+ bool Linux::isNoExecStackDefault() const {
+diff --git a/clang/lib/Driver/ToolChains/Linux.h 
b/clang/lib/Driver/ToolChains/Linux.h
+index 6b16b0e6499..d0024110aef 100644
+--- a/clang/lib/Driver/ToolChains/Linux.h
++++ b/clang/lib/Driver/ToolChains/Linux.h
+@@ -39,6 +39,7 @@ public:
+   bool isPIEDefault() const override;
+   bool isNoExecStackDefault() const override;
+   bool IsMathErrnoDefault() const override;
++  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
+   SanitizerMask getSupportedSanitizers() const override;
+   void addProfileRTLibs(const llvm::opt::ArgList &Args,
+                         llvm::opt::ArgStringList &CmdArgs) const override;
+diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c
+index 6c2dab26069..c28c5653e34 100644
+--- a/clang/test/Driver/cross-linux.c
++++ b/clang/test/Driver/cross-linux.c
+@@ -42,8 +42,8 @@
+ // CHECK-MULTI32-I386: 
"{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI32-I386: "-m" "elf_i386"
+-// CHECK-MULTI32-I386: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI32-I386: "-L[[gcc_install]]"
++// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o"
++// CHECK-MULTI32-I386: 
"-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]"
+ // CHECK-MULTI32-I386: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32"
+ // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
+ // CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
+@@ -60,8 +60,8 @@
+ // CHECK-MULTI32-X86-64: 
"{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI32-X86-64: "-m" "elf_x86_64"
+-// CHECK-MULTI32-X86-64: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64"
++// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o"
++// CHECK-MULTI32-X86-64: 
"-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64"
+ // CHECK-MULTI32-X86-64: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64"
+ // CHECK-MULTI32-X86-64: "-L[[gcc_install]]"
+ // CHECK-MULTI32-X86-64: 
"-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
+@@ -79,8 +79,8 @@
+ // CHECK-MULTI64-I386: 
"{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI64-I386: "-m" "elf_i386"
+-// CHECK-MULTI64-I386: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI64-I386: "-L[[gcc_install]]/32"
++// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o"
++// CHECK-MULTI64-I386: 
"-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32"
+ // CHECK-MULTI64-I386: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32"
+ // CHECK-MULTI64-I386: "-L[[gcc_install]]"
+ // CHECK-MULTI64-I386: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
+@@ -98,8 +98,8 @@
+ // CHECK-MULTI64-X86-64: 
"{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI64-X86-64: "-m" "elf_x86_64"
+-// CHECK-MULTI64-X86-64: "crti.o" 
"[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI64-X86-64: "-L[[gcc_install]]"
++// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o"
++// CHECK-MULTI64-X86-64: 
"-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]"
+ // CHECK-MULTI64-X86-64: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64"
+ // CHECK-MULTI64-X86-64: 
"-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
+ // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
+diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
+index 0371bc91c4a..ea89f525121 100644
+--- a/clang/test/Driver/env.c
++++ b/clang/test/Driver/env.c
+@@ -20,7 +20,7 @@
+ //
+ // CHECK-LD-32-NOT: warning:
+ // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+-// CHECK-LD-32: 
"{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
++// CHECK-LD-32: "crtbeginS.o"
+ // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+ // CHECK-LD-32: 
"-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+ // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
+index 7340bfb35e4..681bb90b50e 100644
+--- a/clang/test/Driver/fsanitize.c
++++ b/clang/test/Driver/fsanitize.c
+@@ -329,15 +329,15 @@
+ // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr 
-fsanitize=undefined,address %s -### 2>&1
+ // OK
+ 
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIC-NO-PIE
+ // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-PIE
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
+-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-NO-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
++// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-PIE
+ 
+ // CHECK-NO-PIE-NOT: "-pie"
+ // CHECK-NO-PIE: "-mrelocation-model" "static"
+@@ -662,12 +662,12 @@
+ // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s 
-check-prefix=NOSP
+ // NOSP-NOT: "-fsanitize=safe-stack"
+ 
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=NO-SP
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=SP
+ // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP-ASAN
+ // RUN: %clang -target x86_64-linux-gnu -fstack-protector 
-fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
+ // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
+-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
+-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
++// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP
++// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP
+ // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
+ // NO-SP-NOT: stack-protector
+ // NO-SP: "-fsanitize=safe-stack"
+diff --git a/clang/test/Driver/gcc-toolchain.cpp 
b/clang/test/Driver/gcc-toolchain.cpp
+index 6c872f4255c..f5006d1dd9a 100644
+--- a/clang/test/Driver/gcc-toolchain.cpp
++++ b/clang/test/Driver/gcc-toolchain.cpp
+@@ -26,6 +26,6 @@
+ // the same precise formatting of the path as the '-internal-system' flags
+ // above, so we just blanket wildcard match the 'crtbegin.o'.
+ // CHECK: "{{[^"]*}}ld{{(.exe)?}}"
+-// CHECK: 
"{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
++// CHECK: "crtbeginS.o"
+ // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
+ // CHECK: 
"-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
+diff --git a/clang/test/Driver/hexagon-toolchain-elf.c 
b/clang/test/Driver/hexagon-toolchain-elf.c
+index cc11f9fcba9..1fe8b5db587 100644
+--- a/clang/test/Driver/hexagon-toolchain-elf.c
++++ b/clang/test/Driver/hexagon-toolchain-elf.c
+@@ -487,7 +487,7 @@
+ // RUN:   %s 2>&1 \
+ // RUN:   | FileCheck -check-prefix=CHECK042 %s
+ // CHECK042:      "-cc1"
+-// CHECK042:      "-mrelocation-model" "static"
++// CHECK042:      "-mrelocation-model" "pic"
+ // CHECK042:      "-mllvm" "-hexagon-small-data-threshold=8"
+ // CHECK042-NEXT: llvm-mc
+ // CHECK042:      "-gpsize=8"
+diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
+index 0959bd7ba0a..4056a672b6f 100644
+--- a/clang/test/Driver/linux-as.c
++++ b/clang/test/Driver/linux-as.c
+@@ -164,7 +164,7 @@
+ // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
+ //
+ // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
+-// RUN:   -no-integrated-as -c %s 2>&1 \
++// RUN:   -no-integrated-as -fno-pic -c %s 2>&1 \
+ // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9 %s
+ // CHECK-SPARCV9: as
+ // CHECK-SPARCV9: -64
+@@ -173,7 +173,7 @@
+ // CHECK-SPARCV9: -o
+ //
+ // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
+-// RUN:   -no-integrated-as -fpic -c %s 2>&1 \
++// RUN:   -no-integrated-as -c %s 2>&1 \
+ // RUN:   | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
+ // CHECK-SPARCV9PIC: as
+ // CHECK-SPARCV9PIC: -64
+diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
+index ec539522c25..caf96020a15 100644
+--- a/clang/test/Driver/linux-ld.c
++++ b/clang/test/Driver/linux-ld.c
+@@ -1,3 +1,5 @@
++// XFAIL: linux
++
+ // General tests that ld invocations on Linux targets sane. Note that we use
+ // sysroot to make these tests independent of the host system.
+ //
+diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
+index aef8d8576ad..ec595f4cd96 100644
+--- a/clang/test/Driver/ppc-abi.c
++++ b/clang/test/Driver/ppc-abi.c
+@@ -1,9 +1,9 @@
+ // Check passing PowerPC ABI options to the backend.
+ 
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN:   | FileCheck -check-prefix=CHECK-ELFv1 %s
++// RUN:   | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
++// RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+ // RUN:   -mabi=elfv1-qpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+@@ -11,9 +11,9 @@
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+ // RUN:   -mcpu=a2 -mqpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN:   -mcpu=a2q -mno-qpx | FileCheck -check-prefix=CHECK-ELFv1 %s
++// RUN:   -mcpu=a2q -mno-qpx | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE %s
++// RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE-PIE %s
+ 
+ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+ // RUN:   | FileCheck -check-prefix=CHECK-ELFv2 %s
+@@ -33,11 +33,13 @@
+ 
+ // CHECK-ELFv1: "-mrelocation-model" "static"
+ // CHECK-ELFv1: "-target-abi" "elfv1"
+-// CHECK-ELFv1-LE: "-mrelocation-model" "static"
++// CHECK-ELFv1-PIE: "-mrelocation-model" "pic" "-pic-level" "2"
++// CHECK-ELFv1-PIE: "-target-abi" "elfv1"
++// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-LE: "-target-abi" "elfv1"
+-// CHECK-ELFv1-QPX: "-mrelocation-model" "static"
++// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+-// CHECK-ELFv2: "-mrelocation-model" "static"
++// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv2: "-target-abi" "elfv2"
+ // CHECK-ELFv2-BE: "-mrelocation-model" "static"
+ // CHECK-ELFv2-BE: "-target-abi" "elfv2"
+diff --git a/clang/test/Driver/riscv32-toolchain.c 
b/clang/test/Driver/riscv32-toolchain.c
+index b83c9aafcbf..15b6f6496b2 100644
+--- a/clang/test/Driver/riscv32-toolchain.c
++++ b/clang/test/Driver/riscv32-toolchain.c
+@@ -81,7 +81,7 @@
+ // C-RV32-LINUX-MULTI-ILP32: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv"
+ // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" 
"/lib/ld-linux-riscv32-ilp32.so.1"
+-// C-RV32-LINUX-MULTI-ILP32: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o"
++// C-RV32-LINUX-MULTI-ILP32: "crtbeginS.o"
+ // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
+ // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
+ // C-RV32-LINUX-MULTI-ILP32: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
+@@ -96,7 +96,7 @@
+ // C-RV32-LINUX-MULTI-ILP32D: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
+ // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" 
"/lib/ld-linux-riscv32-ilp32d.so.1"
+-// C-RV32-LINUX-MULTI-ILP32D: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o"
++// C-RV32-LINUX-MULTI-ILP32D: "crtbeginS.o"
+ // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
+ // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
+ // C-RV32-LINUX-MULTI-ILP32D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
+diff --git a/clang/test/Driver/riscv64-toolchain.c 
b/clang/test/Driver/riscv64-toolchain.c
+index 5df069eb9fd..2617551ec35 100644
+--- a/clang/test/Driver/riscv64-toolchain.c
++++ b/clang/test/Driver/riscv64-toolchain.c
+@@ -81,7 +81,7 @@
+ // C-RV64-LINUX-MULTI-LP64: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" 
"/lib/ld-linux-riscv64-lp64.so.1"
+-// C-RV64-LINUX-MULTI-LP64: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
+@@ -96,7 +96,7 @@
+ // C-RV64-LINUX-MULTI-LP64D: 
"--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" 
"/lib/ld-linux-riscv64-lp64d.so.1"
+-// C-RV64-LINUX-MULTI-LP64D: 
"{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: 
"-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
+diff --git a/clang/test/Driver/stack-protector.c 
b/clang/test/Driver/stack-protector.c
+index a3e40b50eed..dfffe0d6cf8 100644
+--- a/clang/test/Driver/stack-protector.c
++++ b/clang/test/Driver/stack-protector.c
+@@ -3,11 +3,11 @@
+ // NOSSP-NOT: "-stack-protector-buffer-size" 
+ 
+ // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | 
FileCheck %s -check-prefix=SSP
+-// SSP: "-stack-protector" "1"
++// SSP: "-stack-protector" "2"
+ // SSP-NOT: "-stack-protector-buffer-size" 
+ 
+ // RUN: %clang -target i386-unknown-linux -fstack-protector --param 
ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
+-// SSP-BUF: "-stack-protector" "1"
++// SSP-BUF: "-stack-protector" "2"
+ // SSP-BUF: "-stack-protector-buffer-size" "16" 
+ 
+ // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s 
-check-prefix=OPENBSD

Reply via email to