Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
@ 2023-02-22 14:35 Fabrice Fontaine
  2023-02-23  6:22 ` Yann E. MORIN
  2023-03-16 21:35 ` Peter Korsgaard
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Fontaine @ 2023-02-22 14:35 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure:

/tmp/ccY5gl3z.s:2145: Error: selected processor does not support `mcr p15,0,r2,c7,c10,5' in Thumb mode

Fixes:
 - http://autobuild.buildroot.org/results/9d18a0d360b2e2f9e87c55daedda62d6ce198bb9

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/audit/audit.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/audit/audit.mk b/package/audit/audit.mk
index cbb174b980..af81dabac0 100644
--- a/package/audit/audit.mk
+++ b/package/audit/audit.mk
@@ -15,6 +15,13 @@ AUDIT_INSTALL_STAGING = YES
 
 AUDIT_CONF_OPTS = --without-python --without-python3
 
+# src/libev has some assembly function that is not present in Thumb mode:
+# Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode
+# so, we desactivate Thumb mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+AUDIT_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
+endif
+
 ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
 AUDIT_DEPENDENCIES += libcap-ng
 AUDIT_CONF_OPTS += --with-libcap-ng=yes
-- 
2.39.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
  2023-02-22 14:35 [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode Fabrice Fontaine
@ 2023-02-23  6:22 ` Yann E. MORIN
  2023-02-23  6:41   ` Yann E. MORIN
  2023-02-23 21:42   ` Thomas Petazzoni via buildroot
  2023-03-16 21:35 ` Peter Korsgaard
  1 sibling, 2 replies; 6+ messages in thread
From: Yann E. MORIN @ 2023-02-23  6:22 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

Fabrice, All,

On 2023-02-22 15:35 +0100, Fabrice Fontaine spake thusly:
> Fix the following build failure:
> 
> /tmp/ccY5gl3z.s:2145: Error: selected processor does not support `mcr p15,0,r2,c7,c10,5' in Thumb mode
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/9d18a0d360b2e2f9e87c55daedda62d6ce198bb9
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  package/audit/audit.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/package/audit/audit.mk b/package/audit/audit.mk
> index cbb174b980..af81dabac0 100644
> --- a/package/audit/audit.mk
> +++ b/package/audit/audit.mk
> @@ -15,6 +15,13 @@ AUDIT_INSTALL_STAGING = YES
>  
>  AUDIT_CONF_OPTS = --without-python --without-python3
>  
> +# src/libev has some assembly function that is not present in Thumb mode:
> +# Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode
> +# so, we desactivate Thumb mode
> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
> +AUDIT_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
> +endif

But then it would not work on systems that have a armv7m: BR2_cortex_m3,
BR2_cortex_m4, or BR2_cortex_m7.

I looked at the code, and it's going to be very complex to patch it to
support armv7m, i.e. thumb-only.

So, we will have to disallow audit in this case. It is going to be easy,
as it already have a _ARCH_SUPPORTS, but it going to neeed a bit of
cleanup:

    config BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
        bool
        default y if BR2_aarch64
        default y if (BR2_arm || BR2_armeb) && BR2_ARM_CPU_HAS_ARM
        default y if BR2_i386 || BR2_x86_64
        default y if BR2_powerpc || BR2_powerpc64

And then, the only 'select' is from libsemanage, which already depends
on AUDIT_ARCH_SUPPORT, so all is going to be alright (in the end).

Regards,
Yann E. MORIN.

>  ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
>  AUDIT_DEPENDENCIES += libcap-ng
>  AUDIT_CONF_OPTS += --with-libcap-ng=yes
> -- 
> 2.39.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
  2023-02-23  6:22 ` Yann E. MORIN
@ 2023-02-23  6:41   ` Yann E. MORIN
  2023-02-23 21:42   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2023-02-23  6:41 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

Fabrice, All,

On 2023-02-23 07:22 +0100, Yann E. MORIN spake thusly:
> On 2023-02-22 15:35 +0100, Fabrice Fontaine spake thusly:
> > Fix the following build failure:
> > 
> > /tmp/ccY5gl3z.s:2145: Error: selected processor does not support `mcr p15,0,r2,c7,c10,5' in Thumb mode
> > 
> > Fixes:
> >  - http://autobuild.buildroot.org/results/9d18a0d360b2e2f9e87c55daedda62d6ce198bb9
> > 
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > ---
> >  package/audit/audit.mk | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/package/audit/audit.mk b/package/audit/audit.mk
> > index cbb174b980..af81dabac0 100644
> > --- a/package/audit/audit.mk
> > +++ b/package/audit/audit.mk
> > @@ -15,6 +15,13 @@ AUDIT_INSTALL_STAGING = YES
> >  
> >  AUDIT_CONF_OPTS = --without-python --without-python3
> >  
> > +# src/libev has some assembly function that is not present in Thumb mode:
> > +# Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode
> > +# so, we desactivate Thumb mode
> > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
> > +AUDIT_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
> > +endif
> 
> But then it would not work on systems that have a armv7m: BR2_cortex_m3,
> BR2_cortex_m4, or BR2_cortex_m7.
> 
> I looked at the code, and it's going to be very complex to patch it to
> support armv7m, i.e. thumb-only.
> 
> So, we will have to disallow audit in this case. It is going to be easy,
> as it already have a _ARCH_SUPPORTS, but it going to neeed a bit of
> cleanup:
> 
>     config BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
>         bool
>         default y if BR2_aarch64
>         default y if (BR2_arm || BR2_armeb) && BR2_ARM_CPU_HAS_ARM

As I wrote in the libev review for the same issue, the condition is a
bit more complex:

    default y if (BR2_arm || BR2_armeb) && (BR2_ARM_CPU_HAS_ARM || BR2_ARM_CPU_HAS_THUMB2)

Regards,
Yann E. MORIN.

>         default y if BR2_i386 || BR2_x86_64
>         default y if BR2_powerpc || BR2_powerpc64
> 
> And then, the only 'select' is from libsemanage, which already depends
> on AUDIT_ARCH_SUPPORT, so all is going to be alright (in the end).
> 
> Regards,
> Yann E. MORIN.
> 
> >  ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
> >  AUDIT_DEPENDENCIES += libcap-ng
> >  AUDIT_CONF_OPTS += --with-libcap-ng=yes
> > -- 
> > 2.39.0
> > 
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
  2023-02-23  6:22 ` Yann E. MORIN
  2023-02-23  6:41   ` Yann E. MORIN
@ 2023-02-23 21:42   ` Thomas Petazzoni via buildroot
  2023-03-09 21:43     ` Arnout Vandecappelle
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-02-23 21:42 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Fabrice Fontaine, buildroot

Hello Yann,

On Thu, 23 Feb 2023 07:22:59 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> > +# src/libev has some assembly function that is not present in Thumb mode:
> > +# Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode
> > +# so, we desactivate Thumb mode
> > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
> > +AUDIT_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
> > +endif  
> 
> But then it would not work on systems that have a armv7m: BR2_cortex_m3,
> BR2_cortex_m4, or BR2_cortex_m7.

BR2_ARM_INSTRUCTIONS_THUMB is for "classic" Thumb, not Thumb2.
BR2_ARM_INSTRUCTIONS_THUMB2 is used for Thumb2 platforms, such as
ARMv7-M.

So the above condition will only trigger for ARMv4/ARMv5/ARMv6 cores,
and they all support both classic Thumb and regular ARM instruction set.

So to me, the above proposal from Fabrice works fine.

> I looked at the code, and it's going to be very complex to patch it to
> support armv7m, i.e. thumb-only.

Thumb2-only, which is totally different.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
  2023-02-23 21:42   ` Thomas Petazzoni via buildroot
@ 2023-03-09 21:43     ` Arnout Vandecappelle
  0 siblings, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2023-03-09 21:43 UTC (permalink / raw)
  To: Thomas Petazzoni, Yann E. MORIN; +Cc: Fabrice Fontaine, buildroot



On 23/02/2023 22:42, Thomas Petazzoni via buildroot wrote:
> Hello Yann,
> 
> On Thu, 23 Feb 2023 07:22:59 +0100
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> 
>>> +# src/libev has some assembly function that is not present in Thumb mode:
>>> +# Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode
>>> +# so, we desactivate Thumb mode
>>> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
>>> +AUDIT_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
>>> +endif
>>
>> But then it would not work on systems that have a armv7m: BR2_cortex_m3,
>> BR2_cortex_m4, or BR2_cortex_m7.
> 
> BR2_ARM_INSTRUCTIONS_THUMB is for "classic" Thumb, not Thumb2.
> BR2_ARM_INSTRUCTIONS_THUMB2 is used for Thumb2 platforms, such as
> ARMv7-M.
> 
> So the above condition will only trigger for ARMv4/ARMv5/ARMv6 cores,
> and they all support both classic Thumb and regular ARM instruction set.
> 
> So to me, the above proposal from Fabrice works fine.

  I completely agree. Adding those redundant arch dependencies adds a bunch of 
needless complexity for libev. And we can be pretty sure that we're never going 
to add a thumb1-only architecture.

  So I applied the v1 of this patch to master, thanks.

  Regards,
  Arnout


> 
>> I looked at the code, and it's going to be very complex to patch it to
>> support armv7m, i.e. thumb-only.
> 
> Thumb2-only, which is totally different.
> 
> Best regards,
> 
> Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode
  2023-02-22 14:35 [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode Fabrice Fontaine
  2023-02-23  6:22 ` Yann E. MORIN
@ 2023-03-16 21:35 ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2023-03-16 21:35 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Fix the following build failure:
 > /tmp/ccY5gl3z.s:2145: Error: selected processor does not support `mcr p15,0,r2,c7,c10,5' in Thumb mode

 > Fixes:
 >  - http://autobuild.buildroot.org/results/9d18a0d360b2e2f9e87c55daedda62d6ce198bb9

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Committed to 2022.11.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-03-16 21:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22 14:35 [Buildroot] [PATCH 1/1] package/audit: force arm mode instead of Thumb mode Fabrice Fontaine
2023-02-23  6:22 ` Yann E. MORIN
2023-02-23  6:41   ` Yann E. MORIN
2023-02-23 21:42   ` Thomas Petazzoni via buildroot
2023-03-09 21:43     ` Arnout Vandecappelle
2023-03-16 21:35 ` Peter Korsgaard

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