Support for RISC-V
Automatically detect RISC-V CPU architecture.
Change-Id: I8be8fbc4457ceae4bc898b0490ebc489c648cb1f
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/6680
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/src/gn/args.cc b/src/gn/args.cc
index 24112b7..c40c7e1 100644
--- a/src/gn/args.cc
+++ b/src/gn/args.cc
@@ -331,6 +331,8 @@
static const char kMips64[] = "mips64el";
static const char kS390X[] = "s390x";
static const char kPPC64[] = "ppc64";
+ static const char kRISCV32[] = "riscv32";
+ static const char kRISCV64[] = "riscv64";
const char* arch = nullptr;
// Set the host CPU architecture based on the underlying OS, not
@@ -355,6 +357,10 @@
// This allows us to use the same toolchain as ppc64 BE
// and specific flags are included using the host_byteorder logic.
arch = kPPC64;
+ else if (os_arch == "riscv32")
+ arch = kRISCV32;
+ else if (os_arch == "riscv64")
+ arch = kRISCV64;
else
CHECK(false) << "OS architecture not handled. (" << os_arch << ")";