[PATCH RESEND] riscv: don't specify -mno-save-restore when building with clang

Palmer Dabbelt palmer at dabbelt.com
Tue Jul 28 11:20:45 EDT 2020


On Tue, 28 Jul 2020 06:12:52 PDT (-0700), tklauser at distanz.ch wrote:
> Clang doesn't support -msave-restore and -mno-save-restore. This avoids
> the following message emitted by clang:
>
>   '-save-restore' is not a recognized feature for this target (ignoring feature)
>
> Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
> ---
> Resent due to infradead.org mailing list issues.
>
>  arch/riscv/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index fb6e37db836d..cd3720bc45e8 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -44,7 +44,9 @@ riscv-march-$(CONFIG_RISCV_ISA_C)	:= $(riscv-march-y)c
>  KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
>  KBUILD_AFLAGS += -march=$(riscv-march-y)
>
> +ifndef CONFIG_CC_IS_CLANG
>  KBUILD_CFLAGS += -mno-save-restore
> +endif
>  KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
>
>  ifeq ($(CONFIG_CMODEL_MEDLOW),y)

Thanks, this one didn't make it the first time.  Is there a reason we can't use
cc-option here?  IIRC that's what we use for the other compiler options that
may be unimplemented, and it has the advantage of avoiding encoding specific
compilers into the build system.



More information about the linux-riscv mailing list