[PATCH] D154402: [compiler-rt] Enable profile instrumentation for SerenityOS

Andrew Kaster via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 18:55:25 PDT 2023


ADKaster created this revision.
Herald added subscribers: Enna1, abrachet, phosek, hiraditya, fedor.sergeev, krytarowski, dberris.
Herald added a project: All.
ADKaster requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

Treat SerenityOS the same as other *NIX platforms that behave close
enough to linux to use the pre-canned InstrProfiling implementation.

Depends on D154401 <https://reviews.llvm.org/D154401>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154402

Files:
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
  compiler-rt/lib/profile/InstrProfilingPlatformOther.c
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp


Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -918,7 +918,8 @@
     return false;
   // Use linker script magic to get data/cnts/name start/end.
   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;
Index: compiler-rt/lib/profile/InstrProfilingPlatformOther.c
===================================================================
--- compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -8,7 +8,8 @@
 
 #if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) &&     \
     !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>
Index: compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
===================================================================
--- compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -8,7 +8,7 @@
 
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
     (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
-    defined(_AIX)
+    defined(_AIX) || defined(__serenity__)
 
 #if !defined(_AIX)
 #include <elf.h>
Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -778,7 +778,7 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154402.536928.patch
Type: text/x-patch
Size: 2352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230704/02db3900/attachment.bin>


More information about the llvm-commits mailing list