mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
566 lines
21 KiB
Diff
566 lines
21 KiB
Diff
diff --git llvm-clean/clang/lib/Basic/Targets/OSTargets.h llvm-workdir/clang/lib/Basic/Targets/OSTargets.h
|
|
index 4366c11..a2f2a26 100644
|
|
--- llvm-clean/clang/lib/Basic/Targets/OSTargets.h
|
|
+++ llvm-workdir/clang/lib/Basic/Targets/OSTargets.h
|
|
@@ -447,6 +447,36 @@ public:
|
|
}
|
|
};
|
|
|
|
+// Astral Target
|
|
+template <typename Target>
|
|
+class LLVM_LIBRARY_VISIBILITY AstralTargetInfo : public OSTargetInfo<Target> {
|
|
+protected:
|
|
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
|
+ MacroBuilder &Builder) const override {
|
|
+ Builder.defineMacro("__astral__");
|
|
+ Builder.defineMacro("__ELF__");
|
|
+ if (Opts.POSIXThreads)
|
|
+ Builder.defineMacro("_REENTRANT");
|
|
+ if (Opts.CPlusPlus)
|
|
+ Builder.defineMacro("_GNU_SOURCE");
|
|
+ if (this->HasFloat128)
|
|
+ Builder.defineMacro("__FLOAT128__");
|
|
+ }
|
|
+
|
|
+public:
|
|
+ AstralTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
|
+ : OSTargetInfo<Target>(Triple, Opts) {
|
|
+ switch (Triple.getArch()) {
|
|
+ default:
|
|
+ break;
|
|
+ case llvm::Triple::x86:
|
|
+ case llvm::Triple::x86_64:
|
|
+ this->HasFloat128 = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+};
|
|
+
|
|
// PS3 PPU Target
|
|
template <typename Target>
|
|
class LLVM_LIBRARY_VISIBILITY PS3PPUTargetInfo : public OSTargetInfo<Target> {
|
|
diff --git llvm-clean/clang/lib/Basic/Targets.cpp llvm-workdir/clang/lib/Basic/Targets.cpp
|
|
index e328351..c67fbc8 100644
|
|
--- llvm-clean/clang/lib/Basic/Targets.cpp
|
|
+++ llvm-workdir/clang/lib/Basic/Targets.cpp
|
|
@@ -174,6 +174,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
|
|
default: // Assume MSVC for unknown environments
|
|
return std::make_unique<MicrosoftARM64TargetInfo>(Triple, Opts);
|
|
}
|
|
+
|
|
+ case llvm::Triple::Astral:
|
|
+ return std::make_unique<AstralTargetInfo<AArch64leTargetInfo>>(Triple,
|
|
+ Opts);
|
|
default:
|
|
return std::make_unique<AArch64leTargetInfo>(Triple, Opts);
|
|
}
|
|
@@ -463,6 +467,10 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
|
|
return std::make_unique<OHOSTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
Opts);
|
|
}
|
|
+
|
|
+ case llvm::Triple::Astral:
|
|
+ return std::make_unique<AstralTargetInfo<RISCV64TargetInfo>>(Triple,
|
|
+ Opts);
|
|
default:
|
|
return std::make_unique<RISCV64TargetInfo>(Triple, Opts);
|
|
}
|
|
@@ -646,6 +654,8 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
|
|
return std::make_unique<PS5OSTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
|
case llvm::Triple::Hurd:
|
|
return std::make_unique<HurdTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
|
+ case llvm::Triple::Astral:
|
|
+ return std::make_unique<AstralTargetInfo<X86_64TargetInfo>>(Triple, Opts);
|
|
default:
|
|
return std::make_unique<X86_64TargetInfo>(Triple, Opts);
|
|
}
|
|
diff --git llvm-clean/clang/lib/Driver/CMakeLists.txt llvm-workdir/clang/lib/Driver/CMakeLists.txt
|
|
index 58427e3..9fd4eb1 100644
|
|
--- llvm-clean/clang/lib/Driver/CMakeLists.txt
|
|
+++ llvm-workdir/clang/lib/Driver/CMakeLists.txt
|
|
@@ -79,6 +79,7 @@ add_clang_library(clangDriver
|
|
ToolChains/SPIRV.cpp
|
|
ToolChains/TCE.cpp
|
|
ToolChains/VEToolchain.cpp
|
|
+ ToolChains/Astral.cpp
|
|
ToolChains/WebAssembly.cpp
|
|
ToolChains/XCore.cpp
|
|
ToolChains/PPCLinux.cpp
|
|
diff --git llvm-clean/clang/lib/Driver/Driver.cpp llvm-workdir/clang/lib/Driver/Driver.cpp
|
|
index 93cddf7..5930d07 100644
|
|
--- llvm-clean/clang/lib/Driver/Driver.cpp
|
|
+++ llvm-workdir/clang/lib/Driver/Driver.cpp
|
|
@@ -46,6 +46,7 @@
|
|
#include "ToolChains/Solaris.h"
|
|
#include "ToolChains/TCE.h"
|
|
#include "ToolChains/VEToolchain.h"
|
|
+#include "ToolChains/Astral.h"
|
|
#include "ToolChains/WebAssembly.h"
|
|
#include "ToolChains/XCore.h"
|
|
#include "ToolChains/ZOS.h"
|
|
@@ -6323,6 +6324,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
|
case llvm::Triple::Hurd:
|
|
TC = std::make_unique<toolchains::Hurd>(*this, Target, Args);
|
|
break;
|
|
+ case llvm::Triple::Astral:
|
|
+ TC = std::make_unique<toolchains::Astral>(*this, Target, Args);
|
|
+ break;
|
|
case llvm::Triple::LiteOS:
|
|
TC = std::make_unique<toolchains::OHOS>(*this, Target, Args);
|
|
break;
|
|
diff --git llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
|
|
index e5e1b1d..5d2d67e 100644
|
|
--- llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp
|
|
+++ llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp
|
|
@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
|
|
return "elf_iamcu";
|
|
return "elf_i386";
|
|
case llvm::Triple::aarch64:
|
|
+ if (T.getOS() == llvm::Triple::Astral)
|
|
+ return "aarch64astral";
|
|
return "aarch64linux";
|
|
case llvm::Triple::aarch64_be:
|
|
return "aarch64linuxb";
|
|
@@ -2452,7 +2454,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
|
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-suse-linux", "aarch64-astral"};
|
|
static const char *const AArch64beLibDirs[] = {"/lib"};
|
|
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
|
|
"aarch64_be-linux-gnu"};
|
|
@@ -2482,7 +2484,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
|
"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-amazon-linux", "x86_64-astral"};
|
|
+
|
|
static const char *const X32Triples[] = {"x86_64-linux-gnux32",
|
|
"x86_64-pc-linux-gnux32"};
|
|
static const char *const X32LibDirs[] = {"/libx32", "/lib"};
|
|
@@ -2558,7 +2561,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
|
|
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
|
|
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
|
|
"riscv64-linux-gnu",
|
|
- "riscv64-unknown-elf"};
|
|
+ "riscv64-unknown-elf",
|
|
+ "riscv64-astral",
|
|
+
|
|
|
|
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
|
|
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
|
|
diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp
|
|
new file mode 100644
|
|
index 0000000..c087c3d
|
|
--- /dev/null
|
|
+++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp
|
|
@@ -0,0 +1,230 @@
|
|
+//===--- Astral.h - Astral ToolChain Implementations --------------*- C++ -*-===//
|
|
+//
|
|
+// The LLVM Compiler Infrastructure
|
|
+//
|
|
+// This file is distributed under the University of Illinois Open Source
|
|
+// License. See LICENSE.TXT for details.
|
|
+//
|
|
+//===----------------------------------------------------------------------===//
|
|
+
|
|
+#include "Astral.h"
|
|
+#include "Arch/ARM.h"
|
|
+#include "Arch/Mips.h"
|
|
+#include "Arch/PPC.h"
|
|
+#include "Arch/RISCV.h"
|
|
+#include "CommonArgs.h"
|
|
+#include "clang/Config/config.h"
|
|
+#include "clang/Driver/Distro.h"
|
|
+#include "clang/Driver/Driver.h"
|
|
+#include "clang/Driver/Options.h"
|
|
+#include "clang/Driver/SanitizerArgs.h"
|
|
+#include "llvm/Option/ArgList.h"
|
|
+#include "llvm/ProfileData/InstrProf.h"
|
|
+#include "llvm/Support/Path.h"
|
|
+#include <system_error>
|
|
+
|
|
+using namespace clang::driver;
|
|
+using namespace clang::driver::toolchains;
|
|
+using namespace clang;
|
|
+using namespace llvm::opt;
|
|
+
|
|
+using tools::addPathIfExists;
|
|
+
|
|
+/// \brief Get our best guess at the multiarch triple for a target.
|
|
+std::string Astral::getMultiarchTriple(const Driver &D,
|
|
+ const llvm::Triple &TargetTriple,
|
|
+ StringRef SysRoot) const {
|
|
+ // For most architectures, just use whatever we have rather than trying to be
|
|
+ // clever.
|
|
+ switch (TargetTriple.getArch()) {
|
|
+ default:
|
|
+ break;
|
|
+
|
|
+ case llvm::Triple::x86_64:
|
|
+ // We don't want this for x32, otherwise it will match x86_64 libs
|
|
+ return "x86_64-astral";
|
|
+ case llvm::Triple::aarch64:
|
|
+ return "aarch64-astral";
|
|
+ case llvm::Triple::riscv64:
|
|
+ return "riscv64-astral";
|
|
+ }
|
|
+ return TargetTriple.str();
|
|
+}
|
|
+
|
|
+static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
|
|
+ // It happens that only x86, PPC and SPARC use the 'lib32' variant of
|
|
+ // oslibdir, and using that variant while targeting other architectures causes
|
|
+ // problems because the libraries are laid out in shared system roots that
|
|
+ // can't cope with a 'lib32' library search path being considered. So we only
|
|
+ // enable them when we know we may need it.
|
|
+ //
|
|
+ // 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.isPPC32() ||
|
|
+ Triple.getArch() == llvm::Triple::sparc)
|
|
+ return "lib32";
|
|
+
|
|
+ if (Triple.getArch() == llvm::Triple::x86_64 && Triple.isX32())
|
|
+ return "libx32";
|
|
+
|
|
+ if (Triple.getArch() == llvm::Triple::riscv32)
|
|
+ return "lib32";
|
|
+
|
|
+ return Triple.isArch32Bit() ? "lib" : "lib64";
|
|
+}
|
|
+
|
|
+Astral::Astral(const Driver &D, const llvm::Triple &Triple,
|
|
+ const ArgList &Args)
|
|
+ : Generic_ELF(D, Triple, Args) {
|
|
+ GCCInstallation.init(Triple, Args);
|
|
+ Multilibs = GCCInstallation.getMultilibs();
|
|
+ SelectedMultilibs.assign({GCCInstallation.getMultilib()});
|
|
+ std::string SysRoot = computeSysRoot();
|
|
+
|
|
+ ToolChain::path_list &PPaths = getProgramPaths();
|
|
+ Generic_GCC::PushPPaths(PPaths);
|
|
+
|
|
+#ifdef ENABLE_LINKER_BUILD_ID
|
|
+ ExtraOpts.push_back("--build-id");
|
|
+#endif
|
|
+
|
|
+ // The selection of paths to try here is designed to match the patterns which
|
|
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
|
|
+ // This was determined by running GCC in a fake filesystem, creating all
|
|
+ // possible permutations of these directories, and seeing which ones it added
|
|
+ // to the link paths.
|
|
+ path_list &Paths = getFilePaths();
|
|
+
|
|
+ const std::string OSLibDir = std::string(getOSLibDir(Triple, Args));
|
|
+ const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
|
|
+
|
|
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
|
|
+
|
|
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
|
|
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
|
|
+ addPathIfExists(D, concat(SysRoot, "/usr/lib/", MultiarchTriple), Paths);
|
|
+ addPathIfExists(D, concat(SysRoot, "/usr/lib/../", OSLibDir), Paths);
|
|
+
|
|
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
|
|
+
|
|
+ addPathIfExists(D, SysRoot + "/lib", Paths);
|
|
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
|
+}
|
|
+
|
|
+bool Astral::HasNativeLLVMSupport() const { return true; }
|
|
+
|
|
+Tool *Astral::buildLinker() const {
|
|
+ return new tools::gnutools::Linker(*this);
|
|
+}
|
|
+
|
|
+Tool *Astral::buildAssembler() const {
|
|
+ return new tools::gnutools::Assembler(*this);
|
|
+}
|
|
+
|
|
+std::string Astral::computeSysRoot() const {
|
|
+ if (!getDriver().SysRoot.empty())
|
|
+ return getDriver().SysRoot;
|
|
+ return std::string();
|
|
+}
|
|
+
|
|
+std::string Astral::getDynamicLinker(const ArgList &Args) const {
|
|
+ switch (getTriple().getArch()) {
|
|
+ case llvm::Triple::aarch64:
|
|
+ return "/lib/aarch64-astral/ld.so";
|
|
+ case llvm::Triple::riscv64: {
|
|
+ StringRef ABIName = tools::riscv::getRISCVABI(Args, getTriple());
|
|
+ return ("/lib/riscv64-astral/ld-riscv64-" + ABIName + ".so").str();
|
|
+ }
|
|
+ case llvm::Triple::x86_64:
|
|
+ return "/usr/lib/ld.so";
|
|
+ default:
|
|
+ llvm_unreachable("unsupported architecture");
|
|
+ }
|
|
+}
|
|
+
|
|
+void Astral::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
|
+ ArgStringList &CC1Args) const {
|
|
+ const Driver &D = getDriver();
|
|
+ std::string SysRoot = computeSysRoot();
|
|
+
|
|
+ if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
|
|
+ return;
|
|
+
|
|
+ if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
|
|
+ return;
|
|
+
|
|
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
|
|
+
|
|
+ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
|
|
+ SmallString<128> P(D.ResourceDir);
|
|
+ llvm::sys::path::append(P, "include");
|
|
+ addSystemInclude(DriverArgs, CC1Args, P);
|
|
+ }
|
|
+
|
|
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc))
|
|
+ return;
|
|
+
|
|
+ // LOCAL_INCLUDE_DIR
|
|
+ addSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/usr/local/include"));
|
|
+ // TOOL_INCLUDE_DIR
|
|
+ AddMultilibIncludeArgs(DriverArgs, CC1Args);
|
|
+
|
|
+ // Check for configure-time C include directories.
|
|
+ StringRef CIncludeDirs(C_INCLUDE_DIRS);
|
|
+ if (CIncludeDirs != "") {
|
|
+ SmallVector<StringRef, 5> dirs;
|
|
+ CIncludeDirs.split(dirs, ":");
|
|
+ for (StringRef dir : dirs) {
|
|
+ StringRef Prefix =
|
|
+ llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : "";
|
|
+ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ // On systems using multiarch and Android, add /usr/include/$triple before
|
|
+ // /usr/include.
|
|
+ std::string MultiarchIncludeDir = getMultiarchTriple(D, getTriple(), SysRoot);
|
|
+ if (!MultiarchIncludeDir.empty() &&
|
|
+ D.getVFS().exists(concat(SysRoot, "/usr/include", MultiarchIncludeDir)))
|
|
+ addExternCSystemInclude(
|
|
+ DriverArgs, CC1Args,
|
|
+ concat(SysRoot, "/usr/include", MultiarchIncludeDir));
|
|
+
|
|
+ // Add an include of '/include' directly. This isn't provided by default by
|
|
+ // system GCCs, but is often used with cross-compiling GCCs, and harmless to
|
|
+ // add even when Clang is acting as-if it were a system compiler.
|
|
+ addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/include"));
|
|
+
|
|
+ addExternCSystemInclude(DriverArgs, CC1Args, concat(SysRoot, "/usr/include"));
|
|
+}
|
|
+
|
|
+void Astral::addLibStdCxxIncludePaths(
|
|
+ const llvm::opt::ArgList &DriverArgs,
|
|
+ llvm::opt::ArgStringList &CC1Args) const {
|
|
+ // We need a detected GCC installation on Astral to provide libstdc++'s
|
|
+ // headers.
|
|
+ if (!GCCInstallation.isValid())
|
|
+ return;
|
|
+
|
|
+ StringRef TripleStr = GCCInstallation.getTriple().str();
|
|
+
|
|
+ // Try generic GCC detection.
|
|
+ Generic_GCC::addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args, TripleStr);
|
|
+}
|
|
+
|
|
+SanitizerMask Astral::getSupportedSanitizers() const {
|
|
+ const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
|
|
+ const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
|
|
+ SanitizerMask Res = ToolChain::getSupportedSanitizers();
|
|
+ Res |= SanitizerKind::PointerCompare;
|
|
+ Res |= SanitizerKind::PointerSubtract;
|
|
+ Res |= SanitizerKind::KernelAddress;
|
|
+ Res |= SanitizerKind::Vptr;
|
|
+ if (IsX86_64)
|
|
+ Res |= SanitizerKind::KernelMemory;
|
|
+ if (IsX86 || IsX86_64)
|
|
+ Res |= SanitizerKind::Function;
|
|
+ return Res;
|
|
+}
|
|
diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.h llvm-workdir/clang/lib/Driver/ToolChains/Astral.h
|
|
new file mode 100644
|
|
index 0000000..d422f8d
|
|
--- /dev/null
|
|
+++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.h
|
|
@@ -0,0 +1,54 @@
|
|
+//===--- Astral.h - Astral ToolChain Implementations --------------*- C++ -*-===//
|
|
+//
|
|
+// The LLVM Compiler Infrastructure
|
|
+//
|
|
+// This file is distributed under the University of Illinois Open Source
|
|
+// License. See LICENSE.TXT for details.
|
|
+//
|
|
+//===----------------------------------------------------------------------===//
|
|
+
|
|
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H
|
|
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H
|
|
+
|
|
+#include "Gnu.h"
|
|
+#include "clang/Driver/ToolChain.h"
|
|
+
|
|
+namespace clang {
|
|
+namespace driver {
|
|
+namespace toolchains {
|
|
+
|
|
+class LLVM_LIBRARY_VISIBILITY Astral : public Generic_ELF {
|
|
+public:
|
|
+ Astral(const Driver &D, const llvm::Triple &Triple,
|
|
+ const llvm::opt::ArgList &Args);
|
|
+
|
|
+ bool HasNativeLLVMSupport() const override;
|
|
+
|
|
+ std::string getMultiarchTriple(const Driver &D,
|
|
+ const llvm::Triple &TargetTriple,
|
|
+ StringRef SysRoot) const override;
|
|
+
|
|
+ void
|
|
+ AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
|
|
+ llvm::opt::ArgStringList &CC1Args) const override;
|
|
+ void
|
|
+ addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
|
+ llvm::opt::ArgStringList &CC1Args) const override;
|
|
+ SanitizerMask getSupportedSanitizers() const override;
|
|
+ virtual std::string computeSysRoot() const override;
|
|
+
|
|
+ virtual std::string
|
|
+ getDynamicLinker(const llvm::opt::ArgList &Args) const override;
|
|
+
|
|
+ std::vector<std::string> ExtraOpts;
|
|
+
|
|
+protected:
|
|
+ Tool *buildAssembler() const override;
|
|
+ Tool *buildLinker() const override;
|
|
+};
|
|
+
|
|
+} // end namespace toolchains
|
|
+} // end namespace driver
|
|
+} // end namespace clang
|
|
+
|
|
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H
|
|
diff --git llvm-clean/llvm/include/llvm/ADT/bit.h llvm-workdir/llvm/include/llvm/ADT/bit.h
|
|
index c42b5e6..5745ec3 100644
|
|
--- llvm-clean/llvm/include/llvm/ADT/bit.h
|
|
+++ llvm-workdir/llvm/include/llvm/ADT/bit.h
|
|
@@ -29,7 +29,7 @@
|
|
|
|
#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || \
|
|
defined(__Fuchsia__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) || \
|
|
- defined(__OpenBSD__) || defined(__DragonFly__)
|
|
+ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__astral__)
|
|
#include <endian.h>
|
|
#elif defined(_AIX)
|
|
#include <sys/machine.h>
|
|
diff --git llvm-clean/llvm/include/llvm/TargetParser/Triple.h llvm-workdir/llvm/include/llvm/TargetParser/Triple.h
|
|
index 49ec8de..17e97e6 100644
|
|
--- llvm-clean/llvm/include/llvm/TargetParser/Triple.h
|
|
+++ llvm-workdir/llvm/include/llvm/TargetParser/Triple.h
|
|
@@ -226,7 +226,8 @@ public:
|
|
LiteOS,
|
|
Serenity,
|
|
Vulkan, // Vulkan SPIR-V
|
|
- LastOSType = Vulkan
|
|
+ Astral,
|
|
+ LastOSType = Astral
|
|
};
|
|
enum EnvironmentType {
|
|
UnknownEnvironment,
|
|
@@ -278,8 +279,9 @@ public:
|
|
Amplification,
|
|
|
|
OpenHOS,
|
|
+ Mlibc,
|
|
|
|
- LastEnvironmentType = OpenHOS
|
|
+ LastEnvironmentType = Mlibc
|
|
};
|
|
enum ObjectFormatType {
|
|
UnknownObjectFormat,
|
|
diff --git llvm-clean/llvm/lib/Support/Unix/Path.inc llvm-workdir/llvm/lib/Support/Unix/Path.inc
|
|
index 9f89d63..fc8db42 100644
|
|
--- llvm-clean/llvm/lib/Support/Unix/Path.inc
|
|
+++ llvm-workdir/llvm/lib/Support/Unix/Path.inc
|
|
@@ -112,7 +112,7 @@ typedef uint_t uint;
|
|
#endif
|
|
|
|
#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || \
|
|
- defined(__MVS__)
|
|
+ defined(__MVS__) || defined(__astral__)
|
|
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
|
|
#else
|
|
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
|
|
@@ -129,7 +129,8 @@ const file_t kInvalidFile = -1;
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
|
defined(__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
|
|
defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
|
|
- (defined(__sun__) && defined(__svr4__) || defined(__HAIKU__))
|
|
+ (defined(__sun__) && defined(__svr4__) || defined(__HAIKU__)) || \
|
|
+ defined(__astral__)
|
|
static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
|
|
struct stat sb;
|
|
char fullpath[PATH_MAX];
|
|
@@ -250,7 +251,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
|
|
// If we don't have procfs mounted, fall back to argv[0]
|
|
if (getprogpath(exe_path, argv0) != NULL)
|
|
return exe_path;
|
|
-#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
|
|
+#elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) || \
|
|
+ defined(__astral__)
|
|
char exe_path[PATH_MAX];
|
|
const char *aPath = "/proc/self/exe";
|
|
if (sys::fs::exists(aPath)) {
|
|
@@ -551,7 +553,7 @@ static bool is_local_impl(struct STATVFS &Vfs) {
|
|
|
|
// vmount entry not found; "remote" is the conservative answer.
|
|
return false;
|
|
-#elif defined(__MVS__)
|
|
+#elif defined(__MVS__) || defined(__astral__)
|
|
// The file system can have an arbitrary structure on z/OS; must go with the
|
|
// conservative answer.
|
|
return false;
|
|
diff --git llvm-clean/llvm/lib/TargetParser/Triple.cpp llvm-workdir/llvm/lib/TargetParser/Triple.cpp
|
|
index 0bbe8a3..fd175c4 100644
|
|
--- llvm-clean/llvm/lib/TargetParser/Triple.cpp
|
|
+++ llvm-workdir/llvm/lib/TargetParser/Triple.cpp
|
|
@@ -276,6 +276,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
|
case LiteOS: return "liteos";
|
|
case XROS: return "xros";
|
|
case Vulkan: return "vulkan";
|
|
+ case Astral: return "astral";
|
|
}
|
|
|
|
llvm_unreachable("Invalid OSType");
|
|
@@ -324,6 +325,7 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
|
|
case Mesh: return "mesh";
|
|
case Amplification: return "amplification";
|
|
case OpenHOS: return "ohos";
|
|
+ case Mlibc: return "mlibc";
|
|
}
|
|
|
|
llvm_unreachable("Invalid EnvironmentType!");
|
|
@@ -648,6 +650,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
|
.StartsWith("liteos", Triple::LiteOS)
|
|
.StartsWith("serenity", Triple::Serenity)
|
|
.StartsWith("vulkan", Triple::Vulkan)
|
|
+ .StartsWith("astral", Triple::Astral)
|
|
.Default(Triple::UnknownOS);
|
|
}
|
|
|
|
@@ -693,6 +696,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
|
|
.StartsWith("mesh", Triple::Mesh)
|
|
.StartsWith("amplification", Triple::Amplification)
|
|
.StartsWith("ohos", Triple::OpenHOS)
|
|
+ .StartsWith("mlibc", Triple::Mlibc)
|
|
.Default(Triple::UnknownEnvironment);
|
|
}
|
|
|