diff mbox

uclibc: respect top-level TARGET_CFLAGS

Message ID 1415274442-24547-1-git-send-email-abrodkin@synopsys.com
State Changes Requested
Headers show

Commit Message

Alexey Brodkin Nov. 6, 2014, 11:47 a.m. UTC
When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
it's expected that ALL target binaries will be built with specified options.

Currently uClibc is built with its own set of options.
This change allows passing additional flags to uclibc build system.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Anton Kolesov <akolesov@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/uclibc/uclibc.mk | 2 ++
 1 file changed, 2 insertions(+)

Comments

Baruch Siach Nov. 6, 2014, 11:51 a.m. UTC | #1
Hi Alexey,

On Thu, Nov 06, 2014 at 02:47:22PM +0300, Alexey Brodkin wrote:
> When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
> it's expected that ALL target binaries will be built with specified options.
> 
> Currently uClibc is built with its own set of options.
> This change allows passing additional flags to uclibc build system.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Anton Kolesov <akolesov@synopsys.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Peter Korsgaard <peter@korsgaard.com>
> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Have you actually CCed all these addresses? I only see Thomas in the Cc: 
header, besides you.

baruch

> ---
>  package/uclibc/uclibc.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
> index ce416dd..419a4d1 100644
> --- a/package/uclibc/uclibc.mk
> +++ b/package/uclibc/uclibc.mk
> @@ -24,6 +24,8 @@ endif
>  
>  UCLIBC_INSTALL_STAGING = YES
>  
> +UCLIBC_EXTRA_CFLAGS = $(TARGET_CFLAGS)
> +
>  # uclibc is part of the toolchain so disable the toolchain dependency
>  UCLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
Alexey Brodkin Nov. 6, 2014, 11:59 a.m. UTC | #2
Hi Baruch,

On Thu, 2014-11-06 at 13:51 +0200, Baruch Siach wrote:
> Hi Alexey,
> 
> On Thu, Nov 06, 2014 at 02:47:22PM +0300, Alexey Brodkin wrote:
> > When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
> > it's expected that ALL target binaries will be built with specified options.
> > 
> > Currently uClibc is built with its own set of options.
> > This change allows passing additional flags to uclibc build system.
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > 
> > Cc: Anton Kolesov <akolesov@synopsys.com>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Cc: Peter Korsgaard <peter@korsgaard.com>
> > Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> 
> Have you actually CCed all these addresses? I only see Thomas in the Cc: 
> header, besides you.

That's why I add "Cc:" in commit message.
Because "git send-email" automatically adds mentioned addresses to CC.

That's an extract of "git send-email" log:
--->---
MAIL FROM:<abrodkin@synopsys.com>
RCPT TO:<buildroot@buildroot.org>
RCPT TO:<abrodkin@synopsys.com>
RCPT TO:<akolesov@synopsys.com>
RCPT TO:<thomas.petazzoni@free-electrons.com>
RCPT TO:<peter@korsgaard.com>
RCPT TO:<gustavo@zacarias.com.ar>
RCPT TO:<Vincent.Riera@imgtec.com>
From: Alexey Brodkin <abrodkin@synopsys.com>
To: buildroot@buildroot.org
Cc: Alexey Brodkin <abrodkin@synopsys.com>,
	Anton Kolesov <akolesov@synopsys.com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Peter Korsgaard <peter@korsgaard.com>,
	Gustavo Zacarias <gustavo@zacarias.com.ar>,
	Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Subject: [PATCH] uclibc: respect top-level TARGET_CFLAGS
Date: Thu,  6 Nov 2014 14:47:22 +0300
Message-Id: <1415274442-24547-1-git-send-email-abrodkin@synopsys.com>
X-Mailer: git-send-email 1.9.3
--->---

-Alexey
Baruch Siach Nov. 6, 2014, 12:03 p.m. UTC | #3
Hi Alexey,

On Thu, Nov 06, 2014 at 11:59:32AM +0000, Alexey Brodkin wrote:
> On Thu, 2014-11-06 at 13:51 +0200, Baruch Siach wrote:
> > On Thu, Nov 06, 2014 at 02:47:22PM +0300, Alexey Brodkin wrote:
> > > When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
> > > it's expected that ALL target binaries will be built with specified options.
> > > 
> > > Currently uClibc is built with its own set of options.
> > > This change allows passing additional flags to uclibc build system.
> > > 
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > 
> > > Cc: Anton Kolesov <akolesov@synopsys.com>
> > > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > > Cc: Peter Korsgaard <peter@korsgaard.com>
> > > Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
> > > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> > 
> > Have you actually CCed all these addresses? I only see Thomas in the Cc: 
> > header, besides you.
> 
> That's why I add "Cc:" in commit message.
> Because "git send-email" automatically adds mentioned addresses to CC.

OK then. It seems that the list handler striped the addresses of list 
subscribers from the Cc header except that of Thomas.

baruch
Gustavo Zacarias Nov. 6, 2014, 12:49 p.m. UTC | #4
On 11/06/2014 08:47 AM, Alexey Brodkin wrote:

> When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
> it's expected that ALL target binaries will be built with specified options.
> 
> Currently uClibc is built with its own set of options.
> This change allows passing additional flags to uclibc build system.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

This was rejected before:
https://bugs.busybox.net/show_bug.cgi?id=5294

And i'm back to my original question, what's the specific need for this?
Even for eglibc/glibc we force -O2 for example.
If there's a very valid (like, it breaks!) reason for this we can look
for a way to address it, but as-is i say NAK.
If you look at uClibc's Rules.mak file you'll see there are lots of
OPTIMIZATION/CPU_CFLAGS (and other) conditionals that could be undone by
this and lead to unexpected results.
Regards.
Alexey Brodkin Nov. 6, 2014, 1:04 p.m. UTC | #5
Hi Gustavo,

On Thu, 2014-11-06 at 09:49 -0300, Gustavo Zacarias wrote:
> On 11/06/2014 08:47 AM, Alexey Brodkin wrote:
> 
> > When BR2_TARGET_OPTIMIZATION is used (with some specific compiler flags)
> > it's expected that ALL target binaries will be built with specified options.
> > 
> > Currently uClibc is built with its own set of options.
> > This change allows passing additional flags to uclibc build system.
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> This was rejected before:
> https://bugs.busybox.net/show_bug.cgi?id=5294
> 
> And i'm back to my original question, what's the specific need for this?
> Even for eglibc/glibc we force -O2 for example.
> If there's a very valid (like, it breaks!) reason for this we can look
> for a way to address it, but as-is i say NAK.
> If you look at uClibc's Rules.mak file you'll see there are lots of
> OPTIMIZATION/CPU_CFLAGS (and other) conditionals that could be undone by
> this and lead to unexpected results.
> Regards.
> 

Thanks for pointing to the existing bug.

In my particular case I need to tune uClibc for different HW
configurations.

By default uClibc will be built for most conservative case.
But we have an ability to use a particular HW accelerators - which is
done by passing option to GCC.

-Alexey
Gustavo Zacarias Nov. 6, 2014, 1:18 p.m. UTC | #6
On 11/06/2014 10:04 AM, Alexey Brodkin wrote:

> Thanks for pointing to the existing bug.
> 
> In my particular case I need to tune uClibc for different HW
> configurations.
> 
> By default uClibc will be built for most conservative case.
> But we have an ability to use a particular HW accelerators - which is
> done by passing option to GCC.

Then we could add a BR2_UCLIBC_EXTRA_CFLAGS string which defaults to ""
and pass that to the uclibc's UCLIBC_EXTRA_CFLAGS.
It was mentioned in the past IIRC, however it wasn't done because
probably nobody felt the need for it since everybody was asking for that
for consistency alone.
Regards.
Thomas Petazzoni Nov. 6, 2014, 5:25 p.m. UTC | #7
Dear Baruch Siach,

On Thu, 6 Nov 2014 14:03:25 +0200, Baruch Siach wrote:

> > That's why I add "Cc:" in commit message.
> > Because "git send-email" automatically adds mentioned addresses to CC.
> 
> OK then. It seems that the list handler striped the addresses of list 
> subscribers from the Cc header except that of Thomas.

Yes, the list handler does some horrible crap with Cc, it seems to
strip some of them when the recipient is subscribed to the list, but
not all of them.

Thomas
Alexey Brodkin Nov. 11, 2014, 3:32 p.m. UTC | #8
Hi Gustavo,

On Thu, 2014-11-06 at 10:18 -0300, Gustavo Zacarias wrote:
> On 11/06/2014 10:04 AM, Alexey Brodkin wrote:
> 
> > Thanks for pointing to the existing bug.
> > 
> > In my particular case I need to tune uClibc for different HW
> > configurations.
> > 
> > By default uClibc will be built for most conservative case.
> > But we have an ability to use a particular HW accelerators - which is
> > done by passing option to GCC.
> 
> Then we could add a BR2_UCLIBC_EXTRA_CFLAGS string which defaults to ""
> and pass that to the uclibc's UCLIBC_EXTRA_CFLAGS.
> It was mentioned in the past IIRC, however it wasn't done because
> probably nobody felt the need for it since everybody was asking for that
> for consistency alone.
> Regards.

Makes sense. And I think I'll do a re-spin of my patch that implements
your suggestion.

Even though my intention was to completely align uClibc's flags with all
other binaries on target, probably it's enough to have this proposed
possibility to add manually set op option to uClibc in particular.

Still I think if any package gets broken due to some combination of
compiler options passed this is definitely a problem in either package
itself or toolchain. And either variant should be investigated and
properly fixed. Otherwise we introduce "robustness and predictability by
fixed setup" :)

-Alexey
diff mbox

Patch

diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index ce416dd..419a4d1 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -24,6 +24,8 @@  endif
 
 UCLIBC_INSTALL_STAGING = YES
 
+UCLIBC_EXTRA_CFLAGS = $(TARGET_CFLAGS)
+
 # uclibc is part of the toolchain so disable the toolchain dependency
 UCLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO