Support standalone riscv64 linux builds

GCC <13 requires linking libatomic for std::atomic<bool>.

Test: `tracebox sched` on HiFive Unmatched
Change-Id: I02ba9f6ea27751f666605b30c0644dd54852fe24
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn
index 1b23035..af6438a 100644
--- a/gn/standalone/BUILD.gn
+++ b/gn/standalone/BUILD.gn
@@ -258,6 +258,13 @@
       "-mfpu=neon",
       "-mthumb",
     ]
+  } else if (current_cpu == "riscv64") {
+    if (!is_clang) {
+      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
+      libs += [
+        "atomic",
+      ]
+    }
   } else if (current_cpu == "x86") {
     asmflags += [ "-m32" ]
     cflags += [
diff --git a/gn/standalone/toolchain/BUILD.gn b/gn/standalone/toolchain/BUILD.gn
index 562ecaf..e462bd5 100644
--- a/gn/standalone/toolchain/BUILD.gn
+++ b/gn/standalone/toolchain/BUILD.gn
@@ -129,6 +129,8 @@
     _target_triplet = "arm-linux-gnueabihf"
     _default_target_sysroot =
         rebase_path("//buildtools/debian_sid_arm-sysroot", root_build_dir)
+  } else if (target_os == "linux" && target_cpu == "riscv64") {
+    _target_triplet = "riscv64-linux-gnu"
   } else if (target_os == "linux" && target_cpu == "x64") {
     _target_triplet = "x86_64-linux-gnu"
   } else if (target_os == "linux" && target_cpu == "x86") {