---- llvm-3.2.src/tools/clang/lib/Driver/ToolChains.cpp.orig 2012-12-16 16:59:27.000000000 +0100
-+++ llvm-3.2.src/tools/clang/lib/Driver/ToolChains.cpp 2013-01-24 12:42:19.582377854 +0100
-@@ -1062,6 +1062,7 @@
+--- llvm-5.0.0.src.orig/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2016-08-18 19:56:48.000000000 +0200
++++ llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2016-11-03 12:18:35.000000000 +0100
+@@ -1498,6 +1498,7 @@
- static const char *const X86_64LibDirs[] = { "/lib64", "/lib" };
+ static const char *const X86_64LibDirs[] = {"/lib64", "/lib"};
static const char *const X86_64Triples[] = {
-+ "x86_64-pld-linux",
- "x86_64-linux-gnu",
- "x86_64-unknown-linux-gnu",
- "x86_64-pc-linux-gnu",
-@@ -1074,6 +1075,9 @@
- };
- static const char *const X86LibDirs[] = { "/lib32", "/lib" };
++ "x86_64-pld-linux", "amd64-pld-linux",
+ "x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
+ "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E",
+ "x86_64-redhat-linux", "x86_64-suse-linux",
+@@ -1558,6 +1559,7 @@
+ static const char *const X32LibDirs[] = {"/libx32"};
+ static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
-+ "i686-pld-linux",
-+ "i586-pld-linux",
-+ "i486-pld-linux",
- "i686-linux-gnu",
- "i686-pc-linux-gnu",
- "i486-linux-gnu",
-@@ -1830,6 +1834,7 @@
++ "i686-pld-linux", "i586-pld-linux", "i486-pld-linux", "i386-pld-linux", "athlon-pld-linux",
+ "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
+ "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
+ "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
+@@ -1591,6 +1593,7 @@
- enum LinuxDistro {
- ArchLinux,
-+ PLDLinux,
- DebianLenny,
- DebianSqueeze,
- DebianWheezy,
-@@ -1877,6 +1882,10 @@
- return Distro >= UbuntuHardy && Distro <= UbuntuRaring;
- }
+ static const char *const PPCLibDirs[] = {"/lib32", "/lib"};
+ static const char *const PPCTriples[] = {
++ "powerpc-pld-linux",
+ "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe",
+ "powerpc-suse-linux", "powerpc-montavista-linuxspe"};
+ static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
+@@ -1603,14 +1606,14 @@
+ "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+
+ static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
+- static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
++ static const char *const SPARCv8Triples[] = {"sparc-pld-linux", "sparc-linux-gnu",
+ "sparcv8-linux-gnu"};
+ static const char *const SPARCv9LibDirs[] = {"/lib64", "/lib"};
+- static const char *const SPARCv9Triples[] = {"sparc64-linux-gnu",
++ static const char *const SPARCv9Triples[] = {"sparc64-pld-linux", "sparc64-linux-gnu",
+ "sparcv9-linux-gnu"};
+
+ static const char *const SystemZLibDirs[] = {"/lib64", "/lib"};
+- static const char *const SystemZTriples[] = {
++ static const char *const SystemZTriples[] = {"s390x-pld-linux",
+ "s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu",
+ "s390x-suse-linux", "s390x-redhat-linux"};
-+static bool IsPLD(enum LinuxDistro Distro) {
-+ return Distro == PLDLinux;
-+}
+--- llvm-5.0.0.src/tools/clang/include/clang/Driver/Distro.h.orig 2017-05-04 14:46:38.000000000 +0200
++++ llvm-5.0.0.src/tools/clang/include/clang/Driver/Distro.h 2017-12-01 22:44:57.785429043 +0100
+@@ -27,6 +27,7 @@
+ // in this enum, because some tests are done by integer comparison against
+ // the first and last known member in the family, e.g. IsRedHat().
+ ArchLinux,
++ PLDLinux,
+ DebianLenny,
+ DebianSqueeze,
+ DebianWheezy,
+@@ -114,6 +115,10 @@
+ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuArtful;
+ }
+
++ bool IsPLD() {
++ return DistroVal == PLDLinux;
++ }
+
- static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
- OwningPtr<llvm::MemoryBuffer> File;
- if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) {
-@@ -1955,6 +1964,9 @@
- if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
- return ArchLinux;
+ /// @}
+ };
+
+--- llvm-5.0.0.src/tools/clang/lib/Driver/Distro.cpp.orig 2017-05-04 14:46:38.000000000 +0200
++++ llvm-5.0.0.src/tools/clang/lib/Driver/Distro.cpp 2017-12-01 22:47:15.155427475 +0100
+@@ -129,6 +129,9 @@
+ if (VFS.exists("/etc/arch-release"))
+ return Distro::ArchLinux;
-+ if (!llvm::sys::fs::exists("/etc/pld-release", Exists) && Exists)
-+ return PLDLinux;
++ if (VFS.exists("/etc/pld-release"))
++ return Distro::PLDLinux;
+
- return UnknownDistro;
+ return Distro::UnknownDistro;
}
-@@ -2072,7 +2084,7 @@
+--- llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Linux.cpp.orig 2017-12-01 22:14:03.462116884 +0100
++++ llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Linux.cpp 2017-12-01 22:51:38.678757801 +0100
+@@ -210,7 +210,7 @@
- LinuxDistro Distro = DetectLinuxDistro(Arch);
+ Distro Distro(D.getVFS());
-- if (IsOpenSuse(Distro) || IsUbuntu(Distro)) {
-+ if (IsOpenSuse(Distro) || IsUbuntu(Distro) || IsPLD(Distro)) {
+- if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
++ if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() || Distro.IsPLD()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
-@@ -2088,7 +2100,7 @@
- // ABI requires a mapping between the GOT and the symbol table.
+@@ -232,7 +232,7 @@
// Android loader does not support .gnu.hash.
- if (!isMipsArch(Arch) && !IsAndroid) {
-- if (IsRedhat(Distro) || IsOpenSuse(Distro) ||
-+ if (IsRedhat(Distro) || IsOpenSuse(Distro) || IsPLD(Distro) ||
- (IsUbuntu(Distro) && Distro >= UbuntuMaverick))
+ // Hexagon linker/loader does not support .gnu.hash
+ if (!IsMips && !IsAndroid && !IsHexagon) {
+- if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
++ if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() || Distro.IsPLD() ||
+ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
-@@ -2097,11 +2109,11 @@
+@@ -241,7 +241,7 @@
ExtraOpts.push_back("--hash-style=both");
}
-- if (IsRedhat(Distro))
-+ if (IsRedhat(Distro) || IsPLD(Distro))
+- if (Distro.IsRedhat() && Distro != Distro::RHEL5 && Distro != Distro::RHEL6)
++ if ((Distro.IsRedhat() && Distro != Distro::RHEL5 && Distro != Distro::RHEL6) || Distro.IsPLD())
ExtraOpts.push_back("--no-add-needed");
- if (Distro == DebianSqueeze || Distro == DebianWheezy ||
-- IsOpenSuse(Distro) ||
-+ IsOpenSuse(Distro) || IsPLD(Distro) ||
- (IsRedhat(Distro) && Distro != RHEL4 && Distro != RHEL5) ||
- (IsUbuntu(Distro) && Distro >= UbuntuKarmic))
- ExtraOpts.push_back("--build-id");
+ #ifdef ENABLE_LINKER_BUILD_ID