1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:08:10 +00:00
serenity/Toolchain/Patches/llvm/0002-Triple-Add-triple-for-SerenityOS.patch
Daniel Bertalan 01b31d9858 Toolchain+Ports: Update LLVM to 14.0.1
Besides a version bump, the following changes have been made to our
toolchain infrastructure:
- LLVM/Clang is now built with -march=native if the host compiler
  supports it. An exception to this is CI, as the toolchain cache is
  shared among many different machines there.
- The LLVM tarball is not re-extracted if the hash of the applied
  patches doesn't differ.
- The patches have been split up into atomic chunks.
- Port-specific patches have been integrated into the main patches,
  which will aid in the work towards self-hosting.
- <sysroot>/usr/local/lib is now appended to the linker's search path by
  default.
- --pack-dyn-relocs=relr is appended to the linker command line by
  default, meaning ports take advantage of RELR relocations without any
  patches or additional compiler flags.

The formatting of LLVM port's package.sh has been bothering me, so I
also indented the arguments to the CMake invocation.
2022-04-23 10:43:32 -07:00

59 lines
1.8 KiB
Diff

From 0cf66d1dbcd3b7c0e2ddd65177066955c41352b7 Mon Sep 17 00:00:00 2001
From: Daniel Bertalan <dani@danielbertalan.dev>
Date: Thu, 14 Apr 2022 09:51:24 +0200
Subject: [PATCH 2/8] [Triple] Add triple for SerenityOS
---
llvm/include/llvm/ADT/Triple.h | 8 +++++++-
llvm/lib/Support/Triple.cpp | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 42277c013..b0378dd3a 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -205,7 +205,8 @@ public:
Hurd, // GNU/Hurd
WASI, // Experimental WebAssembly OS
Emscripten,
- LastOSType = Emscripten
+ Serenity,
+ LastOSType = Serenity
};
enum EnvironmentType {
UnknownEnvironment,
@@ -612,6 +613,11 @@ public:
return getOS() == Triple::AIX;
}
+ /// Tests whether the OS is SerenityOS
+ bool isOSSerenity() const {
+ return getOS() == Triple::Serenity;
+ }
+
/// Tests whether the OS uses the ELF binary format.
bool isOSBinFormatELF() const {
return getObjectFormat() == Triple::ELF;
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index a9afcc9db..aef8c7549 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -224,6 +224,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
case PS4: return "ps4";
case RTEMS: return "rtems";
case Solaris: return "solaris";
+ case Serenity: return "serenity";
case TvOS: return "tvos";
case WASI: return "wasi";
case WatchOS: return "watchos";
@@ -548,6 +549,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("hurd", Triple::Hurd)
.StartsWith("wasi", Triple::WASI)
.StartsWith("emscripten", Triple::Emscripten)
+ .StartsWith("serenity", Triple::Serenity)
.Default(Triple::UnknownOS);
}
--
2.35.3