Re: [PATCH] RISC-V: Add custom RTEMS multilibs

2018-06-14 Thread Jim Wilson
On Thu, Jun 14, 2018 at 11:59 AM, Sebastian Huber
 wrote:
> The change in config.gcc could break all RISC-V ports, e.g. some typo leading 
> to a syntax error. I would like to back port this to GCC 7 and 8.

The backports are OK with me.  Though I think you will need permission
from the branch maintainers.

Jim


Re: [PATCH] RISC-V: Add custom RTEMS multilibs

2018-06-14 Thread Sebastian Huber


- Am 14. Jun 2018 um 20:23 schrieb Jim Wilson j...@sifive.com:

> On Wed, Jun 13, 2018 at 9:57 PM, Sebastian Huber
>  wrote:
>> gcc/
>> * config.gcc (riscv*-*-elf* | riscv*-*-rtems*): Use custom
>> multilibs for *-*-rtems*.
>> * config/riscv/t-rtems: New file.
> 
> Looks OK to me.  Though I think you can probably self approve patches
> like this that only affect the riscv*-*-rtems* port.

The change in config.gcc could break all RISC-V ports, e.g. some typo leading 
to a syntax error. I would like to back port this to GCC 7 and 8.

> 
> I notice that you don't have a MULTILIB_REUSE definition as in
> t-elf-multilib.   This means you are missing rv32gc and rv64gc
> support, which might be a problem as these are common configure and
> command line choices.  The t-elf-multilib file also uses these for a
> few other combinations like rv32ic, rv32imc and ilp32f/rv32gc to
> reduce the number of libraries built.

The machine flags are defined by the board support packages and the application 
must use them.


Re: [PATCH] RISC-V: Add custom RTEMS multilibs

2018-06-14 Thread Jim Wilson
On Wed, Jun 13, 2018 at 9:57 PM, Sebastian Huber
 wrote:
> gcc/
> * config.gcc (riscv*-*-elf* | riscv*-*-rtems*): Use custom
> multilibs for *-*-rtems*.
> * config/riscv/t-rtems: New file.

Looks OK to me.  Though I think you can probably self approve patches
like this that only affect the riscv*-*-rtems* port.

I notice that you don't have a MULTILIB_REUSE definition as in
t-elf-multilib.   This means you are missing rv32gc and rv64gc
support, which might be a problem as these are common configure and
command line choices.  The t-elf-multilib file also uses these for a
few other combinations like rv32ic, rv32imc and ilp32f/rv32gc to
reduce the number of libraries built.

Jim


[PATCH] RISC-V: Add custom RTEMS multilibs

2018-06-13 Thread Sebastian Huber
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
ratinale for this change is that several existing RISC-V chips map the
RAM at 0x8000.  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.
---
 gcc/config.gcc   | 20 +++-
 gcc/config/riscv/t-rtems | 25 +
 2 files changed, 36 insertions(+), 9 deletions(-)
 create mode 100644 gcc/config/riscv/t-rtems

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c3aecbfe764..25383423721 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2085,10 +2085,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
@@ -2096,11 +2103,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/t-rtems b/gcc/config/riscv/t-rtems
new file mode 100644
index 000..41f5927fc87
--- /dev/null
+++ b/gcc/config/riscv/t-rtems
@@ -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
-- 
2.13.7