Patchwork UCLIBC_EXTRA_CFLAGS in uClibc overridden while using buildroot

login
register
mail settings
Submitter Rajendra Dendukuri
Date June 7, 2013, 9:08 p.m.
Message ID <43F7AEDD312F9E499A1A4E3608E505ED2ABF14F2@SJEXCHMB09.corp.ad.broadcom.com>
Download mbox | patch
Permalink /patch/249855/
State New
Delegated to: Thomas De Schampheleire
Headers show

Comments

Rajendra Dendukuri - June 7, 2013, 9:08 p.m.
Thanks for the inputs. The said patch works. Can we get this into release buildroot source tree.

/rajen
-----Original Message-----
From: Thomas Petazzoni [mailto:thomas.petazzoni@free-electrons.com] 
Sent: Friday, June 07, 2013 5:55 AM
To: Rajendra Dendukuri
Cc: buildroot@busybox.net
Subject: Re: [Buildroot] UCLIBC_EXTRA_CFLAGS in uClibc overridden while using buildroot

Dear Rajendra Dendukuri,

On Thu, 6 Jun 2013 19:33:30 +0000, Rajendra Dendukuri wrote:
> I am using buildroot-2012.11 version to build a uClibc toolchain for ARMv7a. I find that uClibc/Rules.mak file defaults to -Os. However I wish to include "-fno-omit-frame-pointer" even when -Os optimization is used. I cannot find a hook in buildroot or uClibc where this can be done. I tried setting the value of UCLIBC_EXTRA_CFGLAGS in the uClibc config file. However that is not being considered. Instead the values passed by buildroot in  "toolchain/uClibc/uclibc.mk" are being used.
> 
> This seems to be a very stiff limitation while using uClibc with buildroot. Any suggestions on how we can overcome this.

Can you try the following patch, and add -fno-omit-frame-pointer to
BR2_TARGET_OPTIMIZATION ?
Gustavo Zacarias - March 3, 2014, 10:37 p.m.
On 06/07/2013 06:08 PM, Rajendra Dendukuri wrote:

> Thanks for the inputs. The said patch works. Can we get this into release buildroot source tree.

Hi.
Revived old thread!
It may work for your particular case, but generally, it's a bad idea to
allow tweaking libc build CFLAGS, specially when they're merged with
package CFLAGS.
What's the intention of this, fixing some problem or just plain
optimization?
The patch as it is right now would break PowerPC SPE ABI toolchains and
probably Xtensa to a certain degree too (see package/Makefile.in)
A config option with separate extra CFLAGS for uClibc could be
introduced, but really, if it's not fixing anything in particular, why?
If you're fixing some issue in a determined fixed scenario then it might
be good to make it automatic.
Regards.

Patch

diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
index d4f1d4c..8ecb712 100644
--- a/toolchain/uClibc/uclibc.mk
+++ b/toolchain/uClibc/uclibc.mk
@@ -392,7 +392,7 @@  $(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.oldconfig
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		HOSTCC="$(HOSTCC)" \
 		oldconfig
 	touch $@
@@ -423,7 +423,7 @@  $(UCLIBC_DIR)/.configured: $(LINUX_HEADERS_DIR)/.configured $(UCLIBC_DIR)/.confi
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		HOSTCC="$(HOSTCC)" headers \
 		lib/crt1.o lib/crti.o lib/crtn.o \
 		install_headers
@@ -446,7 +446,7 @@  $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(gcc_intermediate) $(LIBFLO
 		DEVEL_PREFIX=/ \
 		RUNTIME_PREFIX=/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		HOSTCC="$(HOSTCC)" \
 		all
 	touch -c $@
@@ -458,7 +458,7 @@  uclibc-menuconfig: dirs $(UCLIBC_DIR)/.config
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=$(TOOLCHAIN_DIR)/uClibc_dev/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		HOSTCC="$(HOSTCC)" \
 		menuconfig && \
 	touch -c $(UCLIBC_DIR)/.config
@@ -472,7 +472,7 @@  $(STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		install_runtime install_dev
 	# Install the kernel headers to the staging dir if necessary
 	if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ]; then \
@@ -503,7 +503,7 @@  $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/usr/lib/libc.a
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=/ \
 		CROSS_COMPILE="$(TARGET_CROSS)" \
-		UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
+		UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
 		install_runtime
 	touch -c $@