mirror of
https://abf.rosa.ru/djam/llvm.git
synced 2025-02-23 16:22:50 +00:00
back clang-rosa.patch
This commit is contained in:
parent
879c1837ae
commit
fbf99f4c2d
4 changed files with 129 additions and 414 deletions
|
@ -1,207 +0,0 @@
|
|||
diff -up llvm-project-release-10.x/clang/include/clang/Driver/Distro.h.1~ llvm-project-release-10.x/clang/include/clang/Driver/Distro.h
|
||||
--- llvm-project-release-10.x/clang/include/clang/Driver/Distro.h.1~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/clang/include/clang/Driver/Distro.h 2020-02-03 15:55:08.167087633 +0100
|
||||
@@ -67,6 +67,8 @@ public:
|
||||
UbuntuDisco,
|
||||
UbuntuEoan,
|
||||
UbuntuFocal,
|
||||
+ OpenMandriva,
|
||||
+ ROSA,
|
||||
UnknownDistro
|
||||
};
|
||||
|
||||
@@ -131,6 +133,10 @@ public:
|
||||
return DistroVal == Gentoo;
|
||||
}
|
||||
|
||||
+ bool IsMandriva() const {
|
||||
+ return DistroVal == OpenMandriva || DistroVal == ROSA;
|
||||
+ }
|
||||
+
|
||||
/// @}
|
||||
};
|
||||
|
||||
diff -up llvm-project-release-10.x/clang/lib/Driver/Distro.cpp.1~ llvm-project-release-10.x/clang/lib/Driver/Distro.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/Distro.cpp.1~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/Distro.cpp 2020-02-03 15:56:38.882091633 +0100
|
||||
@@ -42,7 +42,7 @@ static Distro::DistroType DetectDistro(l
|
||||
SmallVector<StringRef, 16> Lines;
|
||||
Data.split(Lines, "\n");
|
||||
Distro::DistroType Version = Distro::UnknownDistro;
|
||||
- for (StringRef Line : Lines)
|
||||
+ for (StringRef Line : Lines) {
|
||||
if (Version == Distro::UnknownDistro && Line.startswith("DISTRIB_CODENAME="))
|
||||
Version = llvm::StringSwitch<Distro::DistroType>(Line.substr(17))
|
||||
.Case("hardy", Distro::UbuntuHardy)
|
||||
@@ -71,6 +71,18 @@ static Distro::DistroType DetectDistro(l
|
||||
.Case("eoan", Distro::UbuntuEoan)
|
||||
.Case("focal", Distro::UbuntuFocal)
|
||||
.Default(Distro::UnknownDistro);
|
||||
+
|
||||
+ else if (Version == Distro::UnknownDistro && Line.startswith("DISTRIB_ID=MandrivaLinux"))
|
||||
+ // It's a Mandriva derivate -- will get details
|
||||
+ // from DISTRIB_DESCRIPTION
|
||||
+ Version = Distro::OpenMandriva;
|
||||
+ else if (Version == Distro::OpenMandriva && Line.startswith("DISTRIB_DESCRIPTION=")) {
|
||||
+ if (Line.substr(20).find("ROSA") != StringRef::npos)
|
||||
+ Version = Distro::ROSA;
|
||||
+ else
|
||||
+ Version = Distro::OpenMandriva;
|
||||
+ }
|
||||
+ }
|
||||
if (Version != Distro::UnknownDistro)
|
||||
return Version;
|
||||
}
|
||||
diff -up llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp.1~ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp.1~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp 2020-02-03 15:52:26.515080505 +0100
|
||||
@@ -1997,7 +1997,10 @@ void Generic_GCC::GCCInstallationDetecto
|
||||
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
|
||||
static const char *const AArch64Triples[] = {
|
||||
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
|
||||
- "aarch64-suse-linux", "aarch64-linux-android"};
|
||||
+ "aarch64-suse-linux", "aarch64-linux-android", "aarch64-mandriva-linux-gnu",
|
||||
+ "aarch64-openmandriva-linux-gnu", "aarch64-openmandriva-linux-musl"
|
||||
+ "aarch64-rosa-linux-gnu", "aarch64-rosa-linux-musl"
|
||||
+ };
|
||||
static const char *const AArch64beLibDirs[] = {"/lib"};
|
||||
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
|
||||
"aarch64_be-linux-gnu"};
|
||||
@@ -2008,7 +2011,40 @@ void Generic_GCC::GCCInstallationDetecto
|
||||
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
|
||||
"armv7hl-redhat-linux-gnueabi",
|
||||
"armv6hl-suse-linux-gnueabi",
|
||||
- "armv7hl-suse-linux-gnueabi"};
|
||||
+ "armv7hl-suse-linux-gnueabi"
|
||||
+ "arm-mandriva-linux-gnueabihf",
|
||||
+ "armv7l-mandriva-linux-gnueabihf",
|
||||
+ "armv7hl-mandriva-linux-gnueabihf",
|
||||
+ "armv7hnl-mandriva-linux-gnueabihf",
|
||||
+ "armv8l-mandriva-linux-gnueabihf",
|
||||
+ "armv8hl-mandriva-linux-gnueabihf",
|
||||
+ "armv8hnl-mandriva-linux-gnueabihf",
|
||||
+ "armv8hcnl-mandriva-linux-gnueabihf",
|
||||
+ "arm-mandriva-linux-musleabihf",
|
||||
+ "armv7l-mandriva-linux-musleabihf",
|
||||
+ "armv7hl-mandriva-linux-musleabihf",
|
||||
+ "armv7hnl-mandriva-linux-musleabihf",
|
||||
+ "armv8l-mandriva-linux-musleabihf",
|
||||
+ "armv8hl-mandriva-linux-musleabihf",
|
||||
+ "armv8hnl-mandriva-linux-musleabihf",
|
||||
+ "armv8hcnl-mandriva-linux-musleabihf",
|
||||
+ "arm-openmandriva-linux-gnueabihf",
|
||||
+ "armv7l-openmandriva-linux-gnueabihf",
|
||||
+ "armv7hl-openmandriva-linux-gnueabihf",
|
||||
+ "armv7hnl-openmandriva-linux-gnueabihf",
|
||||
+ "armv8l-openmandriva-linux-gnueabihf",
|
||||
+ "armv8hl-openmandriva-linux-gnueabihf",
|
||||
+ "armv8hnl-openmandriva-linux-gnueabihf",
|
||||
+ "armv8hcnl-openmandriva-linux-gnueabihf",
|
||||
+ "arm-openmandriva-linux-musleabihf",
|
||||
+ "armv7l-openmandriva-linux-musleabihf",
|
||||
+ "armv7hl-openmandriva-linux-musleabihf",
|
||||
+ "armv7hnl-openmandriva-linux-musleabihf",
|
||||
+ "armv8l-openmandriva-linux-musleabihf",
|
||||
+ "armv8hl-openmandriva-linux-musleabihf",
|
||||
+ "armv8hnl-openmandriva-linux-musleabihf",
|
||||
+ "armv8hcnl-openmandriva-linux-musleabihf",
|
||||
+ };
|
||||
static const char *const ARMebLibDirs[] = {"/lib"};
|
||||
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
|
||||
"armeb-linux-androideabi"};
|
||||
@@ -2025,7 +2061,11 @@ void Generic_GCC::GCCInstallationDetecto
|
||||
"x86_64-redhat-linux", "x86_64-suse-linux",
|
||||
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
|
||||
"x86_64-slackware-linux", "x86_64-unknown-linux",
|
||||
- "x86_64-amazon-linux", "x86_64-linux-android"};
|
||||
+ "x86_64-amazon-linux", "x86_64-linux-android"
|
||||
+ "x86_64-mandriva-linux-gnu", "x86_64-mandriva-linux-musl",
|
||||
+ "x86_64-openmandriva-linux-gnu", "x86_64-openmandriva-linux-musl",
|
||||
+ "x86_64-openmandriva-linux-gnux32", "x86_64-openmandriva-linux-muslx32"
|
||||
+ };
|
||||
static const char *const X32LibDirs[] = {"/libx32"};
|
||||
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
|
||||
static const char *const X86Triples[] = {
|
||||
@@ -2034,7 +2074,12 @@ void Generic_GCC::GCCInstallationDetecto
|
||||
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
|
||||
"i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu",
|
||||
"i686-linux-android", "i386-gnu", "i486-gnu",
|
||||
- "i586-gnu", "i686-gnu"};
|
||||
+ "i586-gnu", "i686-gnu"
|
||||
+ "i586-mandriva-linux-gnu", "i586-openmandriva-linux-gnu",
|
||||
+ "i586-mandriva-linux-musl", "i586-openmandriva-linux-musl",
|
||||
+ "i686-mandriva-linux-gnu", "i686-openmandriva-linux-gnu",
|
||||
+ "i686-mandriva-linux-musl", "i686-openmandriva-linux-musl"
|
||||
+ };
|
||||
|
||||
static const char *const MIPSLibDirs[] = {"/lib"};
|
||||
static const char *const MIPSTriples[] = {
|
||||
diff -up llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp.1~ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp.1~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp 2020-02-03 15:52:26.515080505 +0100
|
||||
@@ -166,7 +166,7 @@ std::string Linux::getMultiarchTriple(co
|
||||
return TargetTriple.str();
|
||||
}
|
||||
|
||||
-static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
|
||||
+static StringRef getOSLibDir(const Distro &distro, const llvm::Triple &Triple, const ArgList &Args) {
|
||||
if (Triple.isMIPS()) {
|
||||
if (Triple.isAndroid()) {
|
||||
StringRef CPUName;
|
||||
@@ -194,12 +194,18 @@ static StringRef getOSLibDir(const llvm:
|
||||
// FIXME: This is a bit of a hack. We should really unify this code for
|
||||
// reasoning about oslibdir spellings with the lib dir spellings in the
|
||||
// GCCInstallationDetector, but that is a more significant refactoring.
|
||||
- if (Triple.getArch() == llvm::Triple::x86 ||
|
||||
- Triple.getArch() == llvm::Triple::ppc)
|
||||
+ //
|
||||
+ // lib32 is distro specific -- we don't do it on OpenMandriva, where 64bit
|
||||
+ // goes to lib64 and 32bit goes to lib
|
||||
+
|
||||
+ if (!distro.IsMandriva() &&
|
||||
+ (Triple.getArch() == llvm::Triple::x86 ||
|
||||
+ Triple.getArch() == llvm::Triple::ppc))
|
||||
return "lib32";
|
||||
|
||||
if (Triple.getArch() == llvm::Triple::x86_64 &&
|
||||
- Triple.getEnvironment() == llvm::Triple::GNUX32)
|
||||
+ (Triple.getEnvironment() == llvm::Triple::GNUX32 ||
|
||||
+ Triple.getEnvironment() == llvm::Triple::MuslX32))
|
||||
return "libx32";
|
||||
|
||||
if (Triple.getArch() == llvm::Triple::riscv32)
|
||||
@@ -248,7 +254,7 @@ Linux::Linux(const Driver &D, const llvm
|
||||
}
|
||||
|
||||
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
|
||||
- Triple.isAndroid()) {
|
||||
+ Distro.IsMandriva() || Triple.isAndroid()) {
|
||||
ExtraOpts.push_back("-z");
|
||||
ExtraOpts.push_back("relro");
|
||||
}
|
||||
@@ -289,6 +295,7 @@ Linux::Linux(const Driver &D, const llvm
|
||||
// Hexagon linker/loader does not support .gnu.hash
|
||||
if (!IsMips && !IsHexagon) {
|
||||
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
|
||||
+ Distro.IsMandriva() ||
|
||||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
|
||||
(IsAndroid && !Triple.isAndroidVersionLT(23)))
|
||||
ExtraOpts.push_back("--hash-style=gnu");
|
||||
@@ -304,7 +311,7 @@ Linux::Linux(const Driver &D, const llvm
|
||||
ExtraOpts.push_back("--build-id");
|
||||
#endif
|
||||
|
||||
- if (IsAndroid || Distro.IsOpenSUSE())
|
||||
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsMandriva())
|
||||
ExtraOpts.push_back("--enable-new-dtags");
|
||||
|
||||
// The selection of paths to try here is designed to match the patterns which
|
||||
@@ -314,7 +321,7 @@ Linux::Linux(const Driver &D, const llvm
|
||||
// to the link paths.
|
||||
path_list &Paths = getFilePaths();
|
||||
|
||||
- const std::string OSLibDir = getOSLibDir(Triple, Args);
|
||||
+ const std::string OSLibDir = getOSLibDir(Distro, Triple, Args);
|
||||
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
|
||||
|
||||
// Add the multilib suffixed paths where they are available.
|
122
clang-rosa.patch
Normal file
122
clang-rosa.patch
Normal file
|
@ -0,0 +1,122 @@
|
|||
diff -Naur clang-9.0.1.src-orig/include/clang/Driver/Distro.h clang-9.0.1.src/include/clang/Driver/Distro.h
|
||||
--- clang-9.0.1.src-orig/include/clang/Driver/Distro.h 2019-12-11 22:15:30.000000000 +0300
|
||||
+++ clang-9.0.1.src/include/clang/Driver/Distro.h 2020-02-14 19:46:31.781378040 +0300
|
||||
@@ -38,8 +38,10 @@
|
||||
RHEL5,
|
||||
RHEL6,
|
||||
RHEL7,
|
||||
+ ROSA,
|
||||
Fedora,
|
||||
Gentoo,
|
||||
+ OpenMandriva,
|
||||
OpenSUSE,
|
||||
UbuntuHardy,
|
||||
UbuntuIntrepid,
|
||||
@@ -109,6 +111,10 @@
|
||||
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
|
||||
}
|
||||
|
||||
+ bool IsROSA() {
|
||||
+ return DistroVal == ROSA;
|
||||
+ }
|
||||
+
|
||||
bool IsOpenSUSE() const {
|
||||
return DistroVal == OpenSUSE;
|
||||
}
|
||||
@@ -129,6 +135,9 @@
|
||||
return DistroVal == Gentoo;
|
||||
}
|
||||
|
||||
+ bool IsMandriva() const {
|
||||
+ return DistroVal == OpenMandriva;
|
||||
+ }
|
||||
/// @}
|
||||
};
|
||||
|
||||
diff -Naur clang-9.0.1.src-orig/lib/Driver/Distro.cpp clang-9.0.1.src/lib/Driver/Distro.cpp
|
||||
--- clang-9.0.1.src-orig/lib/Driver/Distro.cpp 2019-12-11 22:15:30.000000000 +0300
|
||||
+++ clang-9.0.1.src/lib/Driver/Distro.cpp 2020-02-14 19:50:25.775772017 +0300
|
||||
@@ -57,6 +57,10 @@
|
||||
return Version;
|
||||
}
|
||||
|
||||
+ File = VFS.getBufferForFile("/etc/rosa-release");
|
||||
+ if (File)
|
||||
+ return Distro::ROSA;
|
||||
+
|
||||
File = VFS.getBufferForFile("/etc/redhat-release");
|
||||
if (File) {
|
||||
StringRef Data = File.get()->getBuffer();
|
||||
diff -Naur clang-9.0.1.src-orig/lib/Driver/ToolChains/Gnu.cpp clang-9.0.1.src/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- clang-9.0.1.src-orig/lib/Driver/ToolChains/Gnu.cpp 2019-12-11 22:15:30.000000000 +0300
|
||||
+++ clang-9.0.1.src/lib/Driver/ToolChains/Gnu.cpp 2020-02-14 19:19:59.341584610 +0300
|
||||
@@ -1927,7 +1927,9 @@
|
||||
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
|
||||
static const char *const AArch64Triples[] = {
|
||||
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
|
||||
- "aarch64-suse-linux", "aarch64-linux-android"};
|
||||
+ "aarch64-suse-linux", "aarch64-linux-android", "aarch64-mandriva-linux-gnu",
|
||||
+ "aarch64-openmandriva-linux-gnu", "aarch64-openmandriva-linux-musl",
|
||||
+ "aarch64-rosa-linux-gnu", "aarch64-rosa-linux-musl"};
|
||||
static const char *const AArch64beLibDirs[] = {"/lib"};
|
||||
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
|
||||
"aarch64_be-linux-gnu"};
|
||||
@@ -1937,6 +1939,8 @@
|
||||
"arm-linux-androideabi"};
|
||||
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
|
||||
"armv7hl-redhat-linux-gnueabi",
|
||||
+ "armv7hl-rosa-linux-gnueabi",
|
||||
+ "armv7hl-openmandriva-linux-gnueabihf",
|
||||
"armv6hl-suse-linux-gnueabi",
|
||||
"armv7hl-suse-linux-gnueabi"};
|
||||
static const char *const ARMebLibDirs[] = {"/lib"};
|
||||
@@ -1955,7 +1959,8 @@
|
||||
"x86_64-redhat-linux", "x86_64-suse-linux",
|
||||
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
|
||||
"x86_64-slackware-linux", "x86_64-unknown-linux",
|
||||
- "x86_64-amazon-linux", "x86_64-linux-android"};
|
||||
+ "x86_64-amazon-linux", "x86_64-linux-android",
|
||||
+ "x86_64-rosa-linux-gnu", "x86_64-openmandriva-linux-gnu"};
|
||||
static const char *const X32LibDirs[] = {"/libx32"};
|
||||
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
|
||||
static const char *const X86Triples[] = {
|
||||
@@ -1964,7 +1969,9 @@
|
||||
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
|
||||
"i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu",
|
||||
"i686-linux-android", "i386-gnu", "i486-gnu",
|
||||
- "i586-gnu", "i686-gnu"};
|
||||
+ "i586-gnu", "i686-gnu", "i586-unknown-linux-gnu",
|
||||
+ "i586-rosa-linux-gnu", "i686-rosa-linux-gnu", "i586-openmandriva-linux-gnu",
|
||||
+ "i686-openmandriva-linux-gnu"};
|
||||
|
||||
static const char *const MIPSLibDirs[] = {"/lib"};
|
||||
static const char *const MIPSTriples[] = {
|
||||
diff -Naur clang-9.0.1.src-orig/lib/Driver/ToolChains/Linux.cpp clang-9.0.1.src/lib/Driver/ToolChains/Linux.cpp
|
||||
--- clang-9.0.1.src-orig/lib/Driver/ToolChains/Linux.cpp 2019-12-11 22:15:30.000000000 +0300
|
||||
+++ clang-9.0.1.src/lib/Driver/ToolChains/Linux.cpp 2020-02-14 19:35:44.855908872 +0300
|
||||
@@ -248,7 +248,7 @@
|
||||
}
|
||||
|
||||
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
|
||||
- Triple.isAndroid()) {
|
||||
+ Distro.IsROSA() || Distro.IsMandriva() || Triple.isAndroid()) {
|
||||
ExtraOpts.push_back("-z");
|
||||
ExtraOpts.push_back("relro");
|
||||
}
|
||||
@@ -289,6 +289,7 @@
|
||||
// Hexagon linker/loader does not support .gnu.hash
|
||||
if (!IsMips && !IsHexagon) {
|
||||
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
|
||||
+ Distro.IsROSA() || Distro.IsMandriva() ||
|
||||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
|
||||
(IsAndroid && !Triple.isAndroidVersionLT(23)))
|
||||
ExtraOpts.push_back("--hash-style=gnu");
|
||||
@@ -304,7 +305,7 @@
|
||||
ExtraOpts.push_back("--build-id");
|
||||
#endif
|
||||
|
||||
- if (IsAndroid || Distro.IsOpenSUSE())
|
||||
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsMandriva() || Distro.IsROSA())
|
||||
ExtraOpts.push_back("--enable-new-dtags");
|
||||
|
||||
// The selection of paths to try here is designed to match the patterns which
|
|
@ -1,193 +0,0 @@
|
|||
diff -up llvm-project-release-10.x/clang/lib/Driver/Driver.cpp.19~ llvm-project-release-10.x/clang/lib/Driver/Driver.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/Driver.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/Driver.cpp 2020-02-03 16:12:47.690134352 +0100
|
||||
@@ -477,14 +477,21 @@ static llvm::Triple computeTargetTriple(
|
||||
AT = Target.get64BitArchVariant().getArch();
|
||||
if (Target.getEnvironment() == llvm::Triple::GNUX32)
|
||||
Target.setEnvironment(llvm::Triple::GNU);
|
||||
+ else if (Target.getEnvironment() == llvm::Triple::MuslX32)
|
||||
+ Target.setEnvironment(llvm::Triple::Musl);
|
||||
} else if (A->getOption().matches(options::OPT_mx32) &&
|
||||
Target.get64BitArchVariant().getArch() == llvm::Triple::x86_64) {
|
||||
AT = llvm::Triple::x86_64;
|
||||
- Target.setEnvironment(llvm::Triple::GNUX32);
|
||||
+ if (Target.getEnvironment() == llvm::Triple::Musl)
|
||||
+ Target.setEnvironment(llvm::Triple::MuslX32);
|
||||
+ else
|
||||
+ Target.setEnvironment(llvm::Triple::GNUX32);
|
||||
} else if (A->getOption().matches(options::OPT_m32)) {
|
||||
AT = Target.get32BitArchVariant().getArch();
|
||||
if (Target.getEnvironment() == llvm::Triple::GNUX32)
|
||||
Target.setEnvironment(llvm::Triple::GNU);
|
||||
+ else if (Target.getEnvironment() == llvm::Triple::MuslX32)
|
||||
+ Target.setEnvironment(llvm::Triple::Musl);
|
||||
} else if (A->getOption().matches(options::OPT_m16) &&
|
||||
Target.get32BitArchVariant().getArch() == llvm::Triple::x86) {
|
||||
AT = llvm::Triple::x86;
|
||||
diff -up llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp.19~ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp.19~ 2020-02-03 16:12:47.683134352 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Gnu.cpp 2020-02-03 16:12:47.690134352 +0100
|
||||
@@ -305,7 +305,7 @@ static const char *getLDMOption(const ll
|
||||
case llvm::Triple::systemz:
|
||||
return "elf64_s390";
|
||||
case llvm::Triple::x86_64:
|
||||
- if (T.getEnvironment() == llvm::Triple::GNUX32)
|
||||
+ if (T.getEnvironment() == llvm::Triple::GNUX32 || T.getEnvironment() == llvm::Triple::MuslX32)
|
||||
return "elf32_x86_64";
|
||||
return "elf_x86_64";
|
||||
default:
|
||||
@@ -681,7 +681,7 @@ void tools::gnutools::Assembler::Constru
|
||||
CmdArgs.push_back("--32");
|
||||
break;
|
||||
case llvm::Triple::x86_64:
|
||||
- if (getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUX32)
|
||||
+ if (getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUX32 || getToolChain().getTriple().getEnvironment() == llvm::Triple::MuslX32)
|
||||
CmdArgs.push_back("--x32");
|
||||
else
|
||||
CmdArgs.push_back("--64");
|
||||
@@ -1668,7 +1668,7 @@ static bool findBiarchMultilibs(const Dr
|
||||
// Determine default multilib from: 32, 64, x32
|
||||
// Also handle cases such as 64 on 32, 32 on 64, etc.
|
||||
enum { UNKNOWN, WANT32, WANT64, WANTX32 } Want = UNKNOWN;
|
||||
- const bool IsX32 = TargetTriple.getEnvironment() == llvm::Triple::GNUX32;
|
||||
+ const bool IsX32 = (TargetTriple.getEnvironment() == llvm::Triple::GNUX32) || (TargetTriple.getEnvironment() == llvm::Triple::MuslX32);
|
||||
if (TargetTriple.isArch32Bit() && !NonExistent(Alt32))
|
||||
Want = WANT64;
|
||||
else if (TargetTriple.isArch64Bit() && IsX32 && !NonExistent(Altx32))
|
||||
@@ -2299,7 +2299,7 @@ void Generic_GCC::GCCInstallationDetecto
|
||||
TripleAliases.append(begin(X86_64Triples), end(X86_64Triples));
|
||||
// x32 is always available when x86_64 is available, so adding it as
|
||||
// secondary arch with x86_64 triples
|
||||
- if (TargetTriple.getEnvironment() == llvm::Triple::GNUX32) {
|
||||
+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUX32 || TargetTriple.getEnvironment() == llvm::Triple::MuslX32) {
|
||||
BiarchLibDirs.append(begin(X32LibDirs), end(X32LibDirs));
|
||||
BiarchTripleAliases.append(begin(X86_64Triples), end(X86_64Triples));
|
||||
} else {
|
||||
diff -up llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp.19~ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
--- llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp.19~ 2020-02-03 16:12:47.673134351 +0100
|
||||
+++ llvm-project-release-10.x/clang/lib/Driver/ToolChains/Linux.cpp 2020-02-03 16:12:47.690134352 +0100
|
||||
@@ -91,6 +91,9 @@ std::string Linux::getMultiarchTriple(co
|
||||
if (TargetEnvironment != llvm::Triple::GNUX32 &&
|
||||
D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
|
||||
return "x86_64-linux-gnu";
|
||||
+ else if (TargetEnvironment == llvm::Triple::GNUX32 &&
|
||||
+ D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnux32"))
|
||||
+ return "x86_64-linux-gnux32";
|
||||
break;
|
||||
case llvm::Triple::aarch64:
|
||||
if (IsAndroid)
|
||||
@@ -639,7 +642,7 @@ std::string Linux::getDynamicLinker(cons
|
||||
Loader = "ld-linux.so.2";
|
||||
break;
|
||||
case llvm::Triple::x86_64: {
|
||||
- bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32;
|
||||
+ bool X32 = (Triple.getEnvironment() == llvm::Triple::GNUX32) || (Triple.getEnvironment() == llvm::Triple::MuslX32);
|
||||
|
||||
LibDir = X32 ? "libx32" : "lib64";
|
||||
Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
|
||||
diff -up llvm-project-release-10.x/include/llvm/ADT/Triple.h.19~ llvm-project-release-10.x/include/llvm/ADT/Triple.h
|
||||
--- llvm-project-release-10.x/include/llvm/ADT/Triple.h.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/include/llvm/ADT/Triple.h 2020-02-03 16:12:47.690134352 +0100
|
||||
@@ -210,6 +210,7 @@ public:
|
||||
Musl,
|
||||
MuslEABI,
|
||||
MuslEABIHF,
|
||||
+ MuslX32,
|
||||
|
||||
MSVC,
|
||||
Itanium,
|
||||
@@ -678,7 +679,8 @@ public:
|
||||
bool isMusl() const {
|
||||
return getEnvironment() == Triple::Musl ||
|
||||
getEnvironment() == Triple::MuslEABI ||
|
||||
- getEnvironment() == Triple::MuslEABIHF;
|
||||
+ getEnvironment() == Triple::MuslEABIHF ||
|
||||
+ getEnvironment() == Triple::MuslX32;
|
||||
}
|
||||
|
||||
/// Tests whether the target is SPIR (32- or 64-bit).
|
||||
diff -up llvm-project-release-10.x/lib/Support/Triple.cpp.19~ llvm-project-release-10.x/lib/Support/Triple.cpp
|
||||
--- llvm-project-release-10.x/lib/Support/Triple.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Support/Triple.cpp 2020-02-03 16:13:35.428136457 +0100
|
||||
@@ -240,6 +240,7 @@ StringRef Triple::getEnvironmentTypeName
|
||||
case Musl: return "musl";
|
||||
case MuslEABI: return "musleabi";
|
||||
case MuslEABIHF: return "musleabihf";
|
||||
+ case MuslX32: return "muslx32";
|
||||
case Simulator: return "simulator";
|
||||
}
|
||||
|
||||
@@ -537,6 +538,7 @@ static Triple::EnvironmentType parseEnvi
|
||||
.StartsWith("android", Triple::Android)
|
||||
.StartsWith("musleabihf", Triple::MuslEABIHF)
|
||||
.StartsWith("musleabi", Triple::MuslEABI)
|
||||
+ .StartsWith("muslx32", Triple::MuslX32)
|
||||
.StartsWith("musl", Triple::Musl)
|
||||
.StartsWith("msvc", Triple::MSVC)
|
||||
.StartsWith("itanium", Triple::Itanium)
|
||||
diff -up llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp.19~ llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
|
||||
--- llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp 2020-02-03 16:12:47.690134352 +0100
|
||||
@@ -1194,7 +1194,7 @@ MCAsmBackend *llvm::createX86_64AsmBacke
|
||||
|
||||
uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS());
|
||||
|
||||
- if (TheTriple.getEnvironment() == Triple::GNUX32)
|
||||
+ if (TheTriple.getEnvironment() == Triple::GNUX32 || TheTriple.getEnvironment() == Triple::MuslX32)
|
||||
return new ELFX86_X32AsmBackend(T, OSABI, STI);
|
||||
return new ELFX86_64AsmBackend(T, OSABI, STI);
|
||||
}
|
||||
diff -up llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp.19~ llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
|
||||
--- llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp 2020-02-03 16:12:47.691134352 +0100
|
||||
@@ -83,7 +83,7 @@ void X86ELFMCAsmInfo::anchor() { }
|
||||
|
||||
X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) {
|
||||
bool is64Bit = T.getArch() == Triple::x86_64;
|
||||
- bool isX32 = T.getEnvironment() == Triple::GNUX32;
|
||||
+ bool isX32 = (T.getEnvironment() == Triple::GNUX32) || (T.getEnvironment() == Triple::MuslX32);
|
||||
|
||||
// For ELF, x86-64 pointer size depends on the ABI.
|
||||
// For x86-64 without the x32 ABI, pointer size is 8. For x86 and for x86-64
|
||||
diff -up llvm-project-release-10.x/lib/Target/X86/X86RegisterInfo.cpp.19~ llvm-project-release-10.x/lib/Target/X86/X86RegisterInfo.cpp
|
||||
--- llvm-project-release-10.x/lib/Target/X86/X86RegisterInfo.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Target/X86/X86RegisterInfo.cpp 2020-02-03 16:12:47.691134352 +0100
|
||||
@@ -60,7 +60,7 @@ X86RegisterInfo::X86RegisterInfo(const T
|
||||
// This matches the simplified 32-bit pointer code in the data layout
|
||||
// computation.
|
||||
// FIXME: Should use the data layout?
|
||||
- bool Use64BitReg = TT.getEnvironment() != Triple::GNUX32;
|
||||
+ bool Use64BitReg = (TT.getEnvironment() != Triple::GNUX32) && (TT.getEnvironment() != Triple::MuslX32);
|
||||
StackPtr = Use64BitReg ? X86::RSP : X86::ESP;
|
||||
FramePtr = Use64BitReg ? X86::RBP : X86::EBP;
|
||||
BasePtr = Use64BitReg ? X86::RBX : X86::EBX;
|
||||
diff -up llvm-project-release-10.x/lib/Target/X86/X86Subtarget.h.19~ llvm-project-release-10.x/lib/Target/X86/X86Subtarget.h
|
||||
--- llvm-project-release-10.x/lib/Target/X86/X86Subtarget.h.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Target/X86/X86Subtarget.h 2020-02-03 16:12:47.691134352 +0100
|
||||
@@ -563,12 +563,14 @@ public:
|
||||
/// Is this x86_64 with the ILP32 programming model (x32 ABI)?
|
||||
bool isTarget64BitILP32() const {
|
||||
return In64BitMode && (TargetTriple.getEnvironment() == Triple::GNUX32 ||
|
||||
+ TargetTriple.getEnvironment() == Triple::MuslX32 ||
|
||||
TargetTriple.isOSNaCl());
|
||||
}
|
||||
|
||||
/// Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
|
||||
bool isTarget64BitLP64() const {
|
||||
return In64BitMode && (TargetTriple.getEnvironment() != Triple::GNUX32 &&
|
||||
+ TargetTriple.getEnvironment() != Triple::MuslX32 &&
|
||||
!TargetTriple.isOSNaCl());
|
||||
}
|
||||
|
||||
diff -up llvm-project-release-10.x/lib/Target/X86/X86TargetMachine.cpp.19~ llvm-project-release-10.x/lib/Target/X86/X86TargetMachine.cpp
|
||||
--- llvm-project-release-10.x/lib/Target/X86/X86TargetMachine.cpp.19~ 2020-02-03 15:05:29.000000000 +0100
|
||||
+++ llvm-project-release-10.x/lib/Target/X86/X86TargetMachine.cpp 2020-02-03 16:12:47.691134352 +0100
|
||||
@@ -114,7 +114,7 @@ static std::string computeDataLayout(con
|
||||
Ret += DataLayout::getManglingComponent(TT);
|
||||
// X86 and x32 have 32 bit pointers.
|
||||
if ((TT.isArch64Bit() &&
|
||||
- (TT.getEnvironment() == Triple::GNUX32 || TT.isOSNaCl())) ||
|
||||
+ (TT.getEnvironment() == Triple::GNUX32 || TT.getEnvironment() == Triple::MuslX32 || TT.isOSNaCl())) ||
|
||||
!TT.isArch64Bit())
|
||||
Ret += "-p:32:32";
|
||||
|
21
llvm.spec
21
llvm.spec
|
@ -33,7 +33,7 @@
|
|||
Summary: Low Level Virtual Machine (LLVM)
|
||||
Name: llvm
|
||||
Version: %{major_ver}.%{minor_ver}
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: NCSA
|
||||
Group: Development/Other
|
||||
Url: http://llvm.org
|
||||
|
@ -55,13 +55,9 @@ Source1000: llvm.rpmlintrc
|
|||
Source1010: clang-gcc-wrapper.macros
|
||||
Source1011: clang-gcc-wrapper.sh
|
||||
|
||||
# (From OpenMandriva)
|
||||
# Teach clang to find directories *-openmandriva-linux-gnu
|
||||
Patch1: 0000-clang-mandriva.patch
|
||||
# Not really needed in ROSA because we do not use Musl,
|
||||
# bit is needed to avoid rediffing the previous patch
|
||||
# s,llvm-project-release-10.x/llvm/,llvm-project-release-10.x/,g
|
||||
Patch2: llvm-5.0-MuslX32.patch
|
||||
# Adjust the search paths to match the OS, adjust the default compiler flags
|
||||
# as well.
|
||||
Patch1: clang-rosa.patch
|
||||
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: bison
|
||||
|
@ -353,14 +349,11 @@ mv clang-%{version}.src tools/clang
|
|||
mv polly-%{version}.src tools/polly
|
||||
mv clang-tools-extra-%{version}.src tools/clang/tools/extra
|
||||
mv compiler-rt-%{version}.src projects/compiler-rt
|
||||
# compatibility with patches from OpenMandriva
|
||||
ln -s tools/clang clang
|
||||
# seems to not work after https://github.com/mirror/patch/commit/7a77ae9
|
||||
ln -s ../%{name}-%{version}.src llvm
|
||||
cd tools/clang
|
||||
%patch1 -p1 -b .rosa~
|
||||
cd -
|
||||
%endif
|
||||
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
%global optflags %{optflags} -fno-strict-aliasing
|
||||
# Build with gcc/g++, not clang if it happens to be installed
|
||||
|
|
Loading…
Add table
Reference in a new issue