1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:47:34 +00:00

Toolchain: Add (basic) support for riscv64

This makes `ARCH=riscv64 Toolchain/BuildGNU.sh` work, but the patches
might not be completely correct.
This commit is contained in:
Sönke Holz 2023-08-10 12:55:29 +02:00 committed by Daniel Bertalan
parent 68924a8e81
commit 9522794a0e
5 changed files with 136 additions and 27 deletions

View file

@ -19,17 +19,17 @@ Co-Authored-By: Brian Gianforcaro <bgianf@serenityos.org>
Co-Authored-By: Philip Herron <herron.philip@googlemail.com>
Co-Authored-By: Shannon Booth <shannon@serenityos.org>
---
gcc/config.gcc | 19 ++++++++++++++
gcc/config.gcc | 23 +++++++++++++++++
gcc/config/i386/serenity.h | 7 ++++++
gcc/config/serenity.h | 51 ++++++++++++++++++++++++++++++++++++++
gcc/config/serenity.opt | 35 ++++++++++++++++++++++++++
4 files changed, 112 insertions(+)
4 files changed, 116 insertions(+)
create mode 100644 gcc/config/i386/serenity.h
create mode 100644 gcc/config/serenity.h
create mode 100644 gcc/config/serenity.opt
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6fd1594480a1d2054f499573b498781dfafd1d93..8e3d6c378796f324b904a7c58b274472362600fb 100644
index 6fd1594480a1d2054f499573b498781dfafd1d93..6f4fc0f34f4c19c7371d5431aad86f9b0652342b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -690,6 +690,18 @@ x86_cpus="generic intel"
@ -43,7 +43,7 @@ index 6fd1594480a1d2054f499573b498781dfafd1d93..8e3d6c378796f324b904a7c58b274472
+ extra_options="${extra_options} serenity.opt"
+ tmake_file="t-slibgcc"
+ case ${target} in
+ aarch64*-* | x86_64-*)
+ aarch64*-* | riscv64-* | x86_64-*)
+ default_gnu_indirect_function=yes
+ ;;
+ esac
@ -51,7 +51,7 @@ index 6fd1594480a1d2054f499573b498781dfafd1d93..8e3d6c378796f324b904a7c58b274472
*-*-darwin*)
tmake_file="t-darwin "
tm_file="${tm_file} darwin.h"
@@ -1126,6 +1138,13 @@ case ${target} in
@@ -1126,6 +1138,17 @@ case ${target} in
esac
case ${target} in
@ -61,6 +61,10 @@ index 6fd1594480a1d2054f499573b498781dfafd1d93..8e3d6c378796f324b904a7c58b274472
+aarch64*-*-serenity*)
+ tm_file="${tm_file} elfos.h glibc-stdint.h aarch64/aarch64-elf.h serenity.h"
+ tmake_file="${tmake_file} aarch64/t-aarch64"
+ ;;
+riscv64-*-serenity*)
+ tm_file="${tm_file} elfos.h glibc-stdint.h riscv/elf.h serenity.h"
+ tmake_file="${tmake_file} riscv/t-riscv"
+ ;;
aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
tm_file="${tm_file} elfos.h newlib-stdint.h"

View file

@ -15,9 +15,9 @@ Co-Authored-By: Philip Herron <herron.philip@googlemail.com>
Co-Authored-By: Shannon Booth <shannon@serenityos.org>
---
gcc/configure | 3 +++
libgcc/config.host | 16 ++++++++++++++++
libgcc/config.host | 21 +++++++++++++++++++++
libgcc/unwind-dw2-fde-dip.c | 6 ++++++
3 files changed, 25 insertions(+)
3 files changed, 30 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index c7b26d1927de62d7b3a49ea9ac0a998979659cf2..5fcfaa3cfff30d2e8d1cdf3f62bf2125e2f99179 100755
@ -34,10 +34,22 @@ index c7b26d1927de62d7b3a49ea9ac0a998979659cf2..5fcfaa3cfff30d2e8d1cdf3f62bf2125
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
diff --git a/libgcc/config.host b/libgcc/config.host
index b9975de902357576003cf391850fef2dc336aee1..7b1f6775b989410ccd6766f50740a288c6934794 100644
index b9975de902357576003cf391850fef2dc336aee1..d6cbaae46be819b6b17932d28327dd2658d3f2ad 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1507,6 +1507,22 @@ nvptx-*)
@@ -1294,6 +1294,11 @@ riscv*-*-freebsd*)
tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
;;
+riscv64-*-serenity*)
+ extra_parts="$extra_parts crti.o crtbegin.o crtbeginS.o crtend.o crtendS.o crtn.o"
+ tmake_file="$tmake_file riscv/t-softfp64 t-softfp riscv/t-elf riscv/t-elf64 t-slibgcc-libgcc t-eh-dw2-dip"
+ tmake_file="$tmake_file riscv/t-crtstuff t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld-nover"
+ ;;
riscv*-*-*)
tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address}"
extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
@@ -1507,6 +1512,22 @@ nvptx-*)
tmake_file="$tmake_file nvptx/t-nvptx"
extra_parts="crt0.o"
;;