diff options
Diffstat (limited to 'Toolchain/Patches/llvm/0009-compiler-rt-llvm-Enable-profile-instrumentation-for-.patch')
-rw-r--r-- | Toolchain/Patches/llvm/0009-compiler-rt-llvm-Enable-profile-instrumentation-for-.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Toolchain/Patches/llvm/0009-compiler-rt-llvm-Enable-profile-instrumentation-for-.patch b/Toolchain/Patches/llvm/0009-compiler-rt-llvm-Enable-profile-instrumentation-for-.patch new file mode 100644 index 0000000000..15370af2ce --- /dev/null +++ b/Toolchain/Patches/llvm/0009-compiler-rt-llvm-Enable-profile-instrumentation-for-.patch @@ -0,0 +1,75 @@ +From 539a12f2955a737f550be655c56a1a993eaa1ae2 Mon Sep 17 00:00:00 2001 +From: Andrew Kaster <akaster@serenityos.org> +Date: Fri, 4 Mar 2022 15:13:42 -0700 +Subject: [PATCH 9/9] [compiler-rt/llvm] Enable profile instrumentation + for SerenityOS + +Treat SerenityOS the same as other *NIX platforms that behave close +enough to linux to use the pre-canned InstrProfiling implementation. + +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/InstrProfilingPlatformOther.c | 2 +- + llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp | 3 ++- + 4 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake +index 7a47b7f..8d4211d 100644 +--- a/compiler-rt/cmake/config-ix.cmake ++++ b/compiler-rt/cmake/config-ix.cmake +@@ -738,7 +738,7 @@ else() + endif() + + if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND +- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX") ++ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|SerenityOS") + set(COMPILER_RT_HAS_PROFILE TRUE) + else() + set(COMPILER_RT_HAS_PROFILE FALSE) +diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c +index 592c09b..1833682 100644 +--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c ++++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c +@@ -7,7 +7,8 @@ + \*===----------------------------------------------------------------------===*/ + + #if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \ +- (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) ++ (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \ ++ defined(__serenity__) + + #include <elf.h> + #include <link.h> +diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c +index 3e9b3ca..d257013 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__) + + #include <stdlib.h> + #include <stdio.h> +diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +index 6868408..eaa1b64 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) { + 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()) + return false; + + return true; +-- +2.32.0 + |