diff mbox

[v2,06/17] uclibc: gcc >= 4.9 can build a thumb/thread uclibc

Message ID 1458335299-27409-7-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni March 18, 2016, 9:08 p.m. UTC
Older gcc were not capable of building a uClibc library, with threads
enabled, in Thumb1. However, the issues have been fixed since gcc 4.9,
so this commit narrows down the condition to just gcc 4.7 and 4.8.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/uclibc/uclibc.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Arnout Vandecappelle March 19, 2016, 3:53 p.m. UTC | #1
On 03/18/16 22:08, Thomas Petazzoni wrote:
> Older gcc were not capable of building a uClibc library, with threads
> enabled, in Thumb1. However, the issues have been fixed since gcc 4.9,
> so this commit narrows down the condition to just gcc 4.7 and 4.8.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> ---
>   package/uclibc/uclibc.mk | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
> index c981d80..ad94494 100644
> --- a/package/uclibc/uclibc.mk
> +++ b/package/uclibc/uclibc.mk
> @@ -75,8 +75,10 @@ define UCLIBC_ARM_ABI_CONFIG
>   	$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI,$(@D)/.config)
>   endef
>
> -# Thumb build is broken with threads, build in ARM mode
> -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
> +# Thumb1 build is broken with threads with old gcc versions (4.7 and
> +# 4.8). Since all cores supporting Thumb1 also support ARM, we use ARM
> +# code in this case.
> +ifeq ($(BR2_GCC_VERSION_4_7_X)$(BR2_GCC_VERSION_4_8_X):$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),y:yy)

  This line is a bit long so would be nicer to split off into separate 
variables. This kind of logic is also much easier to do (and certainly easier to 
understand) in Kconfig than in the make language - like we had for BX before you 
removed it.

  However, that is something for another patch, so my Rev-by stands.

  Regards,
  Arnout

>   UCLIBC_EXTRA_CFLAGS += -marm
>   endif
>
>
Thomas Petazzoni March 29, 2016, 10:18 p.m. UTC | #2
Hello,

On Sat, 19 Mar 2016 16:53:16 +0100, Arnout Vandecappelle wrote:

> > -# Thumb build is broken with threads, build in ARM mode
> > -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
> > +# Thumb1 build is broken with threads with old gcc versions (4.7 and
> > +# 4.8). Since all cores supporting Thumb1 also support ARM, we use ARM
> > +# code in this case.
> > +ifeq ($(BR2_GCC_VERSION_4_7_X)$(BR2_GCC_VERSION_4_8_X):$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),y:yy)
> 
>   This line is a bit long so would be nicer to split off into separate 
> variables. This kind of logic is also much easier to do (and certainly easier to 
> understand) in Kconfig than in the make language - like we had for BX before you 
> removed it.

I agree this line is a bit long. But how would be named this Config.in
option? BR2_PACKAGE_UCLIBC_FORCE_ARM ?

config BR2_PACKAGE_UCLIBC_FORCE_ARM
	bool
	depends on BR2_ARM_INSTRUCTIONS_THUMB
	depends on BR2_TOOLCHAIN_HAS_THREADS
	default y if BR2_GCC_VERSION_4_7_X
	default y if BR2_GCC_VERSION_4_8_X

Something like that?

Thomas
Arnout Vandecappelle March 29, 2016, 10:49 p.m. UTC | #3
On 03/30/16 00:18, Thomas Petazzoni wrote:
> Hello,
>
> On Sat, 19 Mar 2016 16:53:16 +0100, Arnout Vandecappelle wrote:
>
>>> -# Thumb build is broken with threads, build in ARM mode
>>> -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
>>> +# Thumb1 build is broken with threads with old gcc versions (4.7 and
>>> +# 4.8). Since all cores supporting Thumb1 also support ARM, we use ARM
>>> +# code in this case.
>>> +ifeq ($(BR2_GCC_VERSION_4_7_X)$(BR2_GCC_VERSION_4_8_X):$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),y:yy)
>>
>>    This line is a bit long so would be nicer to split off into separate
>> variables. This kind of logic is also much easier to do (and certainly easier to
>> understand) in Kconfig than in the make language - like we had for BX before you
>> removed it.
>
> I agree this line is a bit long. But how would be named this Config.in
> option? BR2_PACKAGE_UCLIBC_FORCE_ARM ?

  Maybe FORCE_NO_THUMB?

>
> config BR2_PACKAGE_UCLIBC_FORCE_ARM
> 	bool
> 	depends on BR2_ARM_INSTRUCTIONS_THUMB
> 	depends on BR2_TOOLCHAIN_HAS_THREADS
> 	default y if BR2_GCC_VERSION_4_7_X
> 	default y if BR2_GCC_VERSION_4_8_X
>
> Something like that?

  Yep, that's it.


  Regards,
  Arnout

>
> Thomas
>
diff mbox

Patch

diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index c981d80..ad94494 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -75,8 +75,10 @@  define UCLIBC_ARM_ABI_CONFIG
 	$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI,$(@D)/.config)
 endef
 
-# Thumb build is broken with threads, build in ARM mode
-ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
+# Thumb1 build is broken with threads with old gcc versions (4.7 and
+# 4.8). Since all cores supporting Thumb1 also support ARM, we use ARM
+# code in this case.
+ifeq ($(BR2_GCC_VERSION_4_7_X)$(BR2_GCC_VERSION_4_8_X):$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),y:yy)
 UCLIBC_EXTRA_CFLAGS += -marm
 endif