Skip to content

Commit 915cc97

Browse files
committed
Toolchain: Update LLVM to 20.1.0
Recently, LLVM refactored the way locale support is implemented, which means that the old way in which we stubbed that out no longer works, as the base implementations now expects far greater locale support than what we have. To work around that, we now use the same built-in locale implementation as z/OS does, which appears to work with fairly minimal changes.
1 parent ad83459 commit 915cc97

9 files changed

+164
-105
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ endif()
1818

1919
# Check for toolchain mismatch, user might need to rebuild toolchain
2020
set(GCC_VERSION "13.2.0")
21-
set(LLVM_VERSION "19.1.0")
21+
set(LLVM_VERSION "20.1.0")
2222
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2323
set(EXPECTED_COMPILER_VERSION "${GCC_VERSION}")
2424
else()

Ports/AvailablePorts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
192192
| [`libzip`](libzip/) | libzip | 1.10.1 | https://libzip.org/ |
193193
| [`links`](links/) | Links web browser | 2.29 | http://links.twibright.com/ |
194194
| [`lite-xl`](lite-xl/) | Lite-XL | 2.1.3 | https://lite-xl.com/ |
195-
| [`llvm`](llvm/) | LLVM | 19.1.0 | https://llvm.org/ |
195+
| [`llvm`](llvm/) | LLVM | 20.1.0 | https://llvm.org/ |
196196
| [`lolcat`](lolcat/) | lolcat | 1212a9c | https://github.com/jaseg/lolcat/ |
197197
| [`lowdown`](lowdown/) | lowdown | 1.0.2 | https://kristaps.bsd.lv/lowdown/ |
198198
| [`lrzip`](lrzip/) | lrzip | 0.651 | https://github.com/ckolivas/lrzip |

Ports/llvm/package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env -S bash ../.port_include.sh
22
port='llvm'
33
useconfigure='true'
4-
version='19.1.0'
4+
version='20.1.0'
55
workdir="llvm-project-${version}.src"
66
configopts=(
77
"-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt"

Toolchain/BuildClang.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ echo PREFIX is "$PREFIX"
6464

6565
mkdir -p "$DIR/Tarballs"
6666

67-
LLVM_VERSION="19.1.0"
68-
LLVM_MD5SUM="cfecaf29f50dce67836d32ca6b927e1d"
67+
LLVM_VERSION="20.1.0"
68+
LLVM_MD5SUM="6d38445b43b3d347daee0423e23bbeec"
6969
LLVM_NAME="llvm-project-$LLVM_VERSION.src"
7070
LLVM_PKG="$LLVM_NAME.tar.xz"
7171
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PKG"

Toolchain/Patches/llvm/0001-clang-Add-support-for-SerenityOS.patch

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ Co-authored-by: Dan Klishch <danilklishch@gmail.com>
4343
create mode 100644 clang/test/Driver/serenity.cpp
4444

4545
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
46-
index 29133f9ee8fc..a2c48ce382f2 100644
46+
index 281aebdb1c35..c9da76cae09b 100644
4747
--- a/clang/lib/Basic/Targets.cpp
4848
+++ b/clang/lib/Basic/Targets.cpp
49-
@@ -166,6 +166,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
49+
@@ -170,6 +170,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
5050
case llvm::Triple::OpenBSD:
5151
return std::make_unique<OpenBSDTargetInfo<AArch64leTargetInfo>>(Triple,
5252
Opts);
@@ -56,7 +56,7 @@ index 29133f9ee8fc..a2c48ce382f2 100644
5656
case llvm::Triple::Win32:
5757
switch (Triple.getEnvironment()) {
5858
case llvm::Triple::GNU:
59-
@@ -463,6 +466,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
59+
@@ -466,6 +469,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
6060
return std::make_unique<OHOSTargetInfo<RISCV64TargetInfo>>(Triple,
6161
Opts);
6262
}
@@ -66,7 +66,7 @@ index 29133f9ee8fc..a2c48ce382f2 100644
6666
default:
6767
return std::make_unique<RISCV64TargetInfo>(Triple, Opts);
6868
}
69-
@@ -586,6 +592,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
69+
@@ -591,6 +597,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
7070
return std::make_unique<MCUX86_32TargetInfo>(Triple, Opts);
7171
case llvm::Triple::Hurd:
7272
return std::make_unique<HurdTargetInfo<X86_32TargetInfo>>(Triple, Opts);
@@ -76,7 +76,7 @@ index 29133f9ee8fc..a2c48ce382f2 100644
7676
default:
7777
return std::make_unique<X86_32TargetInfo>(Triple, Opts);
7878
}
79-
@@ -646,6 +655,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
79+
@@ -654,6 +663,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
8080
return std::make_unique<PS5OSTargetInfo<X86_64TargetInfo>>(Triple, Opts);
8181
case llvm::Triple::Hurd:
8282
return std::make_unique<HurdTargetInfo<X86_64TargetInfo>>(Triple, Opts);
@@ -87,10 +87,10 @@ index 29133f9ee8fc..a2c48ce382f2 100644
8787
return std::make_unique<X86_64TargetInfo>(Triple, Opts);
8888
}
8989
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
90-
index 5f27c3469f86..854fd14cb39b 100644
90+
index 991efd2bde01..0b67528245fd 100644
9191
--- a/clang/lib/Basic/Targets/OSTargets.h
9292
+++ b/clang/lib/Basic/Targets/OSTargets.h
93-
@@ -1001,6 +1001,23 @@ public:
93+
@@ -1040,6 +1040,23 @@ public:
9494
}
9595
};
9696

@@ -115,7 +115,7 @@ index 5f27c3469f86..854fd14cb39b 100644
115115
} // namespace clang
116116
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H
117117
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
118-
index 32a4378ab499..7aab8da3b0e4 100644
118+
index 5bdb6614389c..0b147a4754db 100644
119119
--- a/clang/lib/Driver/CMakeLists.txt
120120
+++ b/clang/lib/Driver/CMakeLists.txt
121121
@@ -75,6 +75,7 @@ add_clang_library(clangDriver
@@ -125,20 +125,20 @@ index 32a4378ab499..7aab8da3b0e4 100644
125125
+ ToolChains/Serenity.cpp
126126
ToolChains/Solaris.cpp
127127
ToolChains/SPIRV.cpp
128-
ToolChains/TCE.cpp
128+
ToolChains/SPIRVOpenMP.cpp
129129
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
130-
index 8e44d5afa40e..1cea1f1138d1 100644
130+
index 87855fdb7997..2549f5940ff4 100644
131131
--- a/clang/lib/Driver/Driver.cpp
132132
+++ b/clang/lib/Driver/Driver.cpp
133-
@@ -43,6 +43,7 @@
134-
#include "ToolChains/PS4CPU.h"
135-
#include "ToolChains/RISCVToolchain.h"
133+
@@ -45,6 +45,7 @@
136134
#include "ToolChains/SPIRV.h"
135+
#include "ToolChains/SPIRVOpenMP.h"
136+
#include "ToolChains/SYCL.h"
137137
+#include "ToolChains/Serenity.h"
138138
#include "ToolChains/Solaris.h"
139139
#include "ToolChains/TCE.h"
140-
#include "ToolChains/VEToolchain.h"
141-
@@ -6398,6 +6399,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
140+
#include "ToolChains/UEFI.h"
141+
@@ -6663,6 +6664,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
142142
case llvm::Triple::Fuchsia:
143143
TC = std::make_unique<toolchains::Fuchsia>(*this, Target, Args);
144144
break;
@@ -149,10 +149,10 @@ index 8e44d5afa40e..1cea1f1138d1 100644
149149
TC = std::make_unique<toolchains::Solaris>(*this, Target, Args);
150150
break;
151151
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
152-
index 20a555afb809..0f9c4694e7c7 100644
152+
index acf9d264d631..5653b07368c4 100644
153153
--- a/clang/lib/Driver/ToolChain.cpp
154154
+++ b/clang/lib/Driver/ToolChain.cpp
155-
@@ -613,6 +613,8 @@ StringRef ToolChain::getOSLibName() const {
155+
@@ -702,6 +702,8 @@ StringRef ToolChain::getOSLibName() const {
156156
return "sunos";
157157
case llvm::Triple::AIX:
158158
return "aix";
@@ -161,7 +161,7 @@ index 20a555afb809..0f9c4694e7c7 100644
161161
default:
162162
return getOS();
163163
}
164-
@@ -1128,7 +1130,8 @@ ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
164+
@@ -1225,7 +1227,8 @@ ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
165165
else if (LibName == "platform" || LibName == "") {
166166
ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args);
167167
if (RtLibType == ToolChain::RLT_CompilerRT) {
@@ -476,17 +476,17 @@ index 000000000000..2a1f685cb662
476476
+
477477
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_SERENITY_H
478478
diff --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
479-
index 2218db15013d..36a6cd6425dd 100644
479+
index bb2a21356fa8..6a8922661285 100644
480480
--- a/clang/lib/Lex/InitHeaderSearch.cpp
481481
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
482-
@@ -304,6 +304,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
482+
@@ -300,6 +300,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
483483
case llvm::Triple::PS4:
484484
case llvm::Triple::PS5:
485485
case llvm::Triple::RTEMS:
486486
+ case llvm::Triple::Serenity:
487487
case llvm::Triple::Solaris:
488+
case llvm::Triple::UEFI:
488489
case llvm::Triple::WASI:
489-
case llvm::Triple::ZOS:
490490
diff --git a/clang/test/Driver/Inputs/serenity_x86_64_tree/usr/include/c++/v1/.keep b/clang/test/Driver/Inputs/serenity_x86_64_tree/usr/include/c++/v1/.keep
491491
new file mode 100644
492492
index 000000000000..e69de29bb2d1

Toolchain/Patches/llvm/0002-llvm-Add-support-for-building-LLVM-on-SerenityOS.patch

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Co-Authored-By: Tim Schumacher <timschumi@gmx.de>
2525
6 files changed, 20 insertions(+), 5 deletions(-)
2626

2727
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
28-
index 5ca580fbb59c..a7fe41b0ab06 100644
28+
index 5db06ccdadbe..e82cda307ddf 100644
2929
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
3030
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
31-
@@ -534,6 +534,9 @@ elseif(MINGW OR CYGWIN)
31+
@@ -550,6 +550,9 @@ elseif(MINGW OR CYGWIN)
3232
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
3333
append("-Wa,-mbig-obj" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
3434
endif()
@@ -52,10 +52,10 @@ index c42b5e686bdc..ad4ad534f40c 100644
5252
#elif defined(_AIX)
5353
#include <sys/machine.h>
5454
diff --git a/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp b/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
55-
index bba3329e8cc2..81455916a546 100644
55+
index 944fca000d61..492ceb2d2ece 100644
5656
--- a/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
5757
+++ b/llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
58-
@@ -219,7 +219,8 @@ SharedMemoryMapper::Create(ExecutorProcessControl &EPC, SymbolAddrs SAs) {
58+
@@ -218,7 +218,8 @@ SharedMemoryMapper::Create(ExecutorProcessControl &EPC, SymbolAddrs SAs) {
5959

6060
void SharedMemoryMapper::reserve(size_t NumBytes,
6161
OnReservedFunction OnReserved) {
@@ -66,10 +66,10 @@ index bba3329e8cc2..81455916a546 100644
6666
EPC.callSPSWrapperAsync<
6767
rt::SPSExecutorSharedMemoryMapperServiceReserveSignature>(
6868
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
69-
index f5118c0f2bfa..426497a45a47 100644
69+
index 4fbf232008c8..579b5c7c40ea 100644
7070
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
7171
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
72-
@@ -51,7 +51,8 @@ static DWORD getWindowsProtectionFlags(MemProt MP) {
72+
@@ -50,7 +50,8 @@ static DWORD getWindowsProtectionFlags(MemProt MP) {
7373

7474
Expected<std::pair<ExecutorAddr, std::string>>
7575
ExecutorSharedMemoryMapperService::reserve(uint64_t Size) {
@@ -80,10 +80,10 @@ index f5118c0f2bfa..426497a45a47 100644
8080
#if defined(LLVM_ON_UNIX)
8181

8282
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
83-
index cf05db546e02..7f60a5d56789 100644
83+
index 6004e007c0c7..8564c69a28a2 100644
8484
--- a/llvm/lib/Support/Unix/Path.inc
8585
+++ b/llvm/lib/Support/Unix/Path.inc
86-
@@ -112,7 +112,7 @@ typedef uint_t uint;
86+
@@ -107,7 +107,7 @@ typedef uint_t uint;
8787
#endif
8888

8989
#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || \
@@ -92,7 +92,7 @@ index cf05db546e02..7f60a5d56789 100644
9292
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
9393
#else
9494
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
95-
@@ -511,6 +511,9 @@ static bool is_local_impl(struct STATVFS &Vfs) {
95+
@@ -506,6 +506,9 @@ static bool is_local_impl(struct STATVFS &Vfs) {
9696
#elif defined(__HAIKU__)
9797
// Haiku doesn't expose this information.
9898
return false;
@@ -103,10 +103,10 @@ index cf05db546e02..7f60a5d56789 100644
103103
// statvfs::f_basetype contains a null-terminated FSType name of the mounted
104104
// target
105105
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
106-
index 2742734bb11e..a5fd340a452b 100644
106+
index 0708df1eed0a..a6103e357593 100644
107107
--- a/llvm/lib/Support/Unix/Program.inc
108108
+++ b/llvm/lib/Support/Unix/Program.inc
109-
@@ -352,7 +352,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
109+
@@ -342,7 +342,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
110110
namespace llvm {
111111
namespace sys {
112112

@@ -115,7 +115,7 @@ index 2742734bb11e..a5fd340a452b 100644
115115
static pid_t(wait4)(pid_t pid, int *status, int options, struct rusage *usage);
116116
#elif !defined(__Fuchsia__)
117117
using ::wait4;
118-
@@ -395,6 +395,13 @@ pid_t(llvm::sys::wait4)(pid_t pid, int *status, int options,
118+
@@ -385,6 +385,13 @@ pid_t(llvm::sys::wait4)(pid_t pid, int *status, int options,
119119
}
120120
#endif
121121

Toolchain/Patches/llvm/0003-tools-Support-building-shared-libLLVM-and-libClang-f.patch

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ it, and the ELF sections that store version data would just waste space.
1616
2 files changed, 2 insertions(+), 2 deletions(-)
1717

1818
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
19-
index a7fe41b0ab06..b7dd800003c0 100644
19+
index e82cda307ddf..ffb11803c545 100644
2020
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
2121
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
22-
@@ -212,7 +212,7 @@ if(WIN32)
22+
@@ -222,7 +222,7 @@ if(WIN32)
2323
elseif(FUCHSIA OR UNIX)
2424
set(LLVM_ON_WIN32 0)
2525
set(LLVM_ON_UNIX 1)
@@ -29,15 +29,15 @@ index a7fe41b0ab06..b7dd800003c0 100644
2929
else()
3030
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
3131
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
32-
index b20ac318e768..d3df0de2f694 100644
32+
index ede3c5034e04..dcef1e89845d 100644
3333
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
3434
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
35-
@@ -51,7 +51,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
36-
37-
# GNU ld doesn't resolve symbols in the version script.
38-
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
39-
- if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
40-
+ if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW AND NOT SERENITYOS)
41-
# Solaris ld does not accept global: *; so there is no way to version *all* global symbols
42-
set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES})
43-
endif()
35+
@@ -57,7 +57,7 @@ if(LLVM_BUILD_LLVM_DYLIB)
36+
else()
37+
# GNU ld doesn't resolve symbols in the version script.
38+
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
39+
- if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
40+
+ if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW AND NOT SERENITYOS)
41+
# Solaris ld does not accept global: *; so there is no way to version *all* global symbols
42+
set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES})
43+
endif()

Toolchain/Patches/llvm/0004-compiler-rt-Enable-profile-instrumentation-for-Seren.patch

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ enough to linux to use the pre-canned InstrProfiling implementation.
99
clang/lib/Driver/ToolChains/Serenity.cpp | 3 +++
1010
clang/test/Driver/instrprof-ld.c | 20 +++++++++++++++++++
1111
compiler-rt/cmake/config-ix.cmake | 2 +-
12-
.../lib/profile/InstrProfilingPlatformLinux.c | 2 +-
13-
.../lib/profile/InstrProfilingPlatformOther.c | 3 ++-
12+
.../lib/profile/InstrProfilingPlatformLinux.c | 3 ++-
13+
.../lib/profile/InstrProfilingPlatformOther.c | 2 +-
1414
5 files changed, 27 insertions(+), 3 deletions(-)
1515

1616
diff --git a/clang/lib/Driver/ToolChains/Serenity.cpp b/clang/lib/Driver/ToolChains/Serenity.cpp
@@ -66,42 +66,42 @@ index a96bba4a1e76..4b099da9e2d2 100644
6666
// RUN: --target=x86_64-apple-darwin14 -fprofile-instr-generate -fuse-ld=ld \
6767
// RUN: -resource-dir=%S/Inputs/resource_dir \
6868
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
69-
index dad557af2ae8..b3c46ae85554 100644
69+
index cf729c3adb1f..76d42499daf0 100644
7070
--- a/compiler-rt/cmake/config-ix.cmake
7171
+++ b/compiler-rt/cmake/config-ix.cmake
72-
@@ -816,7 +816,7 @@ else()
72+
@@ -836,7 +836,7 @@ else()
7373
endif()
7474

7575
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
76-
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX")
77-
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|SerenityOS")
76+
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|WASI|Haiku")
77+
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|WASI|Haiku|SerenityOS")
7878
set(COMPILER_RT_HAS_PROFILE TRUE)
7979
else()
8080
set(COMPILER_RT_HAS_PROFILE FALSE)
8181
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
82-
index b766436497b7..848df63fe0b8 100644
82+
index 5b230c1b2006..3641479114d6 100644
8383
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
8484
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
85-
@@ -8,7 +8,7 @@
85+
@@ -8,7 +8,8 @@
8686

87-
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
88-
(defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
89-
- defined(_AIX)
90-
+ defined(_AIX) || defined(__serenity__)
87+
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
88+
(defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
89+
- defined(_AIX) || defined(__wasm__) || defined(__HAIKU__)
90+
+ defined(_AIX) || defined(__wasm__) || defined(__HAIKU__) || \
91+
+ defined(__serenity__)
9192

92-
#if !defined(_AIX)
93+
#if !defined(_AIX) && !defined(__wasm__)
9394
#include <elf.h>
9495
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
95-
index aa79a5641cec..e07284e06427 100644
96+
index 29e570b9fba9..483b836b0a55 100644
9697
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
9798
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
98-
@@ -8,7 +8,8 @@
99-
99+
@@ -9,7 +9,7 @@
100100
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) && \
101101
!defined(__Fuchsia__) && !(defined(__sun__) && defined(__svr4__)) && \
102-
- !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
103-
+ !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && \
104-
+ !defined(__serenity__)
102+
!defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && \
103+
- !defined(__wasm__) && !defined(__HAIKU__)
104+
+ !defined(__wasm__) && !defined(__HAIKU__) && !defined(__serenity__)
105105

106106
#include <stdlib.h>
107107
#include <stdio.h>

0 commit comments

Comments
 (0)