public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Enable riscv attributes by default for all riscv targets.
@ 2021-06-03 20:55 Jim Wilson
  2021-06-03 21:20 ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2021-06-03 20:55 UTC (permalink / raw)
  To: gcc-patches

These were only enabled for embedded elf originally because that was
the safe option, and linux had no obvious use for them.  But now that
we have new extensions coming like V that affect process state and ABIs,
the attributes are expected to be useful for linux, and may be required
by the psABI.  clang already emits them for all riscv targets.

Tested with a patched open embedded build and boot, and a native
toolchain build.

Committed.

Jim

	gcc/
	* config.gcc (riscv*-*-*): If --with-riscv-attribute not used,
	turn TARGET_RISCV_ATTRIBUTES on for all riscv targets.
---
 gcc/config.gcc | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 92fad8e20ca..6833a6c13d9 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4605,14 +4605,7 @@ case "${target}" in
 			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
 			;;
 		""|default)
-			case "${target}" in
-			riscv*-*-elf*)
-				tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
-				;;
-			*)
-				tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
-				;;
-			esac
+			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
 			;;
 		*)
 			echo "--with-riscv-attribute=${with_riscv_attribute} is not supported.  The argument must begin with yes, no or default." 1>&2
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Enable riscv attributes by default for all riscv targets.
  2021-06-03 20:55 [PATCH] RISC-V: Enable riscv attributes by default for all riscv targets Jim Wilson
@ 2021-06-03 21:20 ` Palmer Dabbelt
  2021-06-04  1:13   ` Nelson Chu
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2021-06-03 21:20 UTC (permalink / raw)
  To: Jim Wilson, nelson.chu; +Cc: gcc-patches

On Thu, 03 Jun 2021 13:55:40 PDT (-0700), Jim Wilson wrote:
> These were only enabled for embedded elf originally because that was
> the safe option, and linux had no obvious use for them.  But now that
> we have new extensions coming like V that affect process state and ABIs,
> the attributes are expected to be useful for linux, and may be required
> by the psABI.  clang already emits them for all riscv targets.
>
> Tested with a patched open embedded build and boot, and a native
> toolchain build.
>
> Committed.

Works for me.

Nelson: I'm assuming this is why the .riscv.attributes is in 
binutils-all now?  That seems fine, we should just call it out as the 
reason explicitly by splitting that out into its own commit.

>
> Jim
>
> 	gcc/
> 	* config.gcc (riscv*-*-*): If --with-riscv-attribute not used,
> 	turn TARGET_RISCV_ATTRIBUTES on for all riscv targets.
> ---
>  gcc/config.gcc | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 92fad8e20ca..6833a6c13d9 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -4605,14 +4605,7 @@ case "${target}" in
>  			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
>  			;;
>  		""|default)
> -			case "${target}" in
> -			riscv*-*-elf*)
> -				tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
> -				;;
> -			*)
> -				tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
> -				;;
> -			esac
> +			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
>  			;;
>  		*)
>  			echo "--with-riscv-attribute=${with_riscv_attribute} is not supported.  The argument must begin with yes, no or default." 1>&2

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Enable riscv attributes by default for all riscv targets.
  2021-06-03 21:20 ` Palmer Dabbelt
@ 2021-06-04  1:13   ` Nelson Chu
  0 siblings, 0 replies; 3+ messages in thread
From: Nelson Chu @ 2021-06-04  1:13 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: Jim Wilson, GCC Patches

On Fri, Jun 4, 2021 at 5:20 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Thu, 03 Jun 2021 13:55:40 PDT (-0700), Jim Wilson wrote:
> > These were only enabled for embedded elf originally because that was
> > the safe option, and linux had no obvious use for them.  But now that
> > we have new extensions coming like V that affect process state and ABIs,
> > the attributes are expected to be useful for linux, and may be required
> > by the psABI.  clang already emits them for all riscv targets.
> >
> > Tested with a patched open embedded build and boot, and a native
> > toolchain build.
> >
> > Committed.
>
> Works for me.
>
> Nelson: I'm assuming this is why the .riscv.attributes is in
> binutils-all now?  That seems fine, we should just call it out as the
> reason explicitly by splitting that out into its own commit.

Yes this patch will make .riscv.attributes always be generated, both
for elf and linux toolchains.
Got it, I will split this one into a separate commit,  thanks.

FYI, this update resolves the ABI problems for linux toolchain that I
met before,
https://sourceware.org/pipermail/binutils/2020-November/114016.html
Now linux toolchain also generate the elf architecture attributes, so
binutils will try to choose the correct ABI according to the
attributes, if user compile a assembly code without setting -mabi=.

Thanks
Nelson


> > Jim
> >
> >       gcc/
> >       * config.gcc (riscv*-*-*): If --with-riscv-attribute not used,
> >       turn TARGET_RISCV_ATTRIBUTES on for all riscv targets.
> > ---
> >  gcc/config.gcc | 9 +--------
> >  1 file changed, 1 insertion(+), 8 deletions(-)
> >
> > diff --git a/gcc/config.gcc b/gcc/config.gcc
> > index 92fad8e20ca..6833a6c13d9 100644
> > --- a/gcc/config.gcc
> > +++ b/gcc/config.gcc
> > @@ -4605,14 +4605,7 @@ case "${target}" in
> >                       tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
> >                       ;;
> >               ""|default)
> > -                     case "${target}" in
> > -                     riscv*-*-elf*)
> > -                             tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
> > -                             ;;
> > -                     *)
> > -                             tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
> > -                             ;;
> > -                     esac
> > +                     tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
> >                       ;;
> >               *)
> >                       echo "--with-riscv-attribute=${with_riscv_attribute} is not supported.  The argument must begin with yes, no or default." 1>&2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-04  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 20:55 [PATCH] RISC-V: Enable riscv attributes by default for all riscv targets Jim Wilson
2021-06-03 21:20 ` Palmer Dabbelt
2021-06-04  1:13   ` Nelson Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).