Re: [PATCH] Add "riscv" as an alias for "riscv32"

2018-06-22 Thread Palmer Dabbelt

On Fri, 22 Jun 2018 03:22:57 PDT (-0700), rjo...@redhat.com wrote:

On Thu, Jun 21, 2018 at 05:25:59PM -0700, Palmer Dabbelt wrote:

On Thu, 21 Jun 2018 16:16:51 PDT (-0700), b...@air.net.au wrote:
>On Wed, Jun 20, 2018 at 10:24:41AM -0700, Palmer Dabbelt wrote:
>
>>2018-06-11  Palmer Dabbelt  
>>
>>* config.sub: Add "riscv-*" as an alias for "riscv32-*".
>>* testsuite/config-sub.data: Add tests for the "riscv-*" alias.
>
>In light of the discussion, I think this patch is OK. Do we want to
>change config.guess to always emit riscv for the native configuration,
>like so?
>
>diff --git a/config.guess b/config.guess
>index 883a671..c501b8a 100755
>--- a/config.guess
>+++ b/config.guess
>@@ -1025,7 +1025,7 @@ EOF
>echo powerpcle-unknown-linux-"$LIBC"
>exit ;;
> riscv32:Linux:*:* | riscv64:Linux:*:*)
>-   echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
>+   echo riscv-unknown-linux-"$LIBC"
>exit ;;
> s390:Linux:*:* | s390x:Linux:*:*)
>echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"

That sounds reasonable to me.  The only wrinkle I can see here is
that if "riscv-*" maps to "riscv32-*", you're on a 64-bit system,
and we assume that compilers running on RISC-V machines default to a
native target, does that mean that the logical "riscv32-*" is a
64-bit compiler?

It's not a big deal as configure scripts should just be matching
"riscv*-*" anyway, but maybe it's a problem for native userspace.
I'm adding some native distro people to see if anyone has any
opinions, as I'm far from an expert on this sort of stuff.


From the Fedora point of view we're only ever going to be using
‘riscv64-*’ here, and we're not interested in 32 bit, so I guess it
doesn't really affect us.

I'm interested in why you decided that 32 bit would be the default for
this though.  Wouldn't it make more sense to try to guess the current
bit length and use that (maybe difficult for cross-compilation however...)


I wanted the mapping to be static.

___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] Add "riscv" as an alias for "riscv32"

2018-06-22 Thread John Ericson
DJ's and Karsten's concerns match my config-for-target vs 
config-for-toolchain distinction.


arm*- riscv-* and x86-* do make sense as compiler prefixes that indicate 
toolchain support for a set of targets. But when we think of a toolchain 
+ a set of standard libraries (without multilib), only a single target 
makes sense, so those 3 are all bad.


On the other hand riscv32 is bad because, as I just learned, there are 
*3* base ISAs, not *2*, and riscv32e and riscv32i are totally 
incompatible. So for targets we need riscv32e-* riscv32i-* riscv64e-*. 
riscv{32,64} may be what uname does, but uname's output is the most 
harmful of here: it's too vague for actual targets, and too specific for 
stdlib-less embedded compiler prefixes, so both camps are left wanting.


As to riscv-* I see the exact-target and toolchain use-cases as 
fundamentally irreconcilable, so GNU config should just learn the 
difference so as to satisfy everyone *without* compromise. If we can 
agree on this I volunteer to immediately do all the work---I now have 
enough information from this thread.


And finally, the original patch is no good in my mind even as a first 
incremental step, as the unconditional riscv- to riscv32- desugar is 
also wrong for embedded and desktop/distro alike.


John

P.S. Sorry to be basically repeating myself, but I think I was too wordy 
the first time / lost within the fast pace of the thread the first time 
around


___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] Add "riscv" as an alias for "riscv32"

2018-06-22 Thread Richard W.M. Jones
On Thu, Jun 21, 2018 at 05:25:59PM -0700, Palmer Dabbelt wrote:
> On Thu, 21 Jun 2018 16:16:51 PDT (-0700), b...@air.net.au wrote:
> >On Wed, Jun 20, 2018 at 10:24:41AM -0700, Palmer Dabbelt wrote:
> >
> >>2018-06-11  Palmer Dabbelt  
> >>
> >>* config.sub: Add "riscv-*" as an alias for "riscv32-*".
> >>* testsuite/config-sub.data: Add tests for the "riscv-*" alias.
> >
> >In light of the discussion, I think this patch is OK. Do we want to
> >change config.guess to always emit riscv for the native configuration,
> >like so?
> >
> >diff --git a/config.guess b/config.guess
> >index 883a671..c501b8a 100755
> >--- a/config.guess
> >+++ b/config.guess
> >@@ -1025,7 +1025,7 @@ EOF
> > echo powerpcle-unknown-linux-"$LIBC"
> > exit ;;
> > riscv32:Linux:*:* | riscv64:Linux:*:*)
> >-echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
> >+echo riscv-unknown-linux-"$LIBC"
> > exit ;;
> > s390:Linux:*:* | s390x:Linux:*:*)
> > echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
> 
> That sounds reasonable to me.  The only wrinkle I can see here is
> that if "riscv-*" maps to "riscv32-*", you're on a 64-bit system,
> and we assume that compilers running on RISC-V machines default to a
> native target, does that mean that the logical "riscv32-*" is a
> 64-bit compiler?
> 
> It's not a big deal as configure scripts should just be matching
> "riscv*-*" anyway, but maybe it's a problem for native userspace.
> I'm adding some native distro people to see if anyone has any
> opinions, as I'm far from an expert on this sort of stuff.

From the Fedora point of view we're only ever going to be using
‘riscv64-*’ here, and we're not interested in 32 bit, so I guess it
doesn't really affect us.

I'm interested in why you decided that 32 bit would be the default for
this though.  Wouldn't it make more sense to try to guess the current
bit length and use that (maybe difficult for cross-compilation however...)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


Re: [PATCH] Add "riscv" as an alias for "riscv32"

2018-06-22 Thread Ben Elliston
On Fri, Jun 22, 2018 at 08:51:23AM +0100, Richard W.M. Jones wrote:

> Is there some more context to this discussion I can read?

http://lists.gnu.org/archive/html/config-patches/2018-06/index.html

Cheers, Ben


signature.asc
Description: PGP signature
___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches


[PATCH] Add "riscv" as an alias for "riscv32"

2018-06-20 Thread Palmer Dabbelt
Most RISC-V toolchains can generate code for all RISC-V targets, but are
currently named "riscv32-*" and "riscv64-*".  Users have suggested that
these names are unintuiative and would like tuples to be "riscv-*".

This patch enables "riscv-*" tuples by adding a config.sub rule that
replaces "riscv-*" with "riscv32-*".  The first ISA described by the
RISC-V specification is RV32I, a 32-bit ISA, so making "riscv-*" mean
32-bit seems like the sane way to go.  There are also handful of tests
added, which all pass for me.

This has been discussed on various mailing lists a half dozen times, but
I never got around to submitting a patch.

2018-06-11  Palmer Dabbelt  

* config.sub: Add "riscv-*" as an alias for "riscv32-*".
* testsuite/config-sub.data: Add tests for the "riscv-*" alias.

CC: Sebastian Huber 
Signed-off-by: Palmer Dabbelt 
---
 config.sub| 6 ++
 testsuite/config-sub.data | 5 +
 2 files changed, 11 insertions(+)

diff --git a/config.sub b/config.sub
index d1f5b5490349..32be6f6a56db 100755
--- a/config.sub
+++ b/config.sub
@@ -1125,6 +1125,12 @@ case $basic_machine in
ps2)
basic_machine=i386-ibm
;;
+   riscv)
+   basic_machine=riscv32-unknown
+   ;;
+   riscv-*)
+   basic_machine=`echo "$basic_machine" | sed 's/^riscv/riscv32/'`
+   ;;
rm[46]00)
basic_machine=mips-siemens
;;
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index 8013ead85eb0..79241bdffec4 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -412,6 +412,11 @@ pyramid
pyramid-unknown-none
 rdos32 i386-pc-rdos
 rdos64 x86_64-pc-rdos
 rdos   x86_64-pc-rdos
+riscv-company-elf  riscv32-company-elf
+riscv-company-hcos riscv32-company-hcos
+riscv-elf  riscv32-unknown-elf
+riscv-linuxriscv32-unknown-linux-gnu
+riscv  riscv32-unknown-none
 riscv32-company-elfriscv32-company-elf
 riscv32-company-hcos   riscv32-company-hcos
 riscv32-elfriscv32-unknown-elf
-- 
2.16.4


___
config-patches mailing list
config-patches@gnu.org
https://lists.gnu.org/mailman/listinfo/config-patches