A second version of the GCC patch is attached. It has this problem:
https://gcc.gnu.org/ml/gcc/2018-05/msg00259.html -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>From 8d2cb7a18eaf5f5e8519f70b2ac9e8eda6179152 Mon Sep 17 00:00:00 2001 From: Sebastian Huber <sebastian.hu...@embedded-brains.de> Date: Mon, 28 May 2018 09:48:57 +0200 Subject: [PATCH] RISC-V: Add custom RTEMS multilibs Remove 64-bit multilibs from riscv32-*-rtems* targets. Remove 32-bit multilibs from riscv64-*-rtems* targets. Default to -mcmodel=medany on the riscv64-*-rtems* targets. The ratinale for this change is that several existing RISC-V chips map the RAM at 0x80000000. In RTEMS, we do not use virtual memory, so applications will run at this location which is outside the +-2GiB range in a 64-bit configuration. gcc/ * config.gcc (riscv*-*-elf* | riscv*-*-rtems*): Use custom multilibs for riscv32-*-rtems* and riscv64-*-rtems*. * config/riscv/rtems64.h: New file. * config/riscv/t-rtems: Likewise. * config/riscv/t-rtems64: Likewise. --- gcc/config.gcc | 24 +++++++++++++++--------- gcc/config/riscv/rtems64.h | 34 ++++++++++++++++++++++++++++++++++ gcc/config/riscv/t-rtems | 16 ++++++++++++++++ gcc/config/riscv/t-rtems64 | 12 ++++++++++++ 4 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 gcc/config/riscv/rtems64.h create mode 100644 gcc/config/riscv/t-rtems create mode 100644 gcc/config/riscv/t-rtems64 diff --git a/gcc/config.gcc b/gcc/config.gcc index d73e2cbc99a..d8cebc6dd18 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2075,10 +2075,21 @@ riscv*-*-linux*) ;; riscv*-*-elf* | riscv*-*-rtems*) tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h" - case "x${enable_multilib}" in - xno) ;; - xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;; - *) echo "Unknown value for enable_multilib"; exit 1 + case ${target} in + riscv32-*-rtems*) + tm_file="${tm_file} rtems.h riscv/rtems.h" + tmake_file="${tmake_file} riscv/t-rtems" + ;; + riscv64-*-rtems*) + tm_file="${tm_file} rtems.h riscv/rtems64.h" + tmake_file="${tmake_file} riscv/t-rtems64" + ;; + *) + case "x${enable_multilib}" in + xno) ;; + xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;; + *) echo "Unknown value for enable_multilib"; exit 1 + esac esac tmake_file="${tmake_file} riscv/t-riscv" gnu_ld=yes @@ -2086,11 +2097,6 @@ riscv*-*-elf* | riscv*-*-rtems*) # Force .init_array support. The configure script cannot always # automatically detect that GAS supports it, yet we require it. gcc_cv_initfini_array=yes - case ${target} in - riscv*-*-rtems*) - tm_file="${tm_file} rtems.h riscv/rtems.h" - ;; - esac ;; riscv*-*-freebsd*) tm_file="${tm_file} elfos.h ${fbsd_tm_file} riscv/freebsd.h" diff --git a/gcc/config/riscv/rtems64.h b/gcc/config/riscv/rtems64.h new file mode 100644 index 00000000000..f6a9d8e44d8 --- /dev/null +++ b/gcc/config/riscv/rtems64.h @@ -0,0 +1,34 @@ +/* Definitions for RISC-V RTEMS systems with ELF format. + Copyright (C) 2017-2018 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. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__rtems__"); \ + builtin_define ("__USE_INIT_FINI__"); \ + builtin_assert ("system=rtems"); \ + } while (0) + +#undef TARGET_DEFAULT_CMODEL +#define TARGET_DEFAULT_CMODEL CM_MEDANY diff --git a/gcc/config/riscv/t-rtems b/gcc/config/riscv/t-rtems new file mode 100644 index 00000000000..35703369823 --- /dev/null +++ b/gcc/config/riscv/t-rtems @@ -0,0 +1,16 @@ +MULTILIB_OPTIONS = +MULTILIB_DIRNAMES = + +MULTILIB_OPTIONS += march=rv32i/march=rv32im/march=rv32imafd/march=rv32iac/march=rv32imac/march=rv32imafc +MULTILIB_DIRNAMES += rv32i rv32im rv32imafd rv32iac rv32imac rv32imafc + +MULTILIB_OPTIONS += mabi=ilp32/mabi=ilp32f/mabi=ilp32d +MULTILIB_DIRNAMES += ilp32 ilp32f ilp32d + +MULTILIB_REQUIRED = +MULTILIB_REQUIRED += march=rv32i/mabi=ilp32 +MULTILIB_REQUIRED += march=rv32im/mabi=ilp32 +MULTILIB_REQUIRED += march=rv32imafd/mabi=ilp32d +MULTILIB_REQUIRED += march=rv32iac/mabi=ilp32 +MULTILIB_REQUIRED += march=rv32imac/mabi=ilp32 +MULTILIB_REQUIRED += march=rv32imafc/mabi=ilp32f diff --git a/gcc/config/riscv/t-rtems64 b/gcc/config/riscv/t-rtems64 new file mode 100644 index 00000000000..1d4e2b23464 --- /dev/null +++ b/gcc/config/riscv/t-rtems64 @@ -0,0 +1,12 @@ +MULTILIB_OPTIONS = +MULTILIB_DIRNAMES = + +MULTILIB_OPTIONS += march=rv64imafd/march=rv64imac +MULTILIB_DIRNAMES += rv64imafd rv64imac + +MULTILIB_OPTIONS += mabi=lp64/mabi=lp64d +MULTILIB_DIRNAMES += lp64 lp64d + +MULTILIB_REQUIRED = +MULTILIB_REQUIRED += march=rv64imafd/mabi=lp64d +MULTILIB_REQUIRED += march=rv64imac/mabi=lp64 -- 2.13.6
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel