btrev43138 adds 1 changeset to branch 'master'
old head: 198e0fde5e533da0b2187c71abecb3e6cb1e1adf
new head: abcbee7bbace3ae5b6df384e879a0d1d24808476
overview:
https://git.haiku-os.org/buildtools/log/?qt=range&q=abcbee7bbace+%5E198e0fde5e53
----------------------------------------------------------------------------
abcbee7bbace: haiku: Add riscv arch support
Change-Id: Ifa5b93cb959798d74ed045f53f5050651f409314
Reviewed-on: https://review.haiku-os.org/c/1062
Reviewed-by: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>
[ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: btrev43138
Commit: abcbee7bbace3ae5b6df384e879a0d1d24808476
URL: https://git.haiku-os.org/buildtools/commit/?id=abcbee7bbace
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Sun Feb 17 01:48:08 2019 UTC
Committer: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Commit-Date: Thu Feb 21 01:32:48 2019 UTC
----------------------------------------------------------------------------
3 files changed, 61 insertions(+)
gcc/gcc/config.gcc | 4 +++
gcc/gcc/config/riscv/haiku.h | 54 ++++++++++++++++++++++++++++++++++++++++
gcc/gcc/config/riscv/t-haiku | 3 +++
----------------------------------------------------------------------------
diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc
index 071b67173..24df8eebd 100644
--- a/gcc/gcc/config.gcc
+++ b/gcc/gcc/config.gcc
@@ -2068,6 +2068,10 @@ microblaze*-*-elf)
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
tmake_file="${tmake_file} microblaze/t-microblaze"
;;
+riscv*-*-haiku*)
+ tm_file="elfos.h haiku.h ${tm_file} riscv/haiku.h"
+ tmake_file="${tmake_file} t-haiku riscv/t-riscv riscv/t-haiku"
+ ;;
riscv*-*-linux*)
tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file}
riscv/linux.h"
case "x${enable_multilib}" in
diff --git a/gcc/gcc/config/riscv/haiku.h b/gcc/gcc/config/riscv/haiku.h
new file mode 100644
index 000000000..b3568e98f
--- /dev/null
+++ b/gcc/gcc/config/riscv/haiku.h
@@ -0,0 +1,54 @@
+/* Definitions for RISC-V Haiku systems with ELF format.
+ Copyright (C) 1998-2017 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__HAIKU__"); \
+ if (POINTER_SIZE == 64) \
+ builtin_define ("__riscv64__"); \
+ else
\
+ builtin_define ("__riscv32__"); \
+ builtin_define ("__RISCV__"); \
+ builtin_define ("__riscv__"); \
+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
+ builtin_define ("__STDC_ISO_10646__=201103L"); \
+ builtin_assert ("system=haiku"); \
+ } \
+ while (0)
+
+#define MUSL_ABI_SUFFIX \
+ "%{mabi=ilp32:-sf}" \
+ "%{mabi=ilp32f:-sp}" \
+ "%{mabi=ilp32d:}" \
+ "%{mabi=lp64:-sf}" \
+ "%{mabi=lp64f:-sp}" \
+ "%{mabi=lp64d:}" \
+
+/* Because RISC-V only has word-sized atomics, it requries libatomic where
+ others do not. So link libatomic by default, as needed. */
+#undef LIB_SPEC
+#define LIB_SPEC " -lroot -latomic "
+
+#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{!o*:-o %b} -melf" XLEN_SPEC "lriscv %{!r:-shared}
%{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}} -X"
diff --git a/gcc/gcc/config/riscv/t-haiku b/gcc/gcc/config/riscv/t-haiku
new file mode 100644
index 000000000..216d2776a
--- /dev/null
+++ b/gcc/gcc/config/riscv/t-haiku
@@ -0,0 +1,3 @@
+# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
+MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst
rv64%,lib64,$(MULTILIB_DIRNAMES)))
+MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))