Add risc-v and loongarch support

This commit is contained in:
misaka00251 2023-03-13 11:13:13 +08:00
parent 4d99818154
commit a1241b4eda
No known key found for this signature in database
GPG Key ID: 4AA100DC964EDE26
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,26 @@
diff --git a/src/util/build_config.h b/src/util/build_config.h
index 717b4e3..438777e 100644
--- a/src/util/build_config.h
+++ b/src/util/build_config.h
@@ -164,6 +164,21 @@
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_BIG_ENDIAN 1
#endif
+#elif defined(__loongarch32)
+#define ARCH_CPU_LOONG_FAMILY 1
+#define ARCH_CPU_LOONG32 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__loongarch64)
+#define ARCH_CPU_LOONG_FAMILY 1
+#define ARCH_CPU_LOONG64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__riscv) && (__riscv_xlen == 64)
+#define ARCH_CPU_RISCV_FAMILY 1
+#define ARCH_CPU_RISCV64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
#else
#error Please add support for your architecture in build_config.h
#endif

View File

@ -1,8 +1,11 @@
%ifarch riscv64
%global _debugsource_template %{nil}
%endif
%global commit e1ac69b17da0c6d4f5e34e686690ff70c6a43e6f
Name: gn
Version: 1.0.0
Release: 2
Release: 3
Summary: Meta-build system that generates build files for Ninja
License: BSD-3-Clause
URL: https://gn.googlesource.com/gn
@ -10,6 +13,7 @@ Source0: %{url}/+archive/gn-%{commit}.tar.gz
Source1: last_commit_position.h
Patch0000: gn-always-python3.patch
Patch0001: add_safe_compilation_options.patch
Patch1000: add-risc-v-and-loongarch-support.patch
BuildRequires: python3-devel ninja-build gcc-c++ clang emacs-common help2man
@ -102,6 +106,9 @@ rm -rf %{buildroot}%{_datadir}/vim/vimfiles/__pycache__
%changelog
* Mon Mar 13 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.0.0-3
- Add risc-v and loongarch support
* Tue Mar 07 2023 xuchongyu <xuchongyu@huawei.com> 1.0.0-2
- Add safe compilation options