---- llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp.orig 2014-09-16 11:54:43.000000000 +0000
-+++ llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp 2014-09-16 11:53:47.000000000 +0000
-@@ -1091,6 +1091,7 @@
+diff -dur -x '*~' -x '*.orig' -x '*.rej' llvm-3.9.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp llvm-3.9.0.src/tools/clang/lib/Driver/ToolChains.cpp
+--- llvm-3.9.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp 2016-08-18 19:56:48.000000000 +0200
++++ llvm-3.9.0.src/tools/clang/lib/Driver/ToolChains.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-tld-linux",
- "x86_64-linux-gnu",
- "x86_64-unknown-linux-gnu",
- "x86_64-pc-linux-gnu",
-@@ -1103,6 +1104,7 @@
- };
- static const char *const X86LibDirs[] = { "/lib32", "/lib" };
++ "x86_64-tld-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",
+@@ -1507,6 +1508,7 @@
+ static const char *const X32LibDirs[] = {"/libx32"};
+ static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
-+ "i686-tld-linux",
- "i686-linux-gnu",
- "i686-pc-linux-gnu",
- "i486-linux-gnu",
-@@ -1981,6 +1983,7 @@
-
- enum Distro {
++ "i686-tld-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",
+ static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
+@@ -3716,6 +3719,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,
+ TLDLinux,
DebianLenny,
DebianSqueeze,
DebianWheezy,
-@@ -2029,6 +2032,10 @@
- return Distro >= UbuntuHardy && Distro <= UbuntuRaring;
+@@ -3761,6 +3765,10 @@
+ return Distro >= UbuntuHardy && Distro <= UbuntuXenial;
}
+static bool IsTLD(enum Distro Distro) {
+ return Distro == TLDLinux;
+}
+
- static Distro DetectDistro(llvm::Triple::ArchType Arch) {
- OwningPtr<llvm::MemoryBuffer> File;
- if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) {
-@@ -2109,6 +2116,9 @@
- if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
+ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
+ llvm::MemoryBuffer::getFile("/etc/lsb-release");
+@@ -3837,6 +3845,9 @@
+ if (D.getVFS().exists("/etc/arch-release"))
return ArchLinux;
-+ if (!llvm::sys::fs::exists("/etc/tld-release", Exists) && Exists)
++ if (!llvm::sys::fs::exists("/etc/tld-release"))
+ return TLDLinux;
+
return UnknownDistro;
}
-@@ -2224,7 +2234,7 @@
+@@ -4012,7 +4023,7 @@
- Distro Distro = DetectDistro(Arch);
+ Distro Distro = DetectDistro(D, Arch);
-- if (IsOpenSuse(Distro) || IsUbuntu(Distro)) {
-+ if (IsOpenSuse(Distro) || IsUbuntu(Distro) || IsTLD(Distro)) {
+- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
++ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || IsTLD(Distro)) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
-@@ -2244,7 +2254,7 @@
+@@ -4032,7 +4043,7 @@
// ABI requires a mapping between the GOT and the symbol table.
// Android loader does not support .gnu.hash.
if (!IsMips && !IsAndroid) {
-- if (IsRedhat(Distro) || IsOpenSuse(Distro) ||
-+ if (IsRedhat(Distro) || IsOpenSuse(Distro) || IsTLD(Distro) ||
+- if (IsRedhat(Distro) || IsOpenSUSE(Distro) ||
++ if (IsRedhat(Distro) || IsOpenSUSE(Distro) || IsTLD(Distro) ||
(IsUbuntu(Distro) && Distro >= UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
-@@ -2253,11 +2263,11 @@
+@@ -4041,7 +4052,7 @@
ExtraOpts.push_back("--hash-style=both");
}
-- if (IsRedhat(Distro))
-+ if (IsRedhat(Distro) || IsTLD(Distro))
+- if (IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6)
++ if ((IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6) || IsTLD(Distro))
ExtraOpts.push_back("--no-add-needed");
- if (Distro == DebianSqueeze || Distro == DebianWheezy ||
-- Distro == DebianJessie || IsOpenSuse(Distro) ||
-+ Distro == DebianJessie || IsOpenSuse(Distro) || IsTLD(Distro) ||
- (IsRedhat(Distro) && Distro != RHEL4 && Distro != RHEL5) ||
- (IsUbuntu(Distro) && Distro >= UbuntuKarmic))
- ExtraOpts.push_back("--build-id");
+ #ifdef ENABLE_LINKER_BUILD_ID