[compiler-rt] [compiler-rt] Link atomic against builtins (PR #65239)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 3 18:56:59 PDT 2023


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/65239:

The atomic shared library needs to be linked against builtins. The `add_compiler_rt_runtime` call already has `DEP builtins` but that only ensures that the `builtins` target is built before `clang_rt.atomic` but doesn't link against `clang_rt.builtins`, to do so we need to use `LINK_LIBS clang_rt.builtins`.

>From d07e307b8b2b62d30fca10a46dd02177340bc72d Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Mon, 4 Sep 2023 01:49:20 +0000
Subject: [PATCH] [compiler-rt] Link atomic against builtins

The atomic shared library needs to be linked against builtins. The
`add_compiler_rt_runtime` call already has `DEP builtins` but that only
ensures that the `builtins` target is built before `clang_rt.atomic` but
doesn't link against `clang_rt.builtins`, to do so we need to use
`LINK_LIBS clang_rt.builtins`.
---
 compiler-rt/lib/builtins/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 727bcab436e2a8..43ef62ffb115d9 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -878,7 +878,7 @@ if(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC)
                               ARCHS ${arch}
                               SOURCES atomic.c
                               LINK_FLAGS ${COMPILER_RT_LIBATOMIC_LINK_FLAGS}
-                              DEPS builtins
+                              LINK_LIBS clang_rt.builtins-${arch}
                               PARENT_TARGET builtins-standalone-atomic)
     endif()
   endforeach()



More information about the llvm-commits mailing list