Toolchain: Update to LLVM 15.0.0

This commit is contained in:
Tim Schumacher 2022-09-11 23:19:41 +02:00 committed by Brian Gianforcaro
parent 388dc9cc5f
commit f45238db0f
13 changed files with 101 additions and 103 deletions

View File

@ -18,7 +18,7 @@ endif()
# Check for toolchain mismatch, user might need to rebuild toolchain
set(GCC_VERSION "12.2.0")
set(LLVM_VERSION "14.0.1")
set(LLVM_VERSION "15.0.0")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(EXPECTED_COMPILER_VERSION "${GCC_VERSION}")
else()

View File

@ -137,7 +137,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`libyaml`](libyaml/) | libyaml | 0.2.5 | https://pyyaml.org/wiki/LibYAML |
| [`libzip`](libzip/) | libzip | 1.8.0 | https://libzip.org/ |
| [`links`](links/) | Links web browser | 2.26 | http://links.twibright.com/ |
| [`llvm`](llvm/) | LLVM | 14.0.1 | https://llvm.org/ |
| [`llvm`](llvm/) | LLVM | 15.0.0 | https://llvm.org/ |
| [`lua`](lua/) | Lua | 5.4.4 | https://www.lua.org/ |
| [`luajit`](luajit/) | LuaJIT | 2.1.0-beta3 | https://luajit.org/luajit.html |
| [`luarocks`](luarocks/) | LuaRocks | 3.8.0 | https://luarocks.org/ |

View File

@ -1,10 +1,10 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=llvm
useconfigure=true
version=14.0.1
version=15.0.0
workdir=llvm-project-${version}.src
configopts=("-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt")
files="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz llvm-project-${version}.src.tar.xz 1a3c2e57916c5a70153aaf0a0e6f1230d6368b9e0f4d04dcb9e039a31b1cd4e6"
files="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz llvm-project-${version}.src.tar.xz caaf8100365b6ebafc39fea803e902ca3ff38b4d5327b9927097808d32964db7"
auth_type=sha256
depends=("ncurses" "zlib")

View File

@ -70,8 +70,8 @@ echo PREFIX is "$PREFIX"
mkdir -p "$DIR/Tarballs"
LLVM_VERSION="14.0.1"
LLVM_MD5SUM="47a50c31659488a6ae562475b41d2c32"
LLVM_VERSION="15.0.0"
LLVM_MD5SUM="d17f527916cb07400e336f9ba4a28903"
LLVM_NAME="llvm-project-$LLVM_VERSION.src"
LLVM_PKG="$LLVM_NAME.tar.xz"
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/$LLVM_PKG"

View File

@ -27,7 +27,7 @@ index e8612ba66..f0109f4b3 100644
#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
index 2ae7c6dc4..bf173117b 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -112,7 +112,7 @@ typedef uint_t uint;

View File

@ -9,20 +9,20 @@ Subject: [PATCH] [Triple] Add triple for SerenityOS
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
index ba4584dc6..7249849e8 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -205,7 +205,8 @@ public:
Hurd, // GNU/Hurd
@@ -219,7 +219,8 @@ public:
WASI, // Experimental WebAssembly OS
Emscripten,
- LastOSType = Emscripten
ShaderModel, // DirectX ShaderModel
- LastOSType = ShaderModel
+ Serenity,
+ LastOSType = Serenity
};
enum EnvironmentType {
UnknownEnvironment,
@@ -612,6 +613,11 @@ public:
@@ -652,6 +653,11 @@ public:
return getOS() == Triple::AIX;
}
@ -35,21 +35,21 @@ index 42277c013..b0378dd3a 100644
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
index 6696d158b..5292164d7 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";
@@ -234,6 +234,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";
@@ -548,6 +549,7 @@ static Triple::OSType parseOS(StringRef OSName) {
.StartsWith("hurd", Triple::Hurd)
@@ -587,6 +588,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);
}

View File

@ -14,17 +14,17 @@ protection and position-independent code by default.
clang/lib/Driver/Driver.cpp | 4 +
clang/lib/Driver/ToolChain.cpp | 2 +
clang/lib/Driver/ToolChains/Arch/X86.cpp | 1 +
clang/lib/Driver/ToolChains/Serenity.cpp | 340 +++++++++++++++++++++++
clang/lib/Driver/ToolChains/Serenity.cpp | 337 +++++++++++++++++++++++
clang/lib/Driver/ToolChains/Serenity.h | 99 +++++++
8 files changed, 471 insertions(+)
8 files changed, 468 insertions(+)
create mode 100644 clang/lib/Driver/ToolChains/Serenity.cpp
create mode 100644 clang/lib/Driver/ToolChains/Serenity.h
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 994a491cd..066c8140b 100644
index 2d6ef9984..06abf1dfd 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -149,6 +149,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
@@ -151,6 +151,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new NetBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
case llvm::Triple::OpenBSD:
return new OpenBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
@ -33,7 +33,7 @@ index 994a491cd..066c8140b 100644
case llvm::Triple::Win32:
switch (Triple.getEnvironment()) {
case llvm::Triple::GNU:
@@ -538,6 +540,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
@@ -540,6 +542,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new MCUX86_32TargetInfo(Triple, Opts);
case llvm::Triple::Hurd:
return new HurdTargetInfo<X86_32TargetInfo>(Triple, Opts);
@ -42,20 +42,20 @@ index 994a491cd..066c8140b 100644
default:
return new X86_32TargetInfo(Triple, Opts);
}
@@ -590,6 +594,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new NaClTargetInfo<X86_64TargetInfo>(Triple, Opts);
case llvm::Triple::PS4:
@@ -594,6 +598,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new PS4OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
case llvm::Triple::PS5:
return new PS5OSTargetInfo<X86_64TargetInfo>(Triple, Opts);
+ case llvm::Triple::Serenity:
+ return new SerenityTargetInfo<X86_64TargetInfo>(Triple, Opts);
default:
return new X86_64TargetInfo(Triple, Opts);
}
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 3c1830d5f..b0bae0535 100644
index a814f681b..927eeb664 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -977,6 +977,24 @@ public:
@@ -1013,6 +1013,24 @@ public:
}
};
@ -81,10 +81,10 @@ index 3c1830d5f..b0bae0535 100644
} // namespace clang
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 78e8fd185..3b70257a9 100644
index 18c9b2d04..ed7178e51 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -70,6 +70,7 @@ add_clang_library(clangDriver
@@ -74,6 +74,7 @@ add_clang_library(clangDriver
ToolChains/OpenBSD.cpp
ToolChains/PS4CPU.cpp
ToolChains/RISCVToolchain.cpp
@ -93,10 +93,10 @@ index 78e8fd185..3b70257a9 100644
ToolChains/SPIRV.cpp
ToolChains/TCE.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 3bfddeefc..a75e0ee14 100644
index 3f29afd35..184336551 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -43,6 +43,7 @@
@@ -45,6 +45,7 @@
#include "ToolChains/PPCLinux.h"
#include "ToolChains/PS4CPU.h"
#include "ToolChains/RISCVToolchain.h"
@ -104,7 +104,7 @@ index 3bfddeefc..a75e0ee14 100644
#include "ToolChains/SPIRV.h"
#include "ToolChains/Solaris.h"
#include "ToolChains/TCE.h"
@@ -5564,6 +5565,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
@@ -6009,6 +6010,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
case llvm::Triple::Fuchsia:
TC = std::make_unique<toolchains::Fuchsia>(*this, Target, Args);
break;
@ -115,10 +115,10 @@ index 3bfddeefc..a75e0ee14 100644
TC = std::make_unique<toolchains::Solaris>(*this, Target, Args);
break;
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index d657d21bf..eea53e6ac 100644
index 7a4319ea6..8db07d9dd 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -413,6 +413,8 @@ StringRef ToolChain::getOSLibName() const {
@@ -452,6 +452,8 @@ StringRef ToolChain::getOSLibName() const {
return "sunos";
case llvm::Triple::AIX:
return "aix";
@ -128,10 +128,10 @@ index d657d21bf..eea53e6ac 100644
return getOS();
}
diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index bfa008f96..b7f1780fd 100644
index cd7c014fa..004185d28 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -107,6 +107,7 @@ std::string x86::getX86TargetCPU(const Driver &D, const ArgList &Args,
@@ -113,6 +113,7 @@ std::string x86::getX86TargetCPU(const Driver &D, const ArgList &Args,
case llvm::Triple::OpenBSD:
return "i586";
case llvm::Triple::FreeBSD:
@ -141,7 +141,7 @@ index bfa008f96..b7f1780fd 100644
// Fallback to p4.
diff --git a/clang/lib/Driver/ToolChains/Serenity.cpp b/clang/lib/Driver/ToolChains/Serenity.cpp
new file mode 100644
index 000000000..955422438
index 000000000..6fc664a05
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Serenity.cpp
@@ -0,0 +1,337 @@

View File

@ -12,10 +12,10 @@ This patch should be removed when we implement proper TLS support.
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f2f18e901..39d6c18fe 100644
index 3704ed858..cc7b59809 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5872,7 +5872,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
@@ -6029,7 +6029,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden_static_local_var,
options::OPT_fno_visibility_inlines_hidden_static_local_var);
Args.AddLastArg(CmdArgs, options::OPT_fvisibility_global_new_delete_hidden);

View File

@ -15,19 +15,19 @@ LibC, namely:
locale.cpp to use our character type table properly.
---
libcxx/include/CMakeLists.txt | 1 +
libcxx/include/__config | 6 ++++--
libcxx/include/__config | 5 +++--
libcxx/include/__locale | 2 ++
libcxx/include/__support/serenity/xlocale.h | 24 +++++++++++++++++++++
libcxx/include/locale | 2 +-
libcxx/src/include/config_elast.h | 2 ++
6 files changed, 34 insertions(+), 3 deletions(-)
6 files changed, 33 insertions(+), 3 deletions(-)
create mode 100644 libcxx/include/__support/serenity/xlocale.h
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 53700fc9e..67d50bdbc 100644
index f7c2d99e7..8d3cb754d 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -365,6 +365,7 @@ set(files
@@ -495,6 +495,7 @@ set(files
__support/musl/xlocale.h
__support/newlib/xlocale.h
__support/openbsd/xlocale.h
@ -36,34 +36,33 @@ index 53700fc9e..67d50bdbc 100644
__support/solaris/wchar.h
__support/solaris/xlocale.h
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 458d0c1b8..69f627294 100644
index 8c2f7614a..c7ebf50cb 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1146,7 +1146,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
defined(__APPLE__) || \
defined(__sun__) || \
defined(__MVS__) || \
- defined(_AIX)
+ defined(_AIX) || \
+ defined(__serenity__)
# define _LIBCPP_HAS_THREAD_API_PTHREAD
# elif defined(__Fuchsia__)
// TODO(44575): Switch to C11 thread API when possible.
@@ -1225,7 +1226,8 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
@@ -912,7 +912,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
defined(__sun__) || \
defined(__MVS__) || \
defined(_AIX) || \
- defined(__EMSCRIPTEN__)
+ defined(__EMSCRIPTEN__) || \
+ defined(__serenity__)
// clang-format on
# define _LIBCPP_HAS_THREAD_API_PTHREAD
# elif defined(__Fuchsia__)
@@ -990,7 +991,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
# endif
#if defined(__BIONIC__) || defined(__NuttX__) || \
defined(__Fuchsia__) || defined(__wasi__) || \
- defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
+ defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || \
+ defined(__serenity__)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \
- defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
+ defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) || defined(__serenity__)
# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
# endif
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 51f35eece..6f25098a2 100644
index 40f9a3ff5..1c499c078 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -44,6 +44,8 @@
@@ -42,6 +42,8 @@
# include <__support/musl/xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include <__support/musl/xlocale.h>
@ -103,23 +102,23 @@ index 000000000..0f939d2f6
+
+#endif
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 7c2d2361f..229ca7258 100644
index b01c66d04..da29b7d00 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -206,7 +206,7 @@ template <class charT> class messages_byname;
@@ -217,7 +217,7 @@ template <class charT> class messages_byname;
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
// Most unix variants have catopen. These are the specific ones that don't.
-# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
+# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__serenity__)
-# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
+# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) && !defined(__serenity__)
# define _LIBCPP_HAS_CATOPEN 1
# include <nl_types.h>
# endif
diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h
index 0ed53a3b2..7fffd937e 100644
index bef26ec50..fbb2899b1 100644
--- a/libcxx/src/include/config_elast.h
+++ b/libcxx/src/include/config_elast.h
@@ -33,6 +33,8 @@
@@ -35,6 +35,8 @@
#define _LIBCPP_ELAST 4095
#elif defined(__APPLE__)
// No _LIBCPP_ELAST needed on Apple

View File

@ -4,16 +4,16 @@ Date: Thu, 14 Apr 2022 10:20:46 +0200
Subject: [PATCH] [compiler-rt] Build crtbegin.o/crtend.o for SerenityOS
---
compiler-rt/cmake/config-ix.cmake | 2 +-
compiler-rt/cmake/crt-config-ix.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index fc62d5ecc..7a47b7f71 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -696,7 +696,7 @@ endif()
# TODO: Add builtins support.
diff --git a/compiler-rt/cmake/crt-config-ix.cmake b/compiler-rt/cmake/crt-config-ix.cmake
index 78d1a0de1..c8622c458 100644
--- a/compiler-rt/cmake/crt-config-ix.cmake
+++ b/compiler-rt/cmake/crt-config-ix.cmake
@@ -43,7 +43,7 @@ if(NOT APPLE)
message(STATUS "Supported architectures for crt: ${CRT_SUPPORTED_ARCH}")
endif()
-if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux" AND NOT LLVM_USE_SANITIZER)
+if (CRT_SUPPORTED_ARCH AND OS_NAME MATCHES "Linux|SerenityOS" AND NOT LLVM_USE_SANITIZER)

View File

@ -11,10 +11,10 @@ are built.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index fcaa8f20b..c27209146 100644
index 56d05f5b5..8597d80d3 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -227,7 +227,7 @@ endif()
@@ -228,7 +228,7 @@ endif()
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
# build might work on ELF but fail on MachO/COFF.

View File

@ -16,10 +16,10 @@ it, and the ELF sections that store version data would just waste space.
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 4e0647971..2e4aeeab3 100644
index c6b3b44a7..d43e0b4c1 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -80,7 +80,7 @@ if(MSVC)
@@ -96,7 +96,7 @@ if(MSVC)
set(LLVM_EXPORTED_SYMBOL_FILE)
endif()

View File

@ -11,16 +11,16 @@ Curiously, enabling profiling for the SerenityOS target changes the ELF
OS ABI for userspace binaries to 3, or GNU/Linux.
---
compiler-rt/cmake/config-ix.cmake | 2 +-
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | 3 ++-
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c | 2 +-
compiler-rt/lib/profile/InstrProfilingPlatformOther.c | 2 +-
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | 3 ++-
4 files changed, 6 insertions(+), 4 deletions(-)
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 7a47b7f71..8d4211deb 100644
index cd45176cf..ebaa74f4b 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -738,7 +738,7 @@ else()
@@ -756,7 +756,7 @@ else()
endif()
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
@ -30,43 +30,42 @@ index 7a47b7f71..8d4211deb 100644
else()
set(COMPILER_RT_HAS_PROFILE FALSE)
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index 592c09b49..1833682d7 100644
index 3af61d249..ee46741d4 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -7,7 +7,8 @@
\*===----------------------------------------------------------------------===*/
@@ -8,7 +8,7 @@
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
- (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__)
+ (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
+ defined(__serenity__)
(defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
- defined(_AIX)
+ defined(_AIX) || defined(__serenity__)
#if !defined(_AIX)
#include <elf.h>
#include <link.h>
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index 3e9b3ca0a..d257013dd 100644
index c7b6e842c..00fdf9ee6 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -8,7 +8,7 @@
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) && \
!(defined(__sun__) && defined(__svr4__)) && !defined(__NetBSD__) && \
- !defined(_WIN32)
+ !defined(_WIN32) && !defined(__serenity__)
!defined(__Fuchsia__) && !(defined(__sun__) && defined(__svr4__)) && \
- !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
+ !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && !defined(__serenity__)
#include <stdlib.h>
#include <stdio.h>
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 6868408ef..eaa1b64d2 100644
index 5b7aa304b..b3b037a6f 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -857,7 +857,8 @@ static bool needsRuntimeRegistrationOfSectionRange(const Triple &TT) {
@@ -822,7 +822,8 @@ static bool needsRuntimeRegistrationOfSectionRange(const Triple &TT) {
return false;
// Use linker script magic to get data/cnts/name start/end.
if (TT.isOSLinux() || TT.isOSFreeBSD() || TT.isOSNetBSD() ||
- TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS4CPU() || TT.isOSWindows())
+ TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS4CPU() ||
+ TT.isOSWindows() || TT.isOSSerenity())
if (TT.isOSAIX() || TT.isOSLinux() || TT.isOSFreeBSD() || TT.isOSNetBSD() ||
- TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS() || TT.isOSWindows())
+ TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS() || TT.isOSWindows() ||
+ TT.isOSSerenity())
return false;
return true;