]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add custom RTEMS multilibs
authorSebastian Huber <sebastian.huber@embedded-brains.de>
Thu, 21 Jun 2018 09:36:40 +0000 (09:36 +0000)
committerSebastian Huber <sh@gcc.gnu.org>
Thu, 21 Jun 2018 09:36:40 +0000 (09:36 +0000)
Add multilib variants for -march=rv64imafd, e.g. to support the BOOMv2 core.

Add -mcmodel=medany as a variant of the 64-bit multilibs for RTEMS.  The
rationale 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 *-*-rtems*.
* config/riscv/t-rtems: New file.

From-SVN: r261838

gcc/ChangeLog
gcc/config.gcc
gcc/config/riscv/t-rtems [new file with mode: 0644]

index 4d4d9a02a9a5042a0cda536237e4826ca87b34ac..632106374ea5db107c993ee69ac5a323034b8dfa 100644 (file)
@@ -1,3 +1,12 @@
+2018-06-21  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+
+       Backport from mainline
+       2018-06-15  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+
+       * config.gcc (riscv*-*-elf* | riscv*-*-rtems*): Use custom
+       multilibs for *-*-rtems*.
+       * config/riscv/t-rtems: New file.
+
 2018-06-19  Max Filippov  <jcmvbkbc@gmail.com>
 
        Backport from mainline
index b54345dcda56110a4107752fc36ae06cb31c251d..3e41aa5b76486efe0a7a23c04bb7d029c2edada9 100644 (file)
@@ -2046,10 +2046,17 @@ 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
+       *-*-rtems*)
+         tm_file="${tm_file} rtems.h riscv/rtems.h"
+         tmake_file="${tmake_file} riscv/t-rtems"
+         ;;
+       *)
+         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
@@ -2057,11 +2064,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
        ;;
 mips*-*-netbsd*)                       # NetBSD/mips, either endian.
        target_cpu_default="MASK_ABICALLS"
diff --git a/gcc/config/riscv/t-rtems b/gcc/config/riscv/t-rtems
new file mode 100644 (file)
index 0000000..41f5927
--- /dev/null
@@ -0,0 +1,25 @@
+MULTILIB_OPTIONS       =
+MULTILIB_DIRNAMES      =
+
+MULTILIB_OPTIONS       += march=rv32i/march=rv32im/march=rv32imafd/march=rv32iac/march=rv32imac/march=rv32imafc/march=rv64imafd/march=rv64imac/march=rv64imafdc
+MULTILIB_DIRNAMES      += rv32i       rv32im       rv32imafd       rv32iac       rv32imac       rv32imafc       rv64imafd       rv64imac       rv64imafdc
+
+MULTILIB_OPTIONS       += mabi=ilp32/mabi=ilp32f/mabi=ilp32d/mabi=lp64/mabi=lp64d
+MULTILIB_DIRNAMES      += ilp32      ilp32f      ilp32d      lp64      lp64d
+
+MULTILIB_OPTIONS       += mcmodel=medany
+MULTILIB_DIRNAMES      += medany
+
+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
+MULTILIB_REQUIRED      += march=rv64imafd/mabi=lp64d
+MULTILIB_REQUIRED      += march=rv64imafd/mabi=lp64d/mcmodel=medany
+MULTILIB_REQUIRED      += march=rv64imac/mabi=lp64
+MULTILIB_REQUIRED      += march=rv64imac/mabi=lp64/mcmodel=medany
+MULTILIB_REQUIRED      += march=rv64imafdc/mabi=lp64d
+MULTILIB_REQUIRED      += march=rv64imafdc/mabi=lp64d/mcmodel=medany