* [Buildroot] CFLAGS_FOR_BUILD compiler flags
@ 2010-10-29 13:18 Will Newton
2010-10-29 19:06 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: Will Newton @ 2010-10-29 13:18 UTC (permalink / raw)
To: buildroot
Hi all,
It looks like something changed with the flags passed when building
toolchains. In older buildroots it seems we passed "-g -O2"
explicitly:
$ grep CFLAGS_FOR_BUILD toolchain/gcc/gcc-uclibc-3.x.mk
CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
Now we use TARGET_CONFIGURE_OPTS, which sets CFLAGS_FOR_BUILD for us:
$ grep CFLAGS_FOR_BUILD package/Makefile.in
CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
But without the -g -O2 being added. This results in the toolchain
being built without optimisations, which makes it a bit slower than it
otherwise would be (although I expect it makes building the toolchain
faster!).
CFLAGS_FOR_BUILD is currently defaulted in the top-level Makefile but
then not used. Perhaps a patch like the below would be the right thing
to do? Comments?
---
Set a default set of flags (-g -O2) for the host tools, this
prevents the tools from being built without optimisation which
improves build times considerably.
Signed-off-by: Will Newton <will.newton@imgtec.com>
---
Makefile | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 462d974..c711f22 100644
--- a/Makefile
+++ b/Makefile
@@ -144,14 +144,14 @@ HOSTLD:=$(shell which $(HOSTLD) || type -p
$(HOSTLD) || echo ld)
HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
-ifndef CFLAGS_FOR_BUILD
-CFLAGS_FOR_BUILD:=-g -O2
+ifndef HOST_CFLAGS
+HOST_CFLAGS:=-g -O2
endif
-ifndef CXXFLAGS_FOR_BUILD
-CXXFLAGS_FOR_BUILD:=-g -O2
+ifndef HOST_CXXFLAGS
+HOST_CXXFLAGS:=-g -O2
endif
-ifndef FCFLAGS_FOR_BUILD
-FCFLAGS_FOR_BUILD:=-g -O2
+ifndef HOST_FCFLAGS
+HOST_FCFLAGS:=-g -O2
endif
export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
--
1.7.2.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Makefile-Default-values-of-HOST_CFLAGS-_CXXFLAGS-and.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101029/b3fb61c4/attachment.bin>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] CFLAGS_FOR_BUILD compiler flags
2010-10-29 13:18 [Buildroot] CFLAGS_FOR_BUILD compiler flags Will Newton
@ 2010-10-29 19:06 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2010-10-29 19:06 UTC (permalink / raw)
To: buildroot
>>>>> "Will" == Will Newton <will.newton@gmail.com> writes:
Will> Hi all,
Will> It looks like something changed with the flags passed when building
Will> toolchains. In older buildroots it seems we passed "-g -O2"
Will> explicitly:
Will> $ grep CFLAGS_FOR_BUILD toolchain/gcc/gcc-uclibc-3.x.mk
Will> CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
Will> CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
Will> CFLAGS_FOR_BUILD="-g -O2 $(HOST_CFLAGS)" \
Will> Now we use TARGET_CONFIGURE_OPTS, which sets CFLAGS_FOR_BUILD for us:
Will> $ grep CFLAGS_FOR_BUILD package/Makefile.in
Will> CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
Will> FCFLAGS_FOR_BUILD="$(HOST_FCFLAGS)" \
Will> But without the -g -O2 being added. This results in the toolchain
Will> being built without optimisations, which makes it a bit slower than it
Will> otherwise would be (although I expect it makes building the toolchain
Will> faster!).
Will> CFLAGS_FOR_BUILD is currently defaulted in the top-level Makefile but
Will> then not used. Perhaps a patch like the below would be the right thing
Will> to do? Comments?
You're completely right. I prefer to get rid of CFLAGS_FOR_BUILD though
as it's only used by sstrip, so I've committed a slightly different patch.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-29 19:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29 13:18 [Buildroot] CFLAGS_FOR_BUILD compiler flags Will Newton
2010-10-29 19:06 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox