summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-12-05 17:27:34 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-12-08 18:49:50 +0300
commitde3800437459c8153299ae0e16ef827e8d000049 (patch)
tree0e87e66f8b971e349b35c59c99bc5fa7068c9d86
parent6025f0fe0e2d82448507a88679a3a06853dc769f (diff)
downloadllvm-toolchain-8-de3800437459c8153299ae0e16ef827e8d000049.tar.gz
Add dyson.patch
-rw-r--r--debian/patches/dyson.patch639
-rw-r--r--debian/patches/series1
2 files changed, 640 insertions, 0 deletions
diff --git a/debian/patches/dyson.patch b/debian/patches/dyson.patch
new file mode 100644
index 0000000..4a44596
--- /dev/null
+++ b/debian/patches/dyson.patch
@@ -0,0 +1,639 @@
+Index: llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
+===================================================================
+--- llvm-toolchain-8.git.orig/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
++++ llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
+@@ -107,6 +107,10 @@ extern struct ps_strings *__ps_strings;
+ #define environ _environ
+ #endif
+
++#ifndef O_DIRECTORY
++#define O_DIRECTORY 0
++#endif
++
+ extern char **environ;
+
+ #if SANITIZER_LINUX
+Index: llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc
+===================================================================
+--- llvm-toolchain-8.git.orig/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc
++++ llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc
+@@ -35,6 +35,10 @@
+ #include <sys/resource.h>
+ #include <syslog.h>
+
++#if SANITIZER_SOLARIS
++#include <stdlib.h> // for getexecname()
++#endif
++
+ #if SANITIZER_FREEBSD
+ # if !SANITIZER_KFREEBSD
+ # include <pthread_np.h>
+Index: llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
+===================================================================
+--- llvm-toolchain-8.git.orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
++++ llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc
+@@ -202,7 +202,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi
+ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
+ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
+
+-CHECK_TYPE_SIZE(glob_t);
++//CHECK_TYPE_SIZE(glob_t);
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_offs);
+Index: llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
+===================================================================
+--- llvm-toolchain-8.git.orig/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
++++ llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_solaris.h
+@@ -193,6 +193,8 @@ struct __sanitizer_tm {
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
++ long tm_gmtoff;
++ const char* tm_zone;
+ };
+
+ struct __sanitizer_msghdr {
+Index: llvm-toolchain-8.git/polly/lib/Transform/ScheduleOptimizer.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/polly/lib/Transform/ScheduleOptimizer.cpp
++++ llvm-toolchain-8.git/polly/lib/Transform/ScheduleOptimizer.cpp
+@@ -911,9 +911,9 @@ getMicroKernelParams(const TargetTransfo
+ auto Nvec = RegisterBitwidth / ElementSize;
+ if (Nvec == 0)
+ Nvec = 2;
+- int Nr =
+- ceil(sqrt(Nvec * LatencyVectorFma * ThroughputVectorFma) / Nvec) * Nvec;
+- int Mr = ceil(Nvec * LatencyVectorFma * ThroughputVectorFma / Nr);
++ double _tmp = Nvec * LatencyVectorFma * ThroughputVectorFma;
++ int Nr = ceil(sqrt(_tmp) / Nvec) * Nvec;
++ int Mr = ceil(_tmp / Nr);
+ return {Mr, Nr};
+ }
+
+Index: llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_solaris.cc
+===================================================================
+--- llvm-toolchain-8.git.orig/compiler-rt/lib/sanitizer_common/sanitizer_solaris.cc
++++ llvm-toolchain-8.git/compiler-rt/lib/sanitizer_common/sanitizer_solaris.cc
+@@ -124,6 +124,10 @@ uptr internal_filesize(fd_t fd) {
+ return (uptr)st.st_size;
+ }
+
++DECLARE__REAL_AND_INTERNAL(uptr, dup, int oldfd) {
++ return _REAL(dup)(oldfd);
++}
++
+ DECLARE__REAL_AND_INTERNAL(uptr, dup2, int oldfd, int newfd) {
+ return _REAL(dup2)(oldfd, newfd);
+ }
+Index: llvm-toolchain-8.git/cmake/modules/AddLLVM.cmake
+===================================================================
+--- llvm-toolchain-8.git.orig/cmake/modules/AddLLVM.cmake
++++ llvm-toolchain-8.git/cmake/modules/AddLLVM.cmake
+@@ -200,7 +200,7 @@ function(add_link_opts target_name)
+
+ # Pass -O3 to the linker. This enabled different optimizations on different
+ # linkers.
+- if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|SunOS|AIX" OR WIN32))
++ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX" OR WIN32))
+ set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-O3")
+ endif()
+@@ -218,9 +218,6 @@ function(add_link_opts target_name)
+ # ld64's implementation of -dead_strip breaks tools that use plugins.
+ set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-dead_strip")
+- elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+- set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+- LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections")
+ elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
+ # Object files are compiled with -ffunction-data-sections.
+ # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
+Index: llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Solaris.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/lib/Driver/ToolChains/Solaris.cpp
++++ llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Solaris.cpp
+@@ -15,8 +15,8 @@
+ #include "clang/Driver/DriverDiagnostic.h"
+ #include "clang/Driver/Options.h"
+ #include "llvm/Option/ArgList.h"
+-#include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/Path.h"
++#include "llvm/Support/VirtualFileSystem.h"
+
+ using namespace clang::driver;
+ using namespace clang::driver::tools;
+@@ -24,24 +24,22 @@ using namespace clang::driver::toolchain
+ using namespace clang;
+ using namespace llvm::opt;
+
+-void solaris::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
+- const InputInfo &Output,
+- const InputInfoList &Inputs,
+- const ArgList &Args,
+- const char *LinkingOutput) const {
+- claimNoWarnArgs(Args);
+- ArgStringList CmdArgs;
+-
+- Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
+-
+- CmdArgs.push_back("-o");
+- CmdArgs.push_back(Output.getFilename());
+-
+- for (const auto &II : Inputs)
+- CmdArgs.push_back(II.getFilename());
++static std::string getMultiarchTriple(const Driver &D,
++ const llvm::Triple &TargetTriple) {
++ switch (TargetTriple.getArch()) {
++ default:
++ break;
+
+- const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+- C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
++ case llvm::Triple::x86:
++ if (D.getVFS().exists(D.SysRoot + "/lib/i386-illumos"))
++ return "i386-illumos";
++ break;
++ case llvm::Triple::x86_64:
++ if (D.getVFS().exists(D.SysRoot + "/lib/x86_64-illumos"))
++ return "x86_64-illumos";
++ break;
++ }
++ return TargetTriple.str();
+ }
+
+ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+@@ -49,34 +47,49 @@ void solaris::Linker::ConstructJob(Compi
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+- ArgStringList CmdArgs;
++ const Driver &D = getToolChain().getDriver();
+
+- // Demangle C++ names in errors
+- CmdArgs.push_back("-C");
++ ArgStringList CmdArgs;
+
+- if (!Args.hasArg(options::OPT_nostdlib, options::OPT_shared)) {
+- CmdArgs.push_back("-e");
+- CmdArgs.push_back("_start");
+- }
++ CmdArgs.push_back("--hash-style=both");
++#ifdef ENABLE_LINKER_BUILD_ID
++ CmdArgs.push_back("--build-id");
++#endif
+
+ if (Args.hasArg(options::OPT_static)) {
+- CmdArgs.push_back("-Bstatic");
+- CmdArgs.push_back("-dn");
+- } else {
+- CmdArgs.push_back("-Bdynamic");
+- if (Args.hasArg(options::OPT_shared)) {
+- CmdArgs.push_back("-shared");
+- } else {
+- CmdArgs.push_back("--dynamic-linker");
+- CmdArgs.push_back(
+- Args.MakeArgString(getToolChain().GetFilePath("ld.so.1")));
+- }
+-
+- // libpthread has been folded into libc since Solaris 10, no need to do
+- // anything for pthreads. Claim argument to avoid warning.
+- Args.ClaimAllArgs(options::OPT_pthread);
+- Args.ClaimAllArgs(options::OPT_pthreads);
+- }
++ CmdArgs.push_back("-static");
++ } else if (Args.hasArg(options::OPT_shared)) {
++ CmdArgs.push_back("-shared");
++ }
++
++ if (!D.SysRoot.empty())
++ CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
++
++ if (Args.hasArg(options::OPT_rdynamic))
++ CmdArgs.push_back("-export-dynamic");
++
++ if (Args.hasArg(options::OPT_s))
++ CmdArgs.push_back("-s");
++
++ if (!Args.hasArg(options::OPT_static))
++ CmdArgs.push_back("--eh-frame-hdr");
++
++ // libpthread has been folded into libc since Solaris 10, no need to do
++ // anything for pthreads. Claim argument to avoid warning.
++ Args.ClaimAllArgs(options::OPT_pthread);
++ Args.ClaimAllArgs(options::OPT_pthreads);
++
++ CmdArgs.push_back("-m");
++ switch (getToolChain().getTriple().getArch()) {
++ case llvm::Triple::x86:
++ CmdArgs.push_back("elf_i386_sol2");
++ break;
++ case llvm::Triple::x86_64:
++ CmdArgs.push_back("elf_x86_64_sol2");
++ break;
++ default:
++ llvm_unreachable("Unsupported architecture");
++ }
+
+ if (Output.isFilename()) {
+ CmdArgs.push_back("-o");
+@@ -97,13 +110,6 @@ void solaris::Linker::ConstructJob(Compi
+ Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
+ }
+
+- // Provide __start___sancov_guards. Solaris ld doesn't automatically create
+- // __start_SECNAME labels.
+- CmdArgs.push_back("--whole-archive");
+- CmdArgs.push_back(
+- getToolChain().getCompilerRTArgString(Args, "sancov_begin", false));
+- CmdArgs.push_back("--no-whole-archive");
+-
+ getToolChain().AddFilePathLibArgs(Args, CmdArgs);
+
+ Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
+@@ -132,66 +138,24 @@ void solaris::Linker::ConstructJob(Compi
+ linkSanitizerRuntimeDeps(getToolChain(), CmdArgs);
+ }
+
+- // Provide __stop___sancov_guards. Solaris ld doesn't automatically create
+- // __stop_SECNAME labels.
+- CmdArgs.push_back("--whole-archive");
+- CmdArgs.push_back(
+- getToolChain().getCompilerRTArgString(Args, "sancov_end", false));
+- CmdArgs.push_back("--no-whole-archive");
+-
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+ CmdArgs.push_back(
+ Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
+ }
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
+
++ if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
++ CmdArgs.push_back("--no-demangle");
++
+ getToolChain().addProfileRTLibs(Args, CmdArgs);
+
+ const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
+ }
+
+-static StringRef getSolarisLibSuffix(const llvm::Triple &Triple) {
+- switch (Triple.getArch()) {
+- case llvm::Triple::x86:
+- case llvm::Triple::sparc:
+- break;
+- case llvm::Triple::x86_64:
+- return "/amd64";
+- case llvm::Triple::sparcv9:
+- return "/sparcv9";
+- default:
+- llvm_unreachable("Unsupported architecture");
+- }
+- return "";
+-}
+-
+-/// Solaris - Solaris tool chain which can call as(1) and ld(1) directly.
+-
+ Solaris::Solaris(const Driver &D, const llvm::Triple &Triple,
+ const ArgList &Args)
+- : Generic_ELF(D, Triple, Args) {
+-
+- GCCInstallation.init(Triple, Args);
+-
+- StringRef LibSuffix = getSolarisLibSuffix(Triple);
+- path_list &Paths = getFilePaths();
+- if (GCCInstallation.isValid()) {
+- // On Solaris gcc uses both an architecture-specific path with triple in it
+- // as well as a more generic lib path (+arch suffix).
+- addPathIfExists(D,
+- GCCInstallation.getInstallPath() +
+- GCCInstallation.getMultilib().gccSuffix(),
+- Paths);
+- addPathIfExists(D, GCCInstallation.getParentLibPath() + LibSuffix, Paths);
+- }
+-
+- // If we are currently running Clang inside of the requested system root,
+- // add its parent library path to those searched.
+- if (StringRef(D.Dir).startswith(D.SysRoot))
+- addPathIfExists(D, D.Dir + "/../lib", Paths);
+-
+- addPathIfExists(D, D.SysRoot + "/usr/lib" + LibSuffix, Paths);
++ : Linux(D, Triple, Args) {
+ }
+
+ SanitizerMask Solaris::getSupportedSanitizers() const {
+@@ -206,7 +170,7 @@ SanitizerMask Solaris::getSupportedSanit
+ }
+
+ Tool *Solaris::buildAssembler() const {
+- return new tools::solaris::Assembler(*this);
++ return new tools::gnutools::Assembler(*this);
+ }
+
+ Tool *Solaris::buildLinker() const { return new tools::solaris::Linker(*this); }
+@@ -254,6 +218,32 @@ void Solaris::AddClangSystemIncludeArgs(
+ }
+ }
+
++ const StringRef X86_64MultiarchIncludeDirs[] = {
++ "/usr/include/x86_64-illumos"
++ };
++ const StringRef X86MultiarchIncludeDirs[] = {
++ "/usr/include/i386-illumos"
++ };
++
++ ArrayRef<StringRef> MultiarchIncludeDirs;
++ switch (getTriple().getArch()) {
++ case llvm::Triple::x86_64:
++ MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
++ break;
++ case llvm::Triple::x86:
++ MultiarchIncludeDirs = X86MultiarchIncludeDirs;
++ break;
++ default:
++ break;
++ }
++
++ for (StringRef Dir : MultiarchIncludeDirs) {
++ if (D.getVFS().exists(D.SysRoot + Dir)) {
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + Dir);
++ break;
++ }
++ }
++
+ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include");
+ }
+
+@@ -271,12 +261,14 @@ void Solaris::addLibStdCxxIncludePaths(
+ StringRef LibDir = GCCInstallation.getParentLibPath();
+ StringRef TripleStr = GCCInstallation.getTriple().str();
+ const Multilib &Multilib = GCCInstallation.getMultilib();
++ const std::string GCCMultiarchTriple = getMultiarchTriple( getDriver(), GCCInstallation.getTriple());
++ const std::string TargetMultiarchTriple = getMultiarchTriple(getDriver(), getTriple());
+ const GCCVersion &Version = GCCInstallation.getVersion();
+
+ // The primary search for libstdc++ supports multiarch variants.
+ addLibStdCXXIncludePaths(LibDir.str() + "/../include", "/c++/" + Version.Text,
+ TripleStr,
+- /*GCCMultiarchTriple*/ "",
+- /*TargetMultiarchTriple*/ "",
++ GCCMultiarchTriple,
++ TargetMultiarchTriple,
+ Multilib.includeSuffix(), DriverArgs, CC1Args);
+ }
+Index: llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Solaris.h
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/lib/Driver/ToolChains/Solaris.h
++++ llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Solaris.h
+@@ -10,7 +10,7 @@
+ #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SOLARIS_H
+ #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SOLARIS_H
+
+-#include "Gnu.h"
++#include "Linux.h"
+ #include "clang/Driver/Tool.h"
+ #include "clang/Driver/ToolChain.h"
+
+@@ -18,21 +18,7 @@ namespace clang {
+ namespace driver {
+ namespace tools {
+
+-/// solaris -- Directly call Solaris assembler and linker
+ namespace solaris {
+-class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+-public:
+- Assembler(const ToolChain &TC)
+- : Tool("solaris::Assembler", "assembler", TC) {}
+-
+- bool hasIntegratedCPP() const override { return false; }
+-
+- void ConstructJob(Compilation &C, const JobAction &JA,
+- const InputInfo &Output, const InputInfoList &Inputs,
+- const llvm::opt::ArgList &TCArgs,
+- const char *LinkingOutput) const override;
+-};
+-
+ class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
+ public:
+ Linker(const ToolChain &TC) : Tool("solaris::Linker", "linker", TC) {}
+@@ -50,7 +36,7 @@ public:
+
+ namespace toolchains {
+
+-class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_ELF {
++class LLVM_LIBRARY_VISIBILITY Solaris : public Linux {
+ public:
+ Solaris(const Driver &D, const llvm::Triple &Triple,
+ const llvm::opt::ArgList &Args);
+Index: llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Gnu.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/lib/Driver/ToolChains/Gnu.cpp
++++ llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -1836,36 +1836,7 @@ bool Generic_GCC::GCCInstallationDetecto
+ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+ const llvm::Triple &TargetTriple, SmallVectorImpl<std::string> &Prefixes,
+ StringRef SysRoot) {
+- if (TargetTriple.getOS() == llvm::Triple::Solaris) {
+- // Solaris is a special case.
+- // The GCC installation is under
+- // /usr/gcc/<major>.<minor>/lib/gcc/<triple>/<major>.<minor>.<patch>/
+- // so we need to find those /usr/gcc/*/lib/gcc libdirs and go with
+- // /usr/gcc/<version> as a prefix.
+
+- std::string PrefixDir = SysRoot.str() + "/usr/gcc";
+- std::error_code EC;
+- for (llvm::vfs::directory_iterator LI = D.getVFS().dir_begin(PrefixDir, EC),
+- LE;
+- !EC && LI != LE; LI = LI.increment(EC)) {
+- StringRef VersionText = llvm::sys::path::filename(LI->path());
+- GCCVersion CandidateVersion = GCCVersion::Parse(VersionText);
+-
+- // Filter out obviously bad entries.
+- if (CandidateVersion.Major == -1 || CandidateVersion.isOlderThan(4, 1, 1))
+- continue;
+-
+- std::string CandidatePrefix = PrefixDir + "/" + VersionText.str();
+- std::string CandidateLibPath = CandidatePrefix + "/lib/gcc";
+- if (!D.getVFS().exists(CandidateLibPath))
+- continue;
+-
+- Prefixes.push_back(CandidatePrefix);
+- }
+- return;
+- }
+-
+- // Non-Solaris is much simpler - most systems just go with "/usr".
+ if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
+ // Yet, still look for RHEL devtoolsets.
+ Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
+Index: llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Linux.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/lib/Driver/ToolChains/Linux.cpp
++++ llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -82,12 +82,18 @@ static std::string getMultiarchTriple(co
+ case llvm::Triple::x86:
+ if (IsAndroid)
+ return "i686-linux-android";
++ if (TargetTriple.getOS() == llvm::Triple::Solaris &&
++ D.getVFS().exists(SysRoot + "/lib/i386-illumos"))
++ return "i386-illumos";
+ if (D.getVFS().exists(SysRoot + "/lib/i386-linux-gnu"))
+ return "i386-linux-gnu";
+ break;
+ case llvm::Triple::x86_64:
+ if (IsAndroid)
+ return "x86_64-linux-android";
++ if (TargetTriple.getOS() == llvm::Triple::Solaris &&
++ D.getVFS().exists(SysRoot + "/lib/x86_64-illumos"))
++ return "x86_64-illumos";
+ // We don't want this for x32, otherwise it will match x86_64 libs
+ if (TargetEnvironment != llvm::Triple::GNUX32 &&
+ D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
+Index: llvm-toolchain-8.git/utils/FileCheck/FileCheck.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/utils/FileCheck/FileCheck.cpp
++++ llvm-toolchain-8.git/utils/FileCheck/FileCheck.cpp
+@@ -403,7 +403,7 @@ static void DumpAnnotatedInput(raw_ostre
+ unsigned LineCount = InputFileText.count('\n');
+ if (InputFileEnd[-1] != '\n')
+ ++LineCount;
+- unsigned LineNoWidth = log10(LineCount) + 1;
++ unsigned LineNoWidth = log10((double)LineCount) + 1;
+ // +3 below adds spaces (1) to the left of the (right-aligned) line numbers
+ // on input lines and (2) to the right of the (left-aligned) labels on
+ // annotation lines so that input lines and annotation lines are more
+Index: llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Clang.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/lib/Driver/ToolChains/Clang.cpp
++++ llvm-toolchain-8.git/clang/lib/Driver/ToolChains/Clang.cpp
+@@ -4667,7 +4667,8 @@ void Clang::ConstructJob(Compilation &C,
+ if (!Args.hasFlag(
+ options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
+ !RawTriple.isOSWindows() &&
+- RawTriple.getOS() != llvm::Triple::Solaris &&
++ // https://bugs.llvm.org/show_bug.cgi?id=42182
++ /* RawTriple.getOS() != llvm::Triple::Solaris && */
+ TC.getArch() != llvm::Triple::xcore &&
+ ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
+ RawTriple.hasEnvironment())) ||
+Index: llvm-toolchain-8.git/clang/tools/libclang/CMakeLists.txt
+===================================================================
+--- llvm-toolchain-8.git.orig/clang/tools/libclang/CMakeLists.txt
++++ llvm-toolchain-8.git/clang/tools/libclang/CMakeLists.txt
+@@ -57,10 +57,7 @@ if (TARGET clangTidyPlugin)
+ endif()
+ endif ()
+
+-find_library(DL_LIBRARY_PATH dl)
+-if (DL_LIBRARY_PATH)
+- list(APPEND LIBS dl)
+-endif()
++list(APPEND LIBS m)
+
+ option(LIBCLANG_BUILD_STATIC
+ "Build libclang as a static library (in addition to a shared one)" OFF)
+Index: llvm-toolchain-8.git/libcxx/include/cstdio
+===================================================================
+--- llvm-toolchain-8.git.orig/libcxx/include/cstdio
++++ llvm-toolchain-8.git/libcxx/include/cstdio
+@@ -153,9 +153,6 @@ using ::tmpnam;
+
+ #ifndef _LIBCPP_HAS_NO_STDIN
+ using ::getchar;
+-#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
+-using ::gets;
+-#endif
+ using ::scanf;
+ using ::vscanf;
+ #endif
+Index: llvm-toolchain-8.git/libcxx/include/__locale
+===================================================================
+--- llvm-toolchain-8.git.orig/libcxx/include/__locale
++++ llvm-toolchain-8.git/libcxx/include/__locale
+@@ -26,8 +26,7 @@
+ #elif defined(__ANDROID__)
+ # include <support/android/locale_bionic.h>
+ #elif defined(__sun__)
+-# include <xlocale.h>
+-# include <support/solaris/xlocale.h>
++#include <support/xlocale/__strtonum_fallback.h>
+ #elif defined(_NEWLIB_VERSION)
+ # include <support/newlib/xlocale.h>
+ #elif (defined(__APPLE__) || defined(__FreeBSD__) \
+Index: llvm-toolchain-8.git/libcxx/include/__config
+===================================================================
+--- llvm-toolchain-8.git.orig/libcxx/include/__config
++++ llvm-toolchain-8.git/libcxx/include/__config
+@@ -971,7 +971,7 @@ template <unsigned> struct __static_asse
+ #endif
+
+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
+- defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
++ defined(__NetBSD__) || defined(__CloudABI__)
+ #define _LIBCPP_LOCALE__L_EXTENSIONS 1
+ #endif
+
+Index: llvm-toolchain-8.git/libcxx/src/support/solaris/xlocale.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/libcxx/src/support/solaris/xlocale.cpp
++++ llvm-toolchain-8.git/libcxx/src/support/solaris/xlocale.cpp
+@@ -7,7 +7,7 @@
+ //
+ //===----------------------------------------------------------------------===//
+
+-#ifdef __sun__
++#ifdef __fuck_you__
+
+ #include "support/solaris/xlocale.h"
+ #include <stdarg.h>
+Index: llvm-toolchain-8.git/libcxx/src/filesystem/directory_iterator.cpp
+===================================================================
+--- llvm-toolchain-8.git.orig/libcxx/src/filesystem/directory_iterator.cpp
++++ llvm-toolchain-8.git/libcxx/src/filesystem/directory_iterator.cpp
+@@ -25,36 +25,7 @@ namespace detail {
+ namespace {
+
+ #if !defined(_LIBCPP_WIN32API)
+-template <class DirEntT, class = decltype(DirEntT::d_type)>
+-static file_type get_file_type(DirEntT* ent, int) {
+- switch (ent->d_type) {
+- case DT_BLK:
+- return file_type::block;
+- case DT_CHR:
+- return file_type::character;
+- case DT_DIR:
+- return file_type::directory;
+- case DT_FIFO:
+- return file_type::fifo;
+- case DT_LNK:
+- return file_type::symlink;
+- case DT_REG:
+- return file_type::regular;
+- case DT_SOCK:
+- return file_type::socket;
+- // Unlike in lstat, hitting "unknown" here simply means that the underlying
+- // filesystem doesn't support d_type. Report is as 'none' so we correctly
+- // set the cache to empty.
+- case DT_UNKNOWN:
+- break;
+- }
+- return file_type::none;
+-}
+-
+-template <class DirEntT>
+-static file_type get_file_type(DirEntT* ent, long) {
+- return file_type::none;
+-}
++// Use fstatat(), stupid.
+
+ static pair<string_view, file_type> posix_readdir(DIR* dir_stream,
+ error_code& ec) {
+@@ -66,7 +37,7 @@ static pair<string_view, file_type> posi
+ ec = capture_errno();
+ return {};
+ } else {
+- return {dir_entry_ptr->d_name, get_file_type(dir_entry_ptr, 0)};
++ return {dir_entry_ptr->d_name, file_type::none};
+ }
+ }
+ #else
diff --git a/debian/patches/series b/debian/patches/series
index 29a5446..f67151a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -138,3 +138,4 @@ ubuntu-eoan-distro.patch
# Python 3
0050-Remove-explicit-python-version-list.patch
+dyson.patch