1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 16:47:45 +00:00

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.
This commit is contained in:
Daniel Bertalan 2022-04-08 23:28:25 +02:00 committed by Brian Gianforcaro
parent 9a898df1cd
commit 01b31d9858
22 changed files with 664 additions and 1007 deletions

View file

@ -0,0 +1,81 @@
From 9ff3d5362c71dfa9b6aba1dd65a33bb6d8971164 Mon Sep 17 00:00:00 2001
From: Daniel Bertalan <dani@danielbertalan.dev>
Date: Thu, 14 Apr 2022 09:54:22 +0200
Subject: [PATCH 1/8] [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 e8612ba66..f0109f4b3 100644
--- a/llvm/include/llvm/Support/SwapByteOrder.h
+++ b/llvm/include/llvm/Support/SwapByteOrder.h
@@ -22,7 +22,7 @@
#endif
#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 788460d65..566628935 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
@@ -512,6 +512,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
StringRef fstype(Vfs.f_basetype);
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 089342030..3ffe064e5 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -336,7 +336,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);
@@ -379,6 +379,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, unsigned SecondsToWait,
bool WaitUntilTerminates, std::string *ErrMsg,
Optional<ProcessStatistics> *ProcStat) {
--
2.35.3