[compiler-rt] [compiler-rt] Add baremetal version of profile library. (PR #167998)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 09:28:38 PST 2025


================
@@ -77,10 +74,25 @@ set(PROFILE_SOURCES
   InstrProfilingPlatformLinux.c
   InstrProfilingPlatformOther.c
   InstrProfilingPlatformWindows.c
-  InstrProfilingRuntime.cpp
-  InstrProfilingUtil.c
   )
 
+if (NOT COMPILER_RT_PROFILE_BAREMETAL)
+  # For baremetal, exclude the following:
+  # - Anything that contains filesystem operations (InstrProfilingFile.c,
+  #   InstrProfilingUtils.c)
+  # - Initialization, because it isn't necesary without the filesystem bits
+  #   on ELF targets (InstrProfilingRuntime.cpp).
+  # - Value profiling, because it requires malloc (InstrProfilingValue.c).
+  #   This could be optional if someone needs it.
+  # - GCDA profiling, which is unrelated (GCDAProfiling.c)
----------------
petrhosek wrote:

It'd be cleaner to split the list of sources per feature so the code is more self-documenting, e.g. `PROFILE_GCDA_SOURCES` or `PROFILE_VALUE_SOURCES` but that can be done in follow up changes. 

https://github.com/llvm/llvm-project/pull/167998


More information about the llvm-commits mailing list