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_64Triples[] = { + "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", @@ -1507,6 +1508,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", "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", @@ -1532,6 +1534,7 @@ 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"}; @@ -1544,14 +1547,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"}; @@ -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, + PLDLinux, DebianLenny, DebianSqueeze, DebianWheezy, @@ -3761,6 +3765,10 @@ return Distro >= UbuntuHardy && Distro <= UbuntuXenial; } +static bool IsPLD(enum Distro Distro) { + return Distro == PLDLinux; +} + static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { llvm::ErrorOr> 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/pld-release")) + return PLDLinux; + return UnknownDistro; } @@ -4012,7 +4023,7 @@ Distro Distro = DetectDistro(D, Arch); - if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { + if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || IsPLD(Distro)) { ExtraOpts.push_back("-z"); ExtraOpts.push_back("relro"); } @@ -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) || IsPLD(Distro) || (IsUbuntu(Distro) && Distro >= UbuntuMaverick)) ExtraOpts.push_back("--hash-style=gnu"); @@ -4041,7 +4052,7 @@ ExtraOpts.push_back("--hash-style=both"); } - if (IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6) + if ((IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6) || IsPLD(Distro)) ExtraOpts.push_back("--no-add-needed"); #ifdef ENABLE_LINKER_BUILD_ID