[compiler-rt] Build SanitizerCommon if ctx_profile enabled (PR #105495)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 03:19:49 PDT 2024


https://github.com/nikic created https://github.com/llvm/llvm-project/pull/105495

ctx_profile has a dependency on SanitizerCommon, so make sure it is built even if we otherwise disable sanitizers.

Otherwise there are errors like these:

    CMake Error at /home/npopov/repos/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
      Error evaluating generator expression:

        $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

      Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
      exists.
    Call Stack (most recent call first):
      /home/npopov/repos/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)

>From e18777e023d5f65cfbacbecd5765a7955216e43f Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Wed, 21 Aug 2024 12:16:37 +0200
Subject: [PATCH] Build SanitizerCommon if ctx_profile enabled

ctx_profile has a dependency on SanitizerCommon, so make sure it
is built even if we otherwise disable sanitizers.

Otherwise there are errors like these:

    CMake Error at /home/npopov/repos/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
      Error evaluating generator expression:

        $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

      Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
      exists.
    Call Stack (most recent call first):
      /home/npopov/repos/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)
---
 compiler-rt/lib/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/CMakeLists.txt b/compiler-rt/lib/CMakeLists.txt
index 22f9b3ea8a0c35..e6158ec4088951 100644
--- a/compiler-rt/lib/CMakeLists.txt
+++ b/compiler-rt/lib/CMakeLists.txt
@@ -9,7 +9,7 @@ include(SanitizerUtils)
 #
 #TODO: Refactor sanitizer_common into smaller pieces (e.g. flag parsing, utils).
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND
-    (COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR COMPILER_RT_BUILD_MEMPROF))
+    (COMPILER_RT_BUILD_SANITIZERS OR COMPILER_RT_BUILD_XRAY OR COMPILER_RT_BUILD_MEMPROF OR COMPILER_RT_BUILD_CTX_PROFILE))
   add_subdirectory(sanitizer_common)
 endif()
 



More information about the llvm-commits mailing list