Skip to contentSkip to conversation

gcc/arm: disable mudflap for thumb(1)

PATCH New Gustavo Zacarias 3 participants 7 messages Jul 19, 2013 – Jul 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 gcc/arm: disable mudflap for thumb(1)

libmudflap doesn't build for a thumb(1) toolchain so disable it.

---
 package/gcc/gcc.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/gcc/gcc.mk +5 -0
index c0d821b..85cd7d4 100644
@@ -194,6 +194,11 @@ ifeq ($(BR2_avr32),y)
 HOST_GCC_COMMON_CONF_OPT += --disable-libmudflap
 endif
 
+# ARM Thumb and mudflap aren't friends
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+HOST_GCC_COMMON_CONF_OPT += --disable-libmudflap
+endif
+
 # Disable mudflap and enable proper double/long double for SPE ABI
 ifeq ($(BR2_powerpc_SPE),y)
 HOST_GCC_COMMON_CONF_OPT += \

--
1.8.1.5

#1 lore raw

PATCH v2 2/3 eglibc/arm: doesn't build in thumb(1) mode

It runs out of registers, so build it in ARM mode, EABI mandates interworking so this isn't an issue.
Tested in an arm920t board.

---
 package/eglibc/eglibc.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
package/eglibc/eglibc.mk +7 -1
index 5431ac5..253dabd 100644
@@ -23,6 +23,11 @@ EGLIBC_INSTALL_STAGING = YES
 
 EGLIBC_INSTALL_STAGING_OPT = install_root=$(STAGING_DIR) install
 
+# Thumb build is broken, build in ARM mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+EGLIBC_EXTRA_CFLAGS += -marm
+endif
+
 # Even though we use the autotools-package infrastructure, we have to
 # override the default configure commands for several reasons:
 #
@@ -36,7 +41,8 @@ define EGLIBC_CONFIGURE_CMDS
 	# Do the configuration
 	(cd $(@D)/build; \
 		$(TARGET_CONFIGURE_OPTS) \
-		CFLAGS="-O2" CPPFLAGS="" CXXFLAGS="-O2" \
+		CFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
+		CXXFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" \
 		$(SHELL) $(@D)/libc/configure \
 		ac_cv_path_BASH_SHELL=/bin/bash \
 		libc_cv_forced_unwind=yes \

--
1.8.1.5

#2 lore raw

PATCH v2 2/3 eglibc/arm: doesn't build in thumb(1) mode

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> It runs out of registers, so build it in ARM mode, EABI mandates Gustavo> interworking so this isn't an issue.
Gustavo> Tested in an arm920t board.

Gustavo> Signed-off-by: Gustavo Zacarias <[email protected]> Gustavo> ---

 Gustavo>  package/eglibc/eglibc.mk | 8 +++++++-

Gustavo> 1 file changed, 7 insertions(+), 1 deletion(-)

Gustavo> diff --git a/package/eglibc/eglibc.mk b/package/eglibc/eglibc.mk Gustavo> index 5431ac5..253dabd 100644
Gustavo> --- a/package/eglibc/eglibc.mk
Gustavo> +++ b/package/eglibc/eglibc.mk
Gustavo> @@ -23,6 +23,11 @@ EGLIBC_INSTALL_STAGING = YES

Gustavo> EGLIBC_INSTALL_STAGING_OPT = install_root=$(STAGING_DIR) install

Gustavo> +# Thumb build is broken, build in ARM mode Gustavo> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y) Gustavo> +EGLIBC_EXTRA_CFLAGS += -marm Gustavo> +endif
Gustavo> +

 Gustavo>  # Even though we use the autotools-package infrastructure, we have to
 Gustavo>  # override the default configure commands for several reasons:
 Gustavo>  #
 Gustavo> @@ -36,7 +41,8 @@ define EGLIBC_CONFIGURE_CMDS
 Gustavo>  	# Do the configuration
 Gustavo>  	(cd $(@D)/build; \
 Gustavo>  		$(TARGET_CONFIGURE_OPTS) \

Gustavo> - CFLAGS="-O2" CPPFLAGS="" CXXFLAGS="-O2" \
Gustavo> + CFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \

I know you didn't add this, but why are we forcing -O2 here? Thomas?

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

PATCH v2 2/3 eglibc/arm: doesn't build in thumb(1) mode

Dear Peter Korsgaard,

Quoted 8 lines · Peter Korsgaard

Gustavo> @@ -36,7 +41,8 @@ define EGLIBC_CONFIGURE_CMDS

 Gustavo>  	# Do the configuration
 Gustavo>  	(cd $(@D)/build; \
 Gustavo>  		$(TARGET_CONFIGURE_OPTS) \

Gustavo> - CFLAGS="-O2" CPPFLAGS="" CXXFLAGS="-O2" \
Gustavo> + CFLAGS="-O2 $(EGLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \

I know you didn't add this, but why are we forcing -O2 here? Thomas?

Because eglibc must be built with optimizations. See
http://patches.openembedded.org/patch/38849/ for example.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH v2 2/3 eglibc/arm: doesn't build in thumb(1) mode

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 1 line
Quoted 1 line

I know you didn't add this, but why are we forcing -O2 here? Thomas?

Thomas> Because eglibc must be built with optimizations. See Thomas> http://patches.openembedded.org/patch/38849/ for example.

Ok, thanks. A small note about this would be good so it doesn't get removed in future "cleanups".

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

PATCH v2 3/3 uclibc/arm: doesn't build in thumb(1) mode with threads

In reply to Gustavo Zacarias

It runs out of registers, it fails even in official form (COMPILE_IN_THUMB_MODE=y) so just build it in ARM mode since EABI mandates interworking.
Tested in an arm920t board.

---
 package/uclibc/Config.in | 2 +-
 package/uclibc/uclibc.mk | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
package/uclibc/Config.in +1 -1
index 8d16e8c..90aae90 100644
@@ -185,7 +185,7 @@ config BR2_UCLIBC_ARM_TYPE
 config BR2_UCLIBC_ARM_BX
 	bool
 	depends on BR2_UCLIBC_TARGET_ARCH = "arm"
-	default y if !BR2_fa265 && !BR2_strongarm
+	default y if (BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2)
 
 config BR2_UCLIBC_MIPS_ABI
 	string
package/uclibc/uclibc.mk +6 -1
index 0c76c3f..cf53280 100644
@@ -74,6 +74,11 @@ define UCLIBC_ARM_ABI_CONFIG
 	$(call UCLIBC_OPT_SET,CONFIG_ARM_EABI,y,$(@D))
 endef
 
+# Thumb build is broken with threads, build in ARM mode
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
+UCLIBC_EXTRA_CFLAGS += -marm
+endif
+
 ifeq ($(BR2_UCLIBC_ARM_BX),y)
 define UCLIBC_ARM_BX_CONFIG
 	$(call UCLIBC_OPT_SET,USE_BX,y,$(@D))
@@ -354,7 +359,7 @@ endif
 UCLIBC_MAKE_FLAGS = \
 	ARCH="$(UCLIBC_TARGET_ARCH)" \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
-	UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+	UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS) $(TARGET_ABI)" \
 	HOSTCC="$(HOSTCC)"
 
 define UCLIBC_SETUP_DOT_CONFIG

--
1.8.1.5

#6 lore raw

PATCH v2 1/3 gcc/arm: disable mudflap for thumb(1)

In reply to Gustavo Zacarias
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Gustavo" == Gustavo Zacarias <[email protected]> writes:

Gustavo> libmudflap doesn't build for a thumb(1) toolchain so disable it. Gustavo> Signed-off-by: Gustavo Zacarias <[email protected]>

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard