Patchwork [11/15] gcc-common.inc: Consider hardfp knob for configuring toolchain

login
register
mail settings
Submitter Saul Wold
Date May 15, 2011, 1:32 a.m.
Message ID <212bfaaefe0979c155069b6d3a0d42205a398a67.1305422996.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/4057/
State New, archived
Headers show

Comments

Saul Wold - May 15, 2011, 1:32 a.m.
From: Khem Raj <raj.khem@gmail.com>

pass --with-float=hard|soft depending upon ARM_FP_ABI settings

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-common.inc |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
Richard Purdie - May 16, 2011, 2:44 p.m.
Hi Khem,

I've a concern about ending up with several different variables all
doing the same thing. Why do we need both TARGET_FPU and ARM_FP_ABI?
Couldn't we just have values or "hard, sort or empty" for TARGET_FPU?

Cheers,

Richard

On Sat, 2011-05-14 at 18:32 -0700, Saul Wold wrote:
> From: Khem Raj <raj.khem@gmail.com>
> 
> pass --with-float=hard|soft depending upon ARM_FP_ABI settings
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/gcc/gcc-common.inc |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
> index a3fa234..8b7c3ad 100644
> --- a/meta/recipes-devtools/gcc/gcc-common.inc
> +++ b/meta/recipes-devtools/gcc/gcc-common.inc
> @@ -8,10 +8,17 @@ NATIVEDEPS = ""
>  inherit autotools gettext
>  
>  FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
> -
>  def get_gcc_fpu_setting(bb, d):
> -    if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
> -        return "--with-float=soft"
> +    if bb.data.getVar('TARGET_FPU', d, True) in [ 'soft', 'hard'] and bb.data.getVar('TARGET_OS', d, True).find('linux') >= 0 :
> +        # ARM_FP_ABI could be either 'hardfp' or 'softfp'
> +        arm_fpabi = bb.data.getVar('ARM_FP_ABI', d, True) or ""
> +        if arm_fpabi != "":
> +            if arm_fpabi  == "hardfp":
> +                # reset it to whatever gcc --with-float configure expects which is either 'softfp' or 'hard'
> +                arm_fpabi = "hard"
> +            return "--with-float=" + arm_fpabi
> +        else:
> +            return "--with-float=" + bb.data.getVar('TARGET_FPU', d, True)
>      return ""
>  
>  def get_gcc_mips_plt_setting(bb, d):
Koen Kooi - May 16, 2011, 3:21 p.m.
both softp and hardfp use the actual hardware fpu, but have different calling conventions and are incompatible. So you need vars.

Op 16 mei 2011 om 16:44 heeft Richard Purdie <richard.purdie@linuxfoundation.org> het volgende geschreven:

> Hi Khem,
> 
> I've a concern about ending up with several different variables all
> doing the same thing. Why do we need both TARGET_FPU and ARM_FP_ABI?
> Couldn't we just have values or "hard, sort or empty" for TARGET_FPU?
> 
> Cheers,
> 
> Richard
> 
> On Sat, 2011-05-14 at 18:32 -0700, Saul Wold wrote:
>> From: Khem Raj <raj.khem@gmail.com>
>> 
>> pass --with-float=hard|soft depending upon ARM_FP_ABI settings
>> 
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>> meta/recipes-devtools/gcc/gcc-common.inc |   13 ++++++++++---
>> 1 files changed, 10 insertions(+), 3 deletions(-)
>> 
>> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
>> index a3fa234..8b7c3ad 100644
>> --- a/meta/recipes-devtools/gcc/gcc-common.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-common.inc
>> @@ -8,10 +8,17 @@ NATIVEDEPS = ""
>> inherit autotools gettext
>> 
>> FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
>> -
>> def get_gcc_fpu_setting(bb, d):
>> -    if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
>> -        return "--with-float=soft"
>> +    if bb.data.getVar('TARGET_FPU', d, True) in [ 'soft', 'hard'] and bb.data.getVar('TARGET_OS', d, True).find('linux') >= 0 :
>> +        # ARM_FP_ABI could be either 'hardfp' or 'softfp'
>> +        arm_fpabi = bb.data.getVar('ARM_FP_ABI', d, True) or ""
>> +        if arm_fpabi != "":
>> +            if arm_fpabi  == "hardfp":
>> +                # reset it to whatever gcc --with-float configure expects which is either 'softfp' or 'hard'
>> +                arm_fpabi = "hard"
>> +            return "--with-float=" + arm_fpabi
>> +        else:
>> +            return "--with-float=" + bb.data.getVar('TARGET_FPU', d, True)
>>     return ""
>> 
>> def get_gcc_mips_plt_setting(bb, d):
> 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Khem Raj - May 16, 2011, 5:06 p.m.
On Mon, May 16, 2011 at 7:44 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> Hi Khem,
>
> I've a concern about ending up with several different variables all
> doing the same thing. Why do we need both TARGET_FPU and ARM_FP_ABI?
> Couldn't we just have values or "hard, sort or empty" for TARGET_FPU?
>

As koen already said we have two things here. what type of fpu to use
and second case what type of function calling conventions to use
when we select a hard fpu. GCC can use FPU instructions even when
using non FPU calling convention thats what is conveyed with
TARGET_FPU. hardfp calling convention is only possible when you have a
real fpu available and is more efficient in many applications
so with this patch we can select FP reg argument passing in function
calling conventions per hardfp or softfp ABI.

> Cheers,
>
> Richard
>
> On Sat, 2011-05-14 at 18:32 -0700, Saul Wold wrote:
>> From: Khem Raj <raj.khem@gmail.com>
>>
>> pass --with-float=hard|soft depending upon ARM_FP_ABI settings
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  meta/recipes-devtools/gcc/gcc-common.inc |   13 ++++++++++---
>>  1 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
>> index a3fa234..8b7c3ad 100644
>> --- a/meta/recipes-devtools/gcc/gcc-common.inc
>> +++ b/meta/recipes-devtools/gcc/gcc-common.inc
>> @@ -8,10 +8,17 @@ NATIVEDEPS = ""
>>  inherit autotools gettext
>>
>>  FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
>> -
>>  def get_gcc_fpu_setting(bb, d):
>> -    if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
>> -        return "--with-float=soft"
>> +    if bb.data.getVar('TARGET_FPU', d, True) in [ 'soft', 'hard'] and bb.data.getVar('TARGET_OS', d, True).find('linux') >= 0 :
>> +        # ARM_FP_ABI could be either 'hardfp' or 'softfp'
>> +        arm_fpabi = bb.data.getVar('ARM_FP_ABI', d, True) or ""
>> +        if arm_fpabi != "":
>> +            if arm_fpabi  == "hardfp":
>> +                # reset it to whatever gcc --with-float configure expects which is either 'softfp' or 'hard'
>> +                arm_fpabi = "hard"
>> +            return "--with-float=" + arm_fpabi
>> +        else:
>> +            return "--with-float=" + bb.data.getVar('TARGET_FPU', d, True)
>>      return ""
>>
>>  def get_gcc_mips_plt_setting(bb, d):
>
>
>

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index a3fa234..8b7c3ad 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -8,10 +8,17 @@  NATIVEDEPS = ""
 inherit autotools gettext
 
 FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/gcc-${PV}"
-
 def get_gcc_fpu_setting(bb, d):
-    if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
-        return "--with-float=soft"
+    if bb.data.getVar('TARGET_FPU', d, True) in [ 'soft', 'hard'] and bb.data.getVar('TARGET_OS', d, True).find('linux') >= 0 :
+        # ARM_FP_ABI could be either 'hardfp' or 'softfp'
+        arm_fpabi = bb.data.getVar('ARM_FP_ABI', d, True) or ""
+        if arm_fpabi != "":
+            if arm_fpabi  == "hardfp":
+                # reset it to whatever gcc --with-float configure expects which is either 'softfp' or 'hard'
+                arm_fpabi = "hard"
+            return "--with-float=" + arm_fpabi
+        else:
+            return "--with-float=" + bb.data.getVar('TARGET_FPU', d, True)
     return ""
 
 def get_gcc_mips_plt_setting(bb, d):