* [PATCH] compile with -funit-at-a-time option of gcc
@ 2005-06-30 4:53 aq
2005-06-30 8:02 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: aq @ 2005-06-30 4:53 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
This patch makes xen compiled with gcc option -funit-at-a-time if
supported. This option is available for gcc 3.4 and upward, which
reduces the .text binary size considerably.
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
$ diffstat configmk.patch
Config.mk | 6 ++++++
1 files changed, 6 insertions(+)
[-- Attachment #2: configmk.patch --]
[-- Type: application/octet-stream, Size: 632 bytes --]
===== Config.mk 1.6 vs edited =====
--- 1.6/Config.mk 2005-06-18 18:24:47 +09:00
+++ edited/Config.mk 2005-06-30 13:41:06 +09:00
@@ -29,8 +29,14 @@
EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBDIR)
endif
+cc-option := $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
+check_gcc := $(call cc-option, $(1),$(2))
+
LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
+CFLAGS += $(call check_gcc,-funit-at-a-time,)
# Choose the best mirror to download linux kernel
KERNEL_REPO = http://www.kernel.org
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] compile with -funit-at-a-time option of gcc
@ 2005-06-30 7:21 Ian Pratt
2005-06-30 8:04 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: Ian Pratt @ 2005-06-30 7:21 UTC (permalink / raw)
To: aq, xen-devel
> This patch makes xen compiled with gcc option
> -funit-at-a-time if supported. This option is available for
> gcc 3.4 and upward, which reduces the .text binary size considerably.
I haven't come across this option before. What does it actually do?
Thanks,
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] compile with -funit-at-a-time option of gcc
2005-06-30 4:53 [PATCH] compile with -funit-at-a-time option of gcc aq
@ 2005-06-30 8:02 ` Keir Fraser
0 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2005-06-30 8:02 UTC (permalink / raw)
To: aq; +Cc: xen-devel
On 30 Jun 2005, at 05:53, aq wrote:
> This patch makes xen compiled with gcc option -funit-at-a-time if
> supported. This option is available for gcc 3.4 and upward, which
> reduces the .text binary size considerably.
This option is the default for -O2 and above in gcc4 anyway. It might
explain why I end up with a buggy Xen when I build with gcc4 (Linux has
had a number of problems with -funit-at-a-time, because odf extra stack
usage and code reordering).
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] compile with -funit-at-a-time option of gcc
2005-06-30 7:21 Ian Pratt
@ 2005-06-30 8:04 ` Keir Fraser
2005-06-30 9:12 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2005-06-30 8:04 UTC (permalink / raw)
To: Ian Pratt; +Cc: xen-devel
On 30 Jun 2005, at 08:21, Ian Pratt wrote:
>> This patch makes xen compiled with gcc option
>> -funit-at-a-time if supported. This option is available for
>> gcc 3.4 and upward, which reduces the .text binary size considerably.
>
> I haven't come across this option before. What does it actually do?
Considers whole file at a time when doing optimisation. It's the
default on gcc4 with -O2 and above. We probably don;t want to enable it
before a general move to gcc4 as it does break stuff (albeit stuff that
was buggy/broken already ;-) ). Adding another skanky CFLAG that will
be defaulted anyway in future, to get the benefit of maybe subtly
breaking Xen, doesn;t sound like a big win to me.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] compile with -funit-at-a-time option of gcc
2005-06-30 8:04 ` Keir Fraser
@ 2005-06-30 9:12 ` Andi Kleen
0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2005-06-30 9:12 UTC (permalink / raw)
To: Keir Fraser; +Cc: Ian.Pratt, xen-devel
Keir Fraser <Keir.Fraser@cl.cam.ac.uk> writes:
> On 30 Jun 2005, at 08:21, Ian Pratt wrote:
>
> >> This patch makes xen compiled with gcc option
> >> -funit-at-a-time if supported. This option is available for
> >> gcc 3.4 and upward, which reduces the .text binary size considerably.
> >
> > I haven't come across this option before. What does it actually do?
>
> Considers whole file at a time when doing optimisation. It's the
Basically it allows inlining even when a function is defined after
the caller and makes the inliner more aggressive. Everything static with
only one caller will be always inlined.
> default on gcc4 with -O2 and above. We probably don;t want to enable
> it before a general move to gcc4 as it does break stuff (albeit stuff
> that was buggy/broken already ;-) ). Adding another skanky CFLAG that
> will be defaulted anyway in future, to get the benefit of maybe subtly
> breaking Xen, doesn;t sound like a big win to me.
The main breakage that can usually happen with unit-at-a-time
(short of broken inline asms) is that your stack frames grow
too big because gcc before 4 is not very good at reusing the slots,
but they add up with aggressive inlining.
You can check for that with a simple
objdump -S ... | grep sub.*[re]sp | sort ...
and check for anything big enough that might overflow your kernel stack.
The main kernel has a special check script for this too.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-06-30 9:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-30 4:53 [PATCH] compile with -funit-at-a-time option of gcc aq
2005-06-30 8:02 ` Keir Fraser
-- strict thread matches above, loose matches on Subject: below --
2005-06-30 7:21 Ian Pratt
2005-06-30 8:04 ` Keir Fraser
2005-06-30 9:12 ` Andi Kleen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.