[Buildroot] [PATCH 8/9] arc/riscv: get rid of immediate-assignment

Arnout Vandecappelle arnout at mind.be
Sun Oct 27 09:56:24 UTC 2019



On 26/10/2019 10:46, Yann E. MORIN wrote:
> Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
> ---
>  arch/arch.mk.riscv | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arch.mk.riscv b/arch/arch.mk.riscv
> index f3bf2b3467..da2188706c 100644
> --- a/arch/arch.mk.riscv
> +++ b/arch/arch.mk.riscv
> @@ -5,26 +5,26 @@
>  
>  ifeq ($(BR2_riscv),y)
>  
> -ifeq ($(BR2_RISCV_64),y)
> -GCC_TARGET_ARCH := rv64i
> -else
> -GCC_TARGET_ARCH := rv32i
> -endif
> -
>  ifeq ($(BR2_RISCV_ISA_RVM),y)
> -GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)m
> +GCC_TARGET_ARCH_SUFFIX += m
>  endif
>  ifeq ($(BR2_RISCV_ISA_RVA),y)
> -GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)a
> +GCC_TARGET_ARCH_SUFFIX += a
>  endif
>  ifeq ($(BR2_RISCV_ISA_RVF),y)
> -GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)f
> +GCC_TARGET_ARCH_SUFFIX += f
>  endif
>  ifeq ($(BR2_RISCV_ISA_RVD),y)
> -GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)d
> +GCC_TARGET_ARCH_SUFFIX += d
>  endif
>  ifeq ($(BR2_RISCV_ISA_RVC),y)
> -GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
> +GCC_TARGET_ARCH_SUFFIX += c
> +endif
> +
> +ifeq ($(BR2_RISCV_64),y)
> +GCC_TARGET_ARCH = rv64i$(subst $(space),,$(GCC_TARGET_ARCH_SUFFIX))
> +else
> +GCC_TARGET_ARCH = rv32i$(subst $(space),,$(GCC_TARGET_ARCH_SUFFIX))
>  endif

 I think we're loosing a bit of symmetry with this approach. How about this?

GCC_TARGET_ARCH_COMPONENTS = \
	rv \
	$(if $(BR2_RISCV_64),64,32) \
	i \
	$(if $(BR2_RISCV_ISA_RVM),m) \
	...

?

Of course, we could just immediately do

GCC_TARGET_ARCH_COMPONENTS = rv$(if $(BR2_RISCV_64),64,32)i$(if
$(BR2_RISCV_ISA_RVM),m)..

but that's majorly ugly...


 Anyway, this is a bit of bikeshedding, so I haven't marked as Changes
Requested, but I didn't apply yet either.

 BTW, note that check-package does NOT fail on the concatenations that are still
left in this file, because it's inside a conditional. So maybe that should be
fixed as well.


 Regards,
 Arnout

>  
>  endif
> 



More information about the buildroot mailing list