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

Tom Stellard via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 21:54:28 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)
----------------
tstellar wrote:

Why condition this on CLANG_LINK_CLANG_DYLIB here ?  Do we only want to do the optimization if clang is linking against the shared library?  Wouldn't library consumers benefit from these optimizations even if clang is linked statically.

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


More information about the cfe-commits mailing list