diff mbox

nettle: disable assembly optimizations for ARMv7M

Message ID 1469405759-3224-1-git-send-email-gustavo@zacarias.com.ar
State Accepted
Headers show

Commit Message

Gustavo Zacarias July 25, 2016, 12:15 a.m. UTC
It's thumb2-only and it requires ARM instructions.
Since V4 and V5 aren't enough either use the V7M knob to avoid
over-complicating the conditional. Fixes:
http://autobuild.buildroot.net/results/354/35418d33efa902d3a1a82b2cd58d8db1b1172e49/

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/nettle/nettle.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Petazzoni July 25, 2016, 8:48 p.m. UTC | #1
Hello,

On Sun, 24 Jul 2016 21:15:59 -0300, Gustavo Zacarias wrote:
> It's thumb2-only and it requires ARM instructions.
> Since V4 and V5 aren't enough either use the V7M knob to avoid
> over-complicating the conditional. Fixes:
> http://autobuild.buildroot.net/results/354/35418d33efa902d3a1a82b2cd58d8db1b1172e49/
> 
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
>  package/nettle/nettle.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/nettle/nettle.mk b/package/nettle/nettle.mk
> index c133839..a94a7fc 100644
> --- a/package/nettle/nettle.mk
> +++ b/package/nettle/nettle.mk
> @@ -15,7 +15,7 @@ NETTLE_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2
>  NETTLE_CONF_OPTS = --disable-openssl
>  
>  # ARM assembly requires v6+ ISA
> -ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5),y)
> +ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV7M),y)

I've applied, but in the end, I'm wondering if the condition wouldn't
be simpler as:

ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV6),)
NETTLE_CONF_OPTS += --disable-assembler
endif

Thanks,

Thomas
Peter Korsgaard July 26, 2016, 9:18 p.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Hello,
 > On Sun, 24 Jul 2016 21:15:59 -0300, Gustavo Zacarias wrote:
 >> It's thumb2-only and it requires ARM instructions.
 >> Since V4 and V5 aren't enough either use the V7M knob to avoid
 >> over-complicating the conditional. Fixes:
 >> http://autobuild.buildroot.net/results/354/35418d33efa902d3a1a82b2cd58d8db1b1172e49/
 >> 
 >> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
 >> ---
 >> package/nettle/nettle.mk | 2 +-
 >> 1 file changed, 1 insertion(+), 1 deletion(-)
 >> 
 >> diff --git a/package/nettle/nettle.mk b/package/nettle/nettle.mk
 >> index c133839..a94a7fc 100644
 >> --- a/package/nettle/nettle.mk
 >> +++ b/package/nettle/nettle.mk
 >> @@ -15,7 +15,7 @@ NETTLE_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2
 >> NETTLE_CONF_OPTS = --disable-openssl
 >> 
 >> # ARM assembly requires v6+ ISA
 >> -ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5),y)
 >> +ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV7M),y)

 > I've applied, but in the end, I'm wondering if the condition wouldn't
 > be simpler as:

 > ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV6),)

I take it that you mean:

ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),)

We could also simply check for ARM and THUMB2 instructions, E.G.:

# needs thumb2 and arm instructions support
ifneq ($(BR2_ARM_CPU_HAS_ARM)$(BR2_ARM_CPU_HAS_THUMB2),yy)
Thomas Petazzoni July 27, 2016, 7:15 a.m. UTC | #3
Hello,

On Tue, 26 Jul 2016 23:18:37 +0200, Peter Korsgaard wrote:

>  > ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV6),)  
> 
> I take it that you mean:
> 
> ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),)

Indeed, bad copy/paste.

> We could also simply check for ARM and THUMB2 instructions, E.G.:
> 
> # needs thumb2 and arm instructions support
> ifneq ($(BR2_ARM_CPU_HAS_ARM)$(BR2_ARM_CPU_HAS_THUMB2),yy)

I don't think this is equivalent. Indeed, ARMv6 doesn't have Thumb2 (at
least from Buildroot point of view), while the assembly code in Nettle
is OK for ARMv6.

Best regards,

Thomas
Peter Korsgaard July 27, 2016, 8:03 a.m. UTC | #4
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 >> We could also simply check for ARM and THUMB2 instructions, E.G.:
 >> 
 >> # needs thumb2 and arm instructions support
 >> ifneq ($(BR2_ARM_CPU_HAS_ARM)$(BR2_ARM_CPU_HAS_THUMB2),yy)

 > I don't think this is equivalent. Indeed, ARMv6 doesn't have Thumb2 (at
 > least from Buildroot point of view), while the assembly code in Nettle
 > is OK for ARMv6.

True, but then the commit message doesn't make any sense as it said it
required thumb2 and classic in structions.
Thomas Petazzoni July 27, 2016, 8:13 a.m. UTC | #5
Hello,

On Wed, 27 Jul 2016 10:03:17 +0200, Peter Korsgaard wrote:

>  > I don't think this is equivalent. Indeed, ARMv6 doesn't have Thumb2 (at
>  > least from Buildroot point of view), while the assembly code in Nettle
>  > is OK for ARMv6.  
> 
> True, but then the commit message doesn't make any sense as it said it
> required thumb2 and classic in structions.

That's not what the commit message said. The commit message said:

"""
    nettle: disable assembly optimizations for ARMv7M
    
    It's thumb2-only and it requires ARM instructions.
"""

So it did not say at all that nettle requires Thumb-2 *and* classic. It
said that ARMv7M provides only thumb2, and that nettle requires ARM
instructions.

Thomas
Peter Korsgaard July 27, 2016, 9:23 a.m. UTC | #6
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 > That's not what the commit message said. The commit message said:

 > """
 >     nettle: disable assembly optimizations for ARMv7M
    
 >     It's thumb2-only and it requires ARM instructions.
 > """

 > So it did not say at all that nettle requires Thumb-2 *and* classic. It
 > said that ARMv7M provides only thumb2, and that nettle requires ARM
 > instructions.

Ahh, I read "It" as referring to the nettle code, not ARMv7M cores.
diff mbox

Patch

diff --git a/package/nettle/nettle.mk b/package/nettle/nettle.mk
index c133839..a94a7fc 100644
--- a/package/nettle/nettle.mk
+++ b/package/nettle/nettle.mk
@@ -15,7 +15,7 @@  NETTLE_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2
 NETTLE_CONF_OPTS = --disable-openssl
 
 # ARM assembly requires v6+ ISA
-ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5),y)
+ifeq ($(BR2_ARM_CPU_ARMV4)$(BR2_ARM_CPU_ARMV5)$(BR2_ARM_CPU_ARMV7M),y)
 NETTLE_CONF_OPTS += --disable-assembler
 endif