Skip to contentSkip to conversation

package/libev: force arm mode instead of Thumb mode

PATCH Superseded Fabrice Fontaine 3 participants 3 messages Feb 22, 2023 – Mar 16, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libev: force arm mode instead of Thumb mode

Fix the following build failure:

/tmp/ccHc3Awn.s:825: Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode

Fixes:
- http://autobuild.buildroot.org/results/1c597c9da724d6cac06b09b1ecd456a28440a3a3

---
 package/libev/libev.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/libev/libev.mk +7 -0
index 9f3c19d46c..cbd5433d76 100644
@@ -10,6 +10,13 @@ LIBEV_INSTALL_STAGING = YES
 LIBEV_LICENSE = BSD-2-Clause or GPL-2.0+
 LIBEV_LICENSE_FILES = LICENSE
 
+# 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)
+LIBEV_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
+endif
+
 # The 'compatibility' event.h header conflicts with libevent
 # It's completely unnecessary for BR packages so remove it
 define LIBEV_DISABLE_EVENT_H_INSTALL
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Fabrice, All,

On 2023-02-22 15:37 +0100, Fabrice Fontaine spake thusly:

Quoted 17 lines

Fix the following build failure:

/tmp/ccHc3Awn.s:825: Error: selected processor does not support `mcr p15,0,r3,c7,c10,5' in Thumb mode

Fixes:
- http://autobuild.buildroot.org/results/1c597c9da724d6cac06b09b1ecd456a28440a3a3

---
 package/libev/libev.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/libev/libev.mk +0 -0
index 9f3c19d46c..cbd5433d76 100644

package/libev/libev.mk LIBEV_INSTALL_STAGING = YES · line 18

Quoted 9 lines
package/libev/libev.mk +6 -0
@@ -10,6 +10,13 @@ LIBEV_INSTALL_STAGING = YES
 LIBEV_LICENSE = BSD-2-Clause or GPL-2.0+
 LIBEV_LICENSE_FILES = LICENSE
 
+# 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)
+LIBEV_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
+endif

Same as for the audit change, this is going to fail for armv7m machines, so we need to hide away libeve for those.

Unfortuantely, libev does not already have an _ARCH_SUPPORTS, and adding one just for this is a bit overkill.

However, libeve has 12 reverse dependencies, so it's going to be a little pain.

If we expect that libeve has more arch-dependencies, then it might be a good idea, but I have no clue there...

In fact, re-reading the libev code, it seems that the situation is more coplex that "not thumb":

     814    #elif defined __ARM_ARCH_6__  || defined __ARM_ARCH_6J__  \
     815       || defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6ZK__ \
     816       || defined __ARM_ARCH_6T2__
     817      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory")
     818    #elif defined __ARM_ARCH_7__  || defined __ARM_ARCH_7A__  \
     819       || defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__
     820      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb"      : : : "memory")

So, it goes through the armv6 case, and it looks like it does have support for Thumb2 (6T2) or armv7m.

So, the condition is a bit more complex. It is OK for ARM full or Thumb2 (armv7m implies Thumb2).

So, adding an LIBEVE_ARCH_SUPPORT is maybe a good idea, in the end:

    config BR2_PACKAGE_LIBEV_ARCH_SUPPORTS
        bool
        default y if !(BR2_arm || BR2_armeb) || BR2_ARM_CPU_HAS_ARM || BR2_ARM_CPU_HAS_THUMB2

Regards,
Yann E. MORIN.

Quoted 10 lines
package/libev/libev.mk +0 -0
 # The 'compatibility' event.h header conflicts with libevent
 # It's completely unnecessary for BR packages so remove it
 define LIBEV_DISABLE_EVENT_H_INSTALL
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Fabrice Fontaine
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

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

Fixes:
- http://autobuild.buildroot.org/results/1c597c9da724d6cac06b09b1ecd456a28440a3a3

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

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot