[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:12:48 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)
+  list(APPEND PROFILE_SOURCES GCDAProfiling.c
+                              InstrProfilingFile.c
+                              InstrProfilingRuntime.cpp
+                              InstrProfilingUtil.c
+                              InstrProfilingValue.c
+                              )
----------------
petrhosek wrote:

This formatting is a bit unusual, what we use elsewhere in LLVM is more akin to:
```suggestion
  list(APPEND PROFILE_SOURCES
    GCDAProfiling.c
    InstrProfilingFile.c
    InstrProfilingRuntime.cpp
    InstrProfilingUtil.c
    InstrProfilingValue.c
    )
```

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


More information about the llvm-commits mailing list