Skip to contentSkip to conversation

dmalloc: Force arm mode instead of Thumb1 mode

PATCH New Richard Genoud 4 participants 11 messages Jan 20, 2015 – Feb 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dmalloc: Force arm mode instead of Thumb1 mode

dmalloc has some assembly that doesn't exist in thumb1 mode. So, force arm mode for dmalloc.

---
 package/dmalloc/dmalloc.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
package/dmalloc/dmalloc.mk +10 -0
index 581ec4075681..f87ae1709aec 100644
@@ -14,6 +14,7 @@ DMALLOC_LICENSE_FILES = dmalloc.h.1
 
 DMALLOC_INSTALL_STAGING = YES
 DMALLOC_CONF_OPTS = --enable-shlib
+DMALLOC_CFLAGS = $(TARGET_CFLAGS)
 
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 DMALLOC_CONF_OPTS += --enable-cxx
@@ -27,6 +28,15 @@ else
 DMALLOC_CONF_OPTS += --disable-threads
 endif
 
+# dmalloc has some assembly function that are not present in thumb1 mode:
+# Error: lo register required -- `str lr,[sp,#4]'
+# so, we desactivate thumb mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+DMALLOC_CFLAGS += -marm
+endif
+
+DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
+
 define DMALLOC_POST_PATCH
 	$(SED) 's/^ac_cv_page_size=0$$/ac_cv_page_size=12/' $(@D)/configure
 	$(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure
Signature · 1 line
2.0.0
#1 lore raw

PATCH 2/3 alsa-lib: Force arm mode instead of Thumb1 mode

alsa-lib has some assembly that doesn't exist in thumb1 mode. So, force arm mode for alsa-lib.

---
 package/alsa-lib/alsa-lib.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/alsa-lib/alsa-lib.mk +7 -0
index 16d184ea0e80..1740cc6728c6 100644
@@ -54,6 +54,13 @@ ifeq ($(BR2_avr32),y)
 ALSA_LIB_CFLAGS += -DAVR32_INLINE_BUG
 endif
 
+# alsa-lib has some assembly function that are not present in thumb1 mode.
+# so, we desactivate thumb mode
+# (would be better to fix alsa-lib)
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+ALSA_LIB_CFLAGS += -marm
+endif
+
 ifeq ($(BR2_PACKAGE_ALSA_LIB_PYTHON),y)
 ALSA_LIB_CONF_OPTS += \
 	--with-pythonlibs=-lpython$(PYTHON_VERSION_MAJOR) \
Signature · 1 line
2.0.0
#2 lore raw

PATCH 2/3 alsa-lib: Force arm mode instead of Thumb1 mode

Quoted 4 lines · Richard Genoud

alsa-lib has some assembly that doesn't exist in thumb1 mode. So, force arm mode for alsa-lib.

However, I can't find the assembly that you refer to. And of course this problem only becomes apparent at runtime.

Regards,
Arnout

Quoted 22 lines
---
 package/alsa-lib/alsa-lib.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/alsa-lib/alsa-lib.mk +7 -0
index 16d184ea0e80..1740cc6728c6 100644
@@ -54,6 +54,13 @@ ifeq ($(BR2_avr32),y)
 ALSA_LIB_CFLAGS += -DAVR32_INLINE_BUG
 endif
 
+# alsa-lib has some assembly function that are not present in thumb1 mode.
+# so, we desactivate thumb mode
+# (would be better to fix alsa-lib)
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+ALSA_LIB_CFLAGS += -marm
+endif
+
 ifeq ($(BR2_PACKAGE_ALSA_LIB_PYTHON),y)
 ALSA_LIB_CONF_OPTS += \
 	--with-pythonlibs=-lpython$(PYTHON_VERSION_MAJOR) \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 2/3 alsa-lib: Force arm mode instead of Thumb1 mode

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 3 lines · Richard Genoud

alsa-lib has some assembly that doesn't exist in thumb1 mode. So, force arm mode for alsa-lib.

Quoted 6 lines
Quoted 1 line

However, I can't find the assembly that you refer to. And of course this problem only becomes apparent at runtime.

Me neither. It builds fine here in thumb1 mode. Richard, what problem did you see exactly?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 2/3 alsa-lib: Force arm mode instead of Thumb1 mode

In reply to Arnout Vandecappelle
Quoted 9 lines · Arnout Vandecappelle
Quoted 4 lines · Richard Genoud

alsa-lib has some assembly that doesn't exist in thumb1 mode. So, force arm mode for alsa-lib.

However, I can't find the assembly that you refer to. And of course this problem only becomes apparent at runtime.

Actually, it should lead to a build failure. So I really don't see why this patch would be needed.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 3/3 qt: Force arm mode instead of Thumb1 mode

In reply to Richard Genoud

Qt has some assembly that doesn't exist in thumb1 mode. So, force arm mode for Qt

---
 package/qt/qt.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/qt/qt.mk +8 -0
index 255d6d2ab0e4..80605ca514d5 100644
@@ -52,6 +52,14 @@ endif
 
 endif
 
+# Qt has some assembly function that are not present in thumb1 mode:
+# Error: selected processor does not support Thumb mode `swp r3,r7,[r4]'
+# so, we desactivate thumb mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+QT_CFLAGS += -marm
+QT_CXXFLAGS += -marm
+endif
+
 ifeq ($(BR2_PACKAGE_QT_QT3SUPPORT),y)
 QT_CONFIGURE_OPTS += -qt3support
 else
Signature · 1 line
2.0.0
#6 lore raw

PATCH 3/3 qt: Force arm mode instead of Thumb1 mode

Quoted 4 lines · Richard Genoud

Qt has some assembly that doesn't exist in thumb1 mode. So, force arm mode for Qt

It fails when the patch is not applied even on the most minimal
config. It succeeds with the patch applied.

Regards,
Arnout

Quoted 23 lines
---
 package/qt/qt.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/qt/qt.mk +8 -0
index 255d6d2ab0e4..80605ca514d5 100644
@@ -52,6 +52,14 @@ endif
 
 endif
 
+# Qt has some assembly function that are not present in thumb1 mode:
+# Error: selected processor does not support Thumb mode `swp r3,r7,[r4]'
+# so, we desactivate thumb mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+QT_CFLAGS += -marm
+QT_CXXFLAGS += -marm
+endif
+
 ifeq ($(BR2_PACKAGE_QT_QT3SUPPORT),y)
 QT_CONFIGURE_OPTS += -qt3support
 else
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#8 lore raw

PATCH 1/3 dmalloc: Force arm mode instead of Thumb1 mode

In reply to Richard Genoud

Dear Richard Genoud,

Quoted 7 lines · Richard Genoud

dmalloc has some assembly that doesn't exist in thumb1 mode. So, force arm mode for dmalloc.

---
 package/dmalloc/dmalloc.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

Applied, thanks.

Are you actually using an ARMv4/ARMv5 Thumb system?

Maybe this is a configuration we should add to our autobuilders, since it's currently not even build-tested.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

PATCH 1/3 dmalloc: Force arm mode instead of Thumb1 mode

2015-01-25 20:31 GMT+01:00 Thomas Petazzoni
<[email protected]>:

Quoted 6 lines

Dear Richard Genoud,

Quoted 3 lines · Richard Genoud

dmalloc has some assembly that doesn't exist in thumb1 mode. So, force arm mode for dmalloc.

Quoted 8 lines
Quoted 4 lines
---
 package/dmalloc/dmalloc.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

Applied, thanks.

Are you actually using an ARMv4/ARMv5 Thumb system?

I tried to use it to know if it saves some place on my RFS, but as Qt has the same kind of problem with Thumb1, it didn't make a big difference.
(my platform is a sam9g35, so ARMv5)
But if I continue to have spaces problem, I will reconsider using thumb1, and maybe try to patch the Qt assembly to make it Thumb1 compliant instead of adding " -marm"

Quoted 2 lines

Maybe this is a configuration we should add to our autobuilders, since it's currently not even build-tested.

That may be a good idea since I may not be the only potential user :)

#10 lore raw

PATCH 1/3 dmalloc: Force arm mode instead of Thumb1 mode

Dear Richard Genoud,

Quoted 8 lines · Richard Genoud
Quoted 1 line

Are you actually using an ARMv4/ARMv5 Thumb system?

I tried to use it to know if it saves some place on my RFS, but as Qt has the same kind of problem with Thumb1, it didn't make a big difference.
(my platform is a sam9g35, so ARMv5)
But if I continue to have spaces problem, I will reconsider using thumb1, and maybe try to patch the Qt assembly to make it Thumb1 compliant instead of adding " -marm"

Ok.

Quoted 3 lines
Quoted 2 lines

Maybe this is a configuration we should add to our autobuilders, since it's currently not even build-tested.

That may be a good idea since I may not be the only potential user :)

Indeed. We also have more autobuilder instances nowadays, so adding a few more configurations should be fine.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com