[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 12:37:11 PST 2024


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

>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 1/2] [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

>From 457cbf0b5c9f7c9ad3b62e4dd62bb136181e6379 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <i at zhuyi.fan>
Date: Fri, 6 Dec 2024 12:36:59 -0800
Subject: [PATCH 2/2] [libc] more fixes

---
 libc/test/src/__support/CPP/CMakeLists.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libc/test/src/__support/CPP/CMakeLists.txt b/libc/test/src/__support/CPP/CMakeLists.txt
index 36757112525719..0d71cd6e3cb16b 100644
--- a/libc/test/src/__support/CPP/CMakeLists.txt
+++ b/libc/test/src/__support/CPP/CMakeLists.txt
@@ -111,15 +111,16 @@ 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)
+    message(STATUS "adding atomic library to ${fq_atomic_test}.__unit__.__build__")
+    target_link_libraries(${fq_atomic_test}.__unit__.__build__ PRIVATE 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)
+    message(STATUS "adding atomic library to ${fq_atomic_test}.__hermetic____build__")
+    target_link_libraries(${fq_atomic_test}.__hermetic__.__build__ PRIVATE atomic)
   endif()
 endif()
 
+
 add_libc_test(
   stringstream_test
   SUITE



More information about the libc-commits mailing list