diff -pruN 1.5.1+ds-3/debian/changelog 1.5.1+ds-4/debian/changelog
--- 1.5.1+ds-3/debian/changelog	2022-06-16 18:56:54.000000000 +0000
+++ 1.5.1+ds-4/debian/changelog	2022-08-01 18:12:10.000000000 +0000
@@ -1,3 +1,9 @@
+ros2-osrf-testing-tools-cpp (1.5.1+ds-4) unstable; urgency=medium
+
+  * Link against libatomic on riscv64
+
+ -- Timo Röhling <roehling@debian.org>  Mon, 01 Aug 2022 20:12:10 +0200
+
 ros2-osrf-testing-tools-cpp (1.5.1+ds-3) unstable; urgency=medium
 
   * Fix FTBFS with GCC-12
diff -pruN 1.5.1+ds-3/debian/patches/0009-Add-option-to-link-against-libatomic.patch 1.5.1+ds-4/debian/patches/0009-Add-option-to-link-against-libatomic.patch
--- 1.5.1+ds-3/debian/patches/0009-Add-option-to-link-against-libatomic.patch	1970-01-01 00:00:00.000000000 +0000
+++ 1.5.1+ds-4/debian/patches/0009-Add-option-to-link-against-libatomic.patch	2022-08-01 18:08:45.000000000 +0000
@@ -0,0 +1,22 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
+Date: Mon, 1 Aug 2022 20:08:38 +0200
+Subject: Add option to link against libatomic
+
+---
+ osrf_testing_tools_cpp/src/memory_tools/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/osrf_testing_tools_cpp/src/memory_tools/CMakeLists.txt b/osrf_testing_tools_cpp/src/memory_tools/CMakeLists.txt
+index c80bc37..88f8280 100644
+--- a/osrf_testing_tools_cpp/src/memory_tools/CMakeLists.txt
++++ b/osrf_testing_tools_cpp/src/memory_tools/CMakeLists.txt
+@@ -30,6 +30,9 @@ target_link_libraries(memory_tools PRIVATE Backward::Backward)
+ if(CMAKE_DL_LIBS)
+   target_link_libraries(memory_tools PUBLIC ${CMAKE_DL_LIBS})
+ endif()
++if(DEB_LINK_LIBATOMIC)
++  target_link_libraries(memory_tools PUBLIC atomic)
++endif()
+ 
+ target_compile_definitions(memory_tools
+   PRIVATE "OSRF_TESTING_TOOLS_CPP_MEMORY_TOOLS_BUILDING_DLL")
diff -pruN 1.5.1+ds-3/debian/patches/series 1.5.1+ds-4/debian/patches/series
--- 1.5.1+ds-3/debian/patches/series	2022-06-16 18:56:46.000000000 +0000
+++ 1.5.1+ds-4/debian/patches/series	2022-08-01 18:08:45.000000000 +0000
@@ -6,3 +6,4 @@
 0006-Make-package-Multi-Arch-compliant.patch
 0007-Rename-memory-tools-to-something-less-generic.patch
 0008-Fix-FTBFS-with-GCC-12.patch
+0009-Add-option-to-link-against-libatomic.patch
diff -pruN 1.5.1+ds-3/debian/rules 1.5.1+ds-4/debian/rules
--- 1.5.1+ds-3/debian/rules	2022-06-16 18:50:54.000000000 +0000
+++ 1.5.1+ds-4/debian/rules	2022-08-01 18:12:03.000000000 +0000
@@ -1,6 +1,10 @@
 #!/usr/bin/make -f
 
-export ROS_CONFIGURE_ARGS = -DMEMORY_TOOLS_SOVERSION=0d
+include /usr/share/dpkg/architecture.mk
+
+DEB_LINK_LIBATOMIC = $(if $(filter riscv64,$(DEB_HOST_ARCH)),ON,OFF)
+
+export ROS_CONFIGURE_ARGS = -DMEMORY_TOOLS_SOVERSION=0d -DDEB_LINK_LIBATOMIC=$(DEB_LINK_LIBATOMIC)
 
 %:
 	dh $@ --buildsystem=ros
