summaryrefslogtreecommitdiff
path: root/Ports/llvm/patches/insert-ifdef-serenity.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Ports/llvm/patches/insert-ifdef-serenity.patch')
-rw-r--r--Ports/llvm/patches/insert-ifdef-serenity.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/Ports/llvm/patches/insert-ifdef-serenity.patch b/Ports/llvm/patches/insert-ifdef-serenity.patch
new file mode 100644
index 0000000000..eb59fc498f
--- /dev/null
+++ b/Ports/llvm/patches/insert-ifdef-serenity.patch
@@ -0,0 +1,109 @@
+diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/SmallVector.cpp llvm-project-llvmorg-12.0.0/llvm/lib/Support/SmallVector.cpp
+--- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/SmallVector.cpp 2021-04-06 19:38:18.000000000 +0300
++++ llvm-project-llvmorg-12.0.0/llvm/lib/Support/SmallVector.cpp 2021-06-09 16:18:35.039546181 +0300
+@@ -132,7 +132,7 @@
+ // Both uint32_t and uint64_t instantiations are needed for 64-bit builds.
+ // This instantiation will never be used in 32-bit builds, and will cause
+ // warnings when sizeof(Size_T) > sizeof(size_t).
+-#if SIZE_MAX > UINT32_MAX
++#if SIZE_MAX > UINT32_MAX && !defined(__serenity__)
+ template class llvm::SmallVectorBase<uint64_t>;
+
+ // Assertions to ensure this #if stays in sync with SmallVectorSizeType.
+diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Path.inc llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Path.inc
+--- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Path.inc 2021-04-06 19:38:18.000000000 +0300
++++ llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Path.inc 2021-06-09 16:24:37.446095863 +0300
+@@ -108,7 +108,7 @@
+ #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
+@@ -524,7 +524,7 @@
+
+ // vmount entry not found; "remote" is the conservative answer.
+ return false;
+-#elif defined(__MVS__)
++#elif defined(__MVS__) || defined(__serenity__)
+ // The file system can have an arbitrary structure on z/OS; must go with the
+ // conservative answer.
+ return false;
+diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Program.inc llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Program.inc
+--- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Program.inc 2021-04-06 19:38:18.000000000 +0300
++++ llvm-project-llvmorg-12.0.0/llvm/lib/Support/Unix/Program.inc 2021-06-10 11:04:28.765989133 +0300
+@@ -335,7 +335,7 @@
+ 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);
+@@ -344,7 +344,7 @@
+ } // namespace sys
+ } // namespace llvm
+
+-#ifdef _AIX
++#if defined(_AIX) || defined(__serenity__)
+ #ifndef _ALL_SOURCE
+ extern "C" pid_t (wait4)(pid_t pid, int *status, int options,
+ struct rusage *usage);
+@@ -357,7 +357,7 @@
+
+ // AIX wait4 does not work well with WNOHANG.
+ if (!(options & WNOHANG))
+- return ::wait4(pid, status, options, usage);
++ return ::waitpid(pid, status, options);
+
+ // For WNOHANG, we use waitid (which supports WNOWAIT) until the child process
+ // has terminated.
+@@ -374,7 +374,7 @@
+ // The child has already terminated, so a blocking wait on it is okay in the
+ // absence of indiscriminate `wait` calls from the current process (which
+ // would cause the call here to fail with ECHILD).
+- return ::wait4(pid, status, options & ~WNOHANG, usage);
++ return ::waitpid(pid, status, options & ~WNOHANG);
+ }
+ #endif
+
+@@ -519,10 +519,10 @@
+
+ bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program,
+ ArrayRef<StringRef> Args) {
+- static long ArgMax = sysconf(_SC_ARG_MAX);
++ static long ArgMax = 4096;
+ // POSIX requires that _POSIX_ARG_MAX is 4096, which is the lowest possible
+ // value for ARG_MAX on a POSIX compliant system.
+- static long ArgMin = _POSIX_ARG_MAX;
++ static long ArgMin = 4096;
+
+ // This the same baseline used by xargs.
+ long EffectiveArgMax = 128 * 1024;
+diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink.cpp llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+--- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink.cpp 2021-04-06 19:38:18.000000000 +0300
++++ llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink.cpp 2021-06-09 19:52:15.384543089 +0300
+@@ -660,7 +660,7 @@
+
+ Expected<std::unique_ptr<TargetProcessControl>>
+ LLVMJITLinkRemoteTargetProcessControl::ConnectToExecutor() {
+-#ifndef LLVM_ON_UNIX
++#if !defined(LLVM_ON_UNIX) || defined(__serenity__)
+ // FIXME: Add TCP support for Windows.
+ return make_error<StringError>("-" + OutOfProcessExecutorConnect.ArgStr +
+ " not supported on non-unix platforms",
+diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
+--- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp 2021-04-06 19:38:18.000000000 +0300
++++ llvm-project-llvmorg-12.0.0/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp 2021-06-09 16:43:06.154952293 +0300
+@@ -45,7 +45,7 @@
+ }
+
+ int openListener(std::string Host, int Port) {
+-#ifndef LLVM_ON_UNIX
++#if !defined(LLVM_ON_UNIX) || defined(__serenity__)
+ // FIXME: Add TCP support for Windows.
+ printErrorAndExit("listen option not supported");
+ return 0;