[clang] Add support for dynamic libraries in CLANG_BOLT (PR #127020)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 20 05:50:52 PST 2025


================
@@ -168,6 +168,28 @@ if (CLANG_BOLT AND NOT LLVM_BUILD_INSTRUMENTED)
   )
   set(LIT_COMMAND "${lit_base_dir}/${lit_file_name}")
 
+  set(CLANG_BOLT_INPUTS $<TARGET_FILE:clang>)
+  set(CLANG_INSTRUMENTED_OUTPUTS ${CLANG_INSTRUMENTED})
+
+  # Add in dynamically linked libraries, if needs be. Currently only supported
+  # on Linux because it relies on LD_PRELOAD for instrumentation.
+  if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    if (CLANG_LINK_CLANG_DYLIB)
----------------
serge-sans-paille wrote:

In theory yes, but in this scenario, we would need another executable linking with that library to run, otherwise we can't gather the runtime information from the instrumented library.

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


More information about the cfe-commits mailing list