forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ports/zig: Copy LLVM patches instead of symlinking them
LLVM toolchain is about to get updated to 18.1.3, which would desync these patches.
- Loading branch information
1 parent
bee7070
commit 3bd1305
Showing
9 changed files
with
923 additions
and
9 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
Ports/zig/patches/0001-Support-Add-support-for-building-LLVM-on-SerenityOS.patch
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
Ports/zig/patches/0001-Support-Add-support-for-building-LLVM-on-SerenityOS.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Bertalan <[email protected]> | ||
Date: Thu, 14 Apr 2022 09:54:22 +0200 | ||
Subject: [PATCH] [Support] Add support for building LLVM on SerenityOS | ||
|
||
Adds SerenityOS `#ifdef`s for platform-specific code. | ||
|
||
We stub out wait4, as SerenityOS doesn't support querying a child | ||
process's resource usage information. | ||
--- | ||
llvm/include/llvm/Support/SwapByteOrder.h | 2 +- | ||
llvm/lib/Support/Unix/Path.inc | 5 ++++- | ||
llvm/lib/Support/Unix/Program.inc | 9 ++++++++- | ||
3 files changed, 13 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/llvm/include/llvm/Support/SwapByteOrder.h b/llvm/include/llvm/Support/SwapByteOrder.h | ||
index 9dd08665b..8915f92e8 100644 | ||
--- a/llvm/include/llvm/Support/SwapByteOrder.h | ||
+++ b/llvm/include/llvm/Support/SwapByteOrder.h | ||
@@ -20,7 +20,7 @@ | ||
#include <type_traits> | ||
|
||
#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || \ | ||
- defined(__Fuchsia__) || defined(__EMSCRIPTEN__) | ||
+ defined(__Fuchsia__) || defined(__EMSCRIPTEN__) || defined(__serenity__) | ||
#include <endian.h> | ||
#elif defined(_AIX) | ||
#include <sys/machine.h> | ||
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc | ||
index 3efcad4f2..4f83d0e76 100644 | ||
--- a/llvm/lib/Support/Unix/Path.inc | ||
+++ b/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(__serenity__) | ||
#define STATVFS_F_FLAG(vfs) (vfs).f_flag | ||
#else | ||
#define STATVFS_F_FLAG(vfs) (vfs).f_flags | ||
@@ -506,6 +506,9 @@ static bool is_local_impl(struct STATVFS &Vfs) { | ||
#elif defined(__HAIKU__) | ||
// Haiku doesn't expose this information. | ||
return false; | ||
+#elif defined(__serenity__) | ||
+ // Serenity doesn't yet support remote filesystem mounts. | ||
+ return false; | ||
#elif defined(__sun) | ||
// statvfs::f_basetype contains a null-terminated FSType name of the mounted | ||
// target | ||
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc | ||
index 897e22711..23965a1a1 100644 | ||
--- a/llvm/lib/Support/Unix/Program.inc | ||
+++ b/llvm/lib/Support/Unix/Program.inc | ||
@@ -340,7 +340,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, | ||
namespace llvm { | ||
namespace sys { | ||
|
||
-#ifndef _AIX | ||
+#if !defined(_AIX) && !defined(__serenity__) | ||
using ::wait4; | ||
#else | ||
static pid_t(wait4)(pid_t pid, int *status, int options, struct rusage *usage); | ||
@@ -383,6 +383,13 @@ pid_t(llvm::sys::wait4)(pid_t pid, int *status, int options, | ||
} | ||
#endif | ||
|
||
+#ifdef __serenity__ | ||
+pid_t (llvm::sys::wait4)(pid_t pid, int *status, int options, | ||
+ struct rusage*) { | ||
+ return ::waitpid(pid, status, options); | ||
+} | ||
+#endif | ||
+ | ||
ProcessInfo llvm::sys::Wait(const ProcessInfo &PI, | ||
std::optional<unsigned> SecondsToWait, | ||
std::string *ErrMsg, |
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
Ports/zig/patches/0002-Triple-Add-triple-for-SerenityOS.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Bertalan <[email protected]> | ||
Date: Thu, 14 Apr 2022 09:51:24 +0200 | ||
Subject: [PATCH] [Triple] Add triple for SerenityOS | ||
|
||
--- | ||
llvm/include/llvm/TargetParser/Triple.h | 8 +++++++- | ||
llvm/lib/TargetParser/Triple.cpp | 2 ++ | ||
2 files changed, 9 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h | ||
index 59513fa2f..951d69010 100644 | ||
--- a/llvm/include/llvm/TargetParser/Triple.h | ||
+++ b/llvm/include/llvm/TargetParser/Triple.h | ||
@@ -223,7 +223,8 @@ public: | ||
WASI, // Experimental WebAssembly OS | ||
Emscripten, | ||
ShaderModel, // DirectX ShaderModel | ||
- LastOSType = ShaderModel | ||
+ Serenity, | ||
+ LastOSType = Serenity | ||
}; | ||
enum EnvironmentType { | ||
UnknownEnvironment, | ||
@@ -670,6 +671,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/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp | ||
index a68035989..1ee9ea3b1 100644 | ||
--- a/llvm/lib/TargetParser/Triple.cpp | ||
+++ b/llvm/lib/TargetParser/Triple.cpp | ||
@@ -237,6 +237,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { | ||
case PS5: return "ps5"; | ||
case RTEMS: return "rtems"; | ||
case Solaris: return "solaris"; | ||
+ case Serenity: return "serenity"; | ||
case TvOS: return "tvos"; | ||
case WASI: return "wasi"; | ||
case WatchOS: return "watchos"; | ||
@@ -596,6 +597,7 @@ static Triple::OSType parseOS(StringRef OSName) { | ||
.StartsWith("wasi", Triple::WASI) | ||
.StartsWith("emscripten", Triple::Emscripten) | ||
.StartsWith("shadermodel", Triple::ShaderModel) | ||
+ .StartsWith("serenity", Triple::Serenity) | ||
.Default(Triple::UnknownOS); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.