Patchwork [PATCHv2,2/3] eglibc/arm: doesn't build in thumb(1) mode

login
register
mail settings
Submitter Gustavo Zacarias
Date July 19, 2013, 1:06 p.m.
Message ID <1374239193-23811-2-git-send-email-gustavo@zacarias.com.ar>
Download mbox | patch
Permalink /patch/260258/
State Accepted
Headers show

Comments

Gustavo Zacarias - July 19, 2013, 1:06 p.m.
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.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 package/eglibc/eglibc.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--
1.8.1.5
Peter Korsgaard - July 19, 2013, 10:07 p.m.
>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> 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 <gustavo@zacarias.com.ar>
 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?
Thomas Petazzoni - July 21, 2013, 3:24 p.m.
Dear Peter Korsgaard,

On Sat, 20 Jul 2013 00:07:59 +0200, Peter Korsgaard wrote:

>  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
Peter Korsgaard - July 21, 2013, 4:06 p.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 >> 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".

Patch

diff --git a/package/eglibc/eglibc.mk b/package/eglibc/eglibc.mk
index 5431ac5..253dabd 100644
--- a/package/eglibc/eglibc.mk
+++ b/package/eglibc/eglibc.mk
@@ -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 \