Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS
@ 2016-10-18 18:51 Arnout Vandecappelle
  2016-10-18 18:51 ` [Buildroot] [PATCH 2/2] MIPS: add support for MSA Arnout Vandecappelle
  2016-10-18 18:57 ` [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-10-18 18:51 UTC (permalink / raw)
  To: buildroot

Currently, the additional flags encoded in the toolchain wrapper are
limited to BR2_TARGET_OPTIMIZATION. However, we are going to add more
flags to it, so it is convenient to have a TARGET_FLAGS variable
that collects all of them and do the list-to-array conversion on all
of them together.

The variable is called TARGET_FLAGS because later it will be modified
to include all the flags that we pass to the toolchain wrapper, and
it will also be used as the base for TARGET_CFLAGS etc.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 toolchain/toolchain-wrapper.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index af39071..8939650 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -9,14 +9,15 @@ else
 TOOLCHAIN_WRAPPER_HASH_STYLE = both
 endif
 
+TARGET_FLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
+
 TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
 TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
 
 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
 # separate argument when used in execv() by the toolchain wrapper.
-TOOLCHAIN_WRAPPER_OPTS = \
-	$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
-TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
+TOOLCHAIN_WRAPPER_ARGS += \
+	-DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TARGET_FLAGS),"$(f)"$(comma))'
 
 ifeq ($(BR2_CCACHE),y)
 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
-- 
2.9.3

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

* [Buildroot] [PATCH 2/2] MIPS: add support for MSA
  2016-10-18 18:51 [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
@ 2016-10-18 18:51 ` Arnout Vandecappelle
  2016-10-18 18:57 ` [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
  1 sibling, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-10-18 18:51 UTC (permalink / raw)
  To: buildroot

From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
[Arnout: use the TARGET_FLAGS variable]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
v2: use the TARGET_FLAGS variable introduced by the previous patch
   (Arnout)
---
 arch/Config.in.mips            | 17 +++++++++++++++++
 toolchain/toolchain-wrapper.mk |  7 +++++++
 2 files changed, 24 insertions(+)

diff --git a/arch/Config.in.mips b/arch/Config.in.mips
index f7bfa21..fb9053c 100644
--- a/arch/Config.in.mips
+++ b/arch/Config.in.mips
@@ -16,6 +16,14 @@ config BR2_MIPS_CPU_MIPS64R5
 config BR2_MIPS_CPU_MIPS64R6
 	bool
 
+# mips cpu features
+config BR2_MIPS_CPU_HAS_MSA
+	bool
+
+# for some cores, MSA support is optional
+config BR2_MIPS_CPU_MAYBE_HAS_MSA
+	bool
+
 choice
 	prompt "Target Architecture Variant"
 	depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
@@ -113,6 +121,15 @@ config BR2_MIPS_SOFT_FLOAT
 	  floating point functions, then everything will need to be
 	  compiled with soft floating point support (-msoft-float).
 
+config BR2_MIPS_ENABLE_MSA
+	bool "Enable MIPS SIMD Architecture (MSA) support"
+	depends on BR2_MIPS_CPU_MAYBE_HAS_MSA && !BR2_SOFT_FLOAT
+	select BR2_MIPS_CPU_HAS_MSA
+	help
+	  For some CPU cores, the MSA extension is optional.
+	  Select this option if you are certain your particular
+	  implementation has MSA support and you want to use it.
+
 config BR2_ARCH
 	default "mips"		if BR2_mips
 	default "mipsel"	if BR2_mipsel
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 8939650..76fd557 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -9,6 +9,13 @@ else
 TOOLCHAIN_WRAPPER_HASH_STYLE = both
 endif
 
+# MIPS optimization flags
+ifeq ($(BR2_MIPS_CPU_HAS_MSA),y)
+TARGET_FLAGS += -mmsa
+endif
+
+# Keep BR2_TARGET_OPTIMIZATION as the last one since it may be used
+# to override the automatically added options above.
 TARGET_FLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
 
 TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
-- 
2.9.3

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

* [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS
  2016-10-18 18:51 [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
  2016-10-18 18:51 ` [Buildroot] [PATCH 2/2] MIPS: add support for MSA Arnout Vandecappelle
@ 2016-10-18 18:57 ` Arnout Vandecappelle
  2016-10-25 21:41   ` Thomas Petazzoni
  1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-10-18 18:57 UTC (permalink / raw)
  To: buildroot

 Oops, I forgot to add a cover letter...

On 18-10-16 20:51, Arnout Vandecappelle (Essensium/Mind) wrote:
> Currently, the additional flags encoded in the toolchain wrapper are
> limited to BR2_TARGET_OPTIMIZATION. However, we are going to add more
> flags to it, so it is convenient to have a TARGET_FLAGS variable
> that collects all of them and do the list-to-array conversion on all
> of them together.
> 
> The variable is called TARGET_FLAGS because later it will be modified
> to include all the flags that we pass to the toolchain wrapper, and
> it will also be used as the base for TARGET_CFLAGS etc.

 So this is a part of a series I'm trying to build that will sanitize the flags
passed to the wrapper and passed to the build systems. The idea is that all the
flags that are currently hardcoded in toolchain-wrapper.c will move into
TARGET_FLAGS, and that all flags that are currently added to TARGET_CFLAGS but
not to the wrapper get added to TARGET_FLAGS as well.

 I have only lightly tested this; Vincent, please include this in your series
and test for real.

 I wanted to push this patch fast so Vicente can use it in his series. However,
the idea is to move all this setting of flags into a new .mk file. I was
thinking of toolchain/toolchain-flags.mk. If anyone has better ideas, please
speak up!

 Regards,
 Arnout

> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
>  toolchain/toolchain-wrapper.mk | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
> index af39071..8939650 100644
> --- a/toolchain/toolchain-wrapper.mk
> +++ b/toolchain/toolchain-wrapper.mk
> @@ -9,14 +9,15 @@ else
>  TOOLCHAIN_WRAPPER_HASH_STYLE = both
>  endif
>  
> +TARGET_FLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
> +
>  TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
>  TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
>  
>  # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
>  # separate argument when used in execv() by the toolchain wrapper.
> -TOOLCHAIN_WRAPPER_OPTS = \
> -	$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
> -TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
> +TOOLCHAIN_WRAPPER_ARGS += \
> +	-DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TARGET_FLAGS),"$(f)"$(comma))'
>  
>  ifeq ($(BR2_CCACHE),y)
>  TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS
  2016-10-18 18:57 ` [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
@ 2016-10-25 21:41   ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-10-25 21:41 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 18 Oct 2016 20:57:55 +0200, Arnout Vandecappelle wrote:

>  So this is a part of a series I'm trying to build that will sanitize the flags
> passed to the wrapper and passed to the build systems. The idea is that all the
> flags that are currently hardcoded in toolchain-wrapper.c will move into
> TARGET_FLAGS, and that all flags that are currently added to TARGET_CFLAGS but
> not to the wrapper get added to TARGET_FLAGS as well.
> 
>  I have only lightly tested this; Vincent, please include this in your series
> and test for real.
> 
>  I wanted to push this patch fast so Vicente can use it in his series. However,
> the idea is to move all this setting of flags into a new .mk file. I was
> thinking of toolchain/toolchain-flags.mk. If anyone has better ideas, please
> speak up!

Following Vicente's feedback on -mmsa being unsuitable hardcoded in the
wrapper as it breaks the kernel build, I guess your PATCH 2/2 is
not suitable. And therefore, it makes PATCH 1/2 a bit useless.

Until we figure out the appropriate way of solving this problem, I've
marked those two patches as Changes Requested.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-10-25 21:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18 18:51 [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
2016-10-18 18:51 ` [Buildroot] [PATCH 2/2] MIPS: add support for MSA Arnout Vandecappelle
2016-10-18 18:57 ` [Buildroot] [PATCH 1/2] toolchain-wrapper.mk: refactor additional flags into TARGET_FLAGS Arnout Vandecappelle
2016-10-25 21:41   ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox