mirror of
https://abf.rosa.ru/djam/llvm12.git
synced 2025-02-23 15:22:50 +00:00
95 lines
3.5 KiB
Diff
95 lines
3.5 KiB
Diff
diff -Naur cfe-3.9.0.src.orig/lib/Driver/ToolChains.cpp cfe-3.9.0.src/lib/Driver/ToolChains.cpp
|
|
--- cfe-3.9.0.src.orig/lib/Driver/ToolChains.cpp 2016-08-18 20:56:48.000000000 +0300
|
|
+++ cfe-3.9.0.src/lib/Driver/ToolChains.cpp 2016-09-11 16:47:44.240732535 +0300
|
|
@@ -3744,6 +3744,7 @@
|
|
UbuntuVivid,
|
|
UbuntuWily,
|
|
UbuntuXenial,
|
|
+ ROSA,
|
|
UnknownDistro
|
|
};
|
|
|
|
@@ -3761,6 +3762,10 @@
|
|
return Distro >= UbuntuHardy && Distro <= UbuntuXenial;
|
|
}
|
|
|
|
+static bool IsROSA(enum Distro Distro) {
|
|
+ return Distro == ROSA;
|
|
+}
|
|
+
|
|
static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
|
|
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
|
|
llvm::MemoryBuffer::getFile("/etc/lsb-release");
|
|
@@ -3769,7 +3774,10 @@
|
|
SmallVector<StringRef, 16> Lines;
|
|
Data.split(Lines, "\n");
|
|
Distro Version = UnknownDistro;
|
|
- for (StringRef Line : Lines)
|
|
+ for (StringRef Line : Lines) {
|
|
+ if (Version == UnknownDistro && Line.startswith("DISTRIB_ID=Rosa")) {
|
|
+ Version = ROSA;
|
|
+ }
|
|
if (Version == UnknownDistro && Line.startswith("DISTRIB_CODENAME="))
|
|
Version = llvm::StringSwitch<Distro>(Line.substr(17))
|
|
.Case("hardy", UbuntuHardy)
|
|
@@ -3790,6 +3798,7 @@
|
|
.Case("wily", UbuntuWily)
|
|
.Case("xenial", UbuntuXenial)
|
|
.Default(UnknownDistro);
|
|
+ }
|
|
if (Version != UnknownDistro)
|
|
return Version;
|
|
}
|
|
@@ -3950,7 +3959,7 @@
|
|
return TargetTriple.str();
|
|
}
|
|
|
|
-static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
|
|
+static StringRef getOSLibDir(const enum Distro &Distro, const llvm::Triple &Triple, const ArgList &Args) {
|
|
if (isMipsArch(Triple.getArch())) {
|
|
// lib32 directory has a special meaning on MIPS targets.
|
|
// It contains N32 ABI binaries. Use this folder if produce
|
|
@@ -3966,11 +3975,14 @@
|
|
// with a 'lib32' library search path being considered. So we only enable
|
|
// them when we know we may need it.
|
|
//
|
|
+ // ROSA does not use lib32: 64-bit libs go to lib64, 32- bit libs go to lib).
|
|
+ //
|
|
// 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)
|
|
+ if (!IsROSA(Distro) &&
|
|
+ (Triple.getArch() == llvm::Triple::x86 ||
|
|
+ Triple.getArch() == llvm::Triple::ppc))
|
|
return "lib32";
|
|
|
|
if (Triple.getArch() == llvm::Triple::x86_64 &&
|
|
@@ -4012,7 +4024,7 @@
|
|
|
|
Distro Distro = DetectDistro(D, Arch);
|
|
|
|
- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
|
|
+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || IsROSA(Distro)) {
|
|
ExtraOpts.push_back("-z");
|
|
ExtraOpts.push_back("relro");
|
|
}
|
|
@@ -4032,7 +4044,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) || IsROSA(Distro) ||
|
|
(IsUbuntu(Distro) && Distro >= UbuntuMaverick))
|
|
ExtraOpts.push_back("--hash-style=gnu");
|
|
|
|
@@ -4058,7 +4070,7 @@
|
|
// 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.
|