[libc-commits] [libc] [libc] fix riscv atomic test build (PR #119008)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Fri Dec 6 10:53:22 PST 2024


https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/119008

None

>From e188d927153c9d481cc55c4dac2a2afe42add3bd Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Fri, 6 Dec 2024 10:52:49 -0800
Subject: [PATCH] [libc] fix riscv atomic test build

---
 libc/test/src/__support/CPP/CMakeLists.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libc/test/src/__support/CPP/CMakeLists.txt b/libc/test/src/__support/CPP/CMakeLists.txt
index 2b4d6107b767d3..36757112525719 100644
--- a/libc/test/src/__support/CPP/CMakeLists.txt
+++ b/libc/test/src/__support/CPP/CMakeLists.txt
@@ -108,6 +108,18 @@ if(NOT LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
   )
 endif()
 
+get_fq_target_name(atomic_test fq_atomic_test)
+if (LIBC_TARGET_ARCHITECTURE STREQUAL "riscv")
+  if (TARGET ${fq_atomic_test}.__unit__)
+    message(STATUS "adding atomic library to ${fq_atomic_test}.__unit__")
+    target_link_libraries(${fq_atomic_test}.__unit__ PUBLIC atomic)
+  endif()
+  if (TARGET ${fq_atomic_test}.__hermetic__)
+    message(STATUS "adding atomic library to ${fq_atomic_test}.__hermetic__")
+    target_link_libraries(${fq_atomic_test}.__unit__ PUBLIC atomic)
+  endif()
+endif()
+
 add_libc_test(
   stringstream_test
   SUITE



More information about the libc-commits mailing list