Skip to contentSkip to conversation

arch/i386/Makefile,scripts/gcc-version.sh,Makefile small fixes

PATCH In review Serge Belyshev 3 participants 5 messages Jan 24, 2004 – Jan 25, 2004 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/i386/Makefile,scripts/gcc-version.sh,Makefile small fixes

[This patch is against 2.6.2-rc1-mm2]

arch/i386/Makefile:
* omitted $(KBUILD_SRC)/ in script call.

scripts/gcc-version.sh:
* GNU tail no longer supports 'tail -1' syntax.

Makefile:
* There is no point in adding -funit-at-a-time option because it is enabled by default at levels -Os, -O2 and -O3.

* Consider adding -fweb option:

vanilla:

   $ size vmlinux
      text    data     bss     dec     hex filename
   3056270  526780  386056 3969106  3c9052 vmlinux

with -fweb:

   $ size vmlinux
      text    data     bss     dec     hex filename
   3049523  526780  386056 3962359  3c75f7 vmlinux

Also note 0.1 ... 1.0% speedup in various benchmarks. This option is not enabled by default at -O2 because it (like -fomit-frame-pointer) makes debugging impossible.

arch/i386/Makefile +1 -1
diff -urN vanilla-2.6.2-rc1-mm2/arch/i386/Makefile hack/arch/i386/Makefile
@@ -70,7 +70,7 @@
 
 # -mregparm=3 works ok on gcc-3.0 and later
 #
-GCC_VERSION			:= $(shell $(CONFIG_SHELL) scripts/gcc-version.sh $(CC))
+GCC_VERSION			:= $(shell $(CONFIG_SHELL) $(KBUILD_SRC)/scripts/gcc-version.sh $(CC))
 cflags-$(CONFIG_REGPARM) 	+= $(shell if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;)
 
 CFLAGS += $(cflags-y)
scripts/gcc-version.sh +2 -2
diff -urN vanilla-2.6.2-rc1-mm2/scripts/gcc-version.sh hack/scripts/gcc-version.sh
@@ -8,7 +8,7 @@
 
 compiler="$*"
 
-MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -1)
-MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -1)
+MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
+MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
 printf "%02d%02d\\n" $MAJOR $MINOR
 
Makefile +1 -4
diff -urN vanilla-2.6.2-rc1-mm2/Makefile hack/Makefile
@@ -435,15 +435,12 @@
 
 ifndef CONFIG_FRAME_POINTER
 CFLAGS		+= -fomit-frame-pointer
+CFLAGS		+= $(call check_gcc,-fweb,)
 endif
 
 ifdef CONFIG_DEBUG_INFO
 CFLAGS		+= -g
 endif
-
-# Enable unit-at-a-time mode when possible. It shrinks the
-# kernel considerably.
-CFLAGS += $(call check_gcc,-funit-at-a-time,)
 
 # warn about C99 declaration after statement
 CFLAGS += $(call check_gcc,-Wdeclaration-after-statement,)
#1 lore raw
Quoted 2 lines · Serge Belyshev

[This patch is against 2.6.2-rc1-mm2]

Is appreciated, thanks.

Quoted 2 lines

arch/i386/Makefile:
* omitted $(KBUILD_SRC)/ in script call.

OK

Quoted 2 lines

scripts/gcc-version.sh:
* GNU tail no longer supports 'tail -1' syntax.

OK.

Quoted 3 lines

Makefile:
* There is no point in adding -funit-at-a-time option because it is enabled by default at levels -Os, -O2 and -O3.

hm. Didn't Andi say that adding -fno-unit-at-a-time caused code shrinkage?

Quoted 1 line

* Consider adding -fweb option:

What does it do?

Quoted 5 lines

vanilla:

   $ size vmlinux
      text    data     bss     dec     hex filename
   3056270  526780  386056 3969106  3c9052 vmlinux
Quoted 8 lines

with -fweb:

   $ size vmlinux
      text    data     bss     dec     hex filename
   3049523  526780  386056 3962359  3c75f7 vmlinux

Also note 0.1 ... 1.0% speedup in various benchmarks. This option is not enabled by default at -O2 because it (like -fomit-frame-pointer) makes debugging impossible.

OK, then we'd need a config option for it.

#2 lore raw
Quoted 5 lines · Andrew Morton
Quoted 3 lines

Makefile:
* There is no point in adding -funit-at-a-time option because it is enabled by default at levels -Os, -O2 and -O3.

hm. Didn't Andi say that adding -fno-unit-at-a-time caused code shrinkage?

Also, at least for the Fedora gcc-ssa compiler, -funit-at-a-time is *not* a default option (provably so - building with gcc-ssa makes a kernel that hangs *very* early on (right after 'decompressing the kernel' - I haven't dug into this yet) - but commenting out this:

# Enable unit-at-a-time mode when possible. It shrinks the

# kernel considerably.
CFLAGS += $(call check_gcc,-funit-at-a-time,)

results in a working kernel. This is with:

% gcc-ssa --version
gcc-ssa (GCC) 3.5-tree-ssa 20040115 (Fedora Core Rawhide 3.5ssa-108)

#3 lore raw
Quoted 3 lines

Also, at least for the Fedora gcc-ssa compiler, -funit-at-a-time is *not* a default option (provably so - building with gcc-ssa makes a kernel that hangs *very* early on (right after 'decompressing the kernel' - I haven't dug into

But for gcc-3_4-branch (3.4.0 prerelease) and mainline (3.5.0 experimental) -funit-at-a-time is default (at -O2 and higher) and works (at least for me :-).

#4 lore raw
In reply to Andrew Morton
Quoted 5 lines
Quoted 1 line

* Consider adding -fweb option:

What does it do?

From gcc(1):

-fweb
Constructs webs as commonly used for register allocation purposes and assign each web individual pseudo register. This allows our register allocation pass to operate on pseudos directly, but also strengthens several other optimization passes, such as CSE, loop optimizer and trivial dead code remover. It can, however, make debugging impossible, since variables will no longer stay in a ``home register''.

Enabled at levels -O3.