2005-09-10 20:02:11

by Sam Ravnborg

[permalink] [raw]
Subject: [GIT PATCHES] final kbuild update before fix-only period

Hi Linus.

Please pull from:
rsync://sync.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git

The updates are pushed to master.kernel.org - still waiting for
mirroring to pick them up.

This update contains a fix with make O= for generic asm-offsets.h, plus
additional patches from my queue.
This clears my queue of pending patches for 2.6.14.

I will try to follow-up with all patches.

Sam


Jan Beulich:
kbuild: adjust .version updating
kbuild: fix split-include dependency

Roland McGrath:
kbuild: ignore all debugging info sections in scripts/reference_discarded.pl

Sam Ravnborg:
kbuild: add objectify
kbuild: fix generic asm-offsets.h support

[email protected]:
kbuild: CF=<arguments> passes arguments to sparse

Zach Brown:
kbuild: add kernelrelease to 'make help'


Makefile | 23 ++++++++++++++++-------
b/Kbuild | 5 +++--
b/Makefile | 2 +-
b/scripts/Kbuild.include | 3 +++
b/scripts/reference_discarded.pl | 7 +------
5 files changed, 24 insertions(+), 16 deletions(-)


2005-09-10 20:32:29

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 1/7] kbuild: add kernelrelease to 'make help'

It sems git-send-emails fooled me again.
So here follows the patches send manually.

>From nobody Mon Sep 17 00:00:00 2001
Subject: [PATCH 1/7] kbuild: add kernelrelease to 'make help'
From: Zach Brown <[email protected]>
Date: 1126120103 -0700

Dunno if there was a conscious decision to leave it out, but if you're
happy with adding some help text for it here's a patch against 2.6.13-mm1..

Signed-off-by: Sam Ravnborg <[email protected]>

---

Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

6d12884259ac65f74538b7819f5fadf4ebb0d569
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1053,6 +1053,7 @@ help:
@echo ' rpm - Build a kernel as an RPM package'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
+ @echo ' kernelrelease - Output the release version string'
@echo ''
@echo 'Static analysers'
@echo ' buildcheck - List dangling references to vmlinux discarded sections'

2005-09-10 20:33:17

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 2/7] kbuild: CF=<arguments> passes arguments to sparse

Allows to add to sparse arguments without mutilating makefiles - just
pass CF=<arguments> and they will be added to CHECKFLAGS.

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>

---

Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

7b49bb9aff8b14d15da58111d8908c877c0a525e
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,7 @@ KALLSYMS = scripts/kallsyms
PERL = perl
CHECK = sparse

-CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
+CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF)
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)

2005-09-10 20:33:56

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 3/7] kbuild: adjust .version updating

In order to maintain a more correct build number, updates to the
version
number should only be commited after a successful link of vmlinux, not
before (so that errors in the link process don't lead to pointless
increments).

Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>

---

Makefile | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

4e25d8bb9550fb5912165196fe8502cdb831a336
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -641,8 +641,13 @@ quiet_cmd_vmlinux__ ?= LD $@
# Generate new vmlinux version
quiet_cmd_vmlinux_version = GEN .version
cmd_vmlinux_version = set -e; \
- . $(srctree)/scripts/mkversion > .tmp_version; \
- mv -f .tmp_version .version; \
+ if [ ! -r .version ]; then \
+ rm -f .version; \
+ echo 1 >.version; \
+ else \
+ mv .version .old_version; \
+ expr 0$$(cat .old_version) + 1 >.version; \
+ fi; \
$(MAKE) $(build)=init

# Generate System.map
@@ -756,6 +761,7 @@ endif # ifdef CONFIG_KALLSYMS
# vmlinux image - including updated kernel symbols
vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
$(call if_changed_rule,vmlinux__)
+ $(Q)rm -f .old_version

# The actual objects are generated when descending,
# make sure no implicit rule kicks in

2005-09-10 20:34:30

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 4/7] kbuild: fix split-include dependency

Splitting of autoconf.h requires that split-include was built before,
and
needs to be-re-done when split-include changes. This dependency was
previously missing. Additionally, since autoconf.h is (suppoosed to
be)
generated as a side effect of executing config targets, include/linux
should be created prior to running the respective sub-make.

Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>

---

Makefile | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

cd05e6bdc6001ac6e8ab13720693b7e1302d9848
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -382,6 +382,9 @@ RCS_TAR_IGNORE := --exclude SCCS --exclu
scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic

+# To avoid any implicit rule to kick in, define an empty command.
+scripts/basic/%: scripts_basic ;
+
.PHONY: outputmakefile
# outputmakefile generate a Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
@@ -444,9 +447,8 @@ ifeq ($(config-targets),1)
include $(srctree)/arch/$(ARCH)/Makefile
export KBUILD_DEFCONFIG

-config: scripts_basic outputmakefile FORCE
- $(Q)$(MAKE) $(build)=scripts/kconfig $@
-%config: scripts_basic outputmakefile FORCE
+config %config: scripts_basic outputmakefile FORCE
+ $(Q)mkdir -p include/linux
$(Q)$(MAKE) $(build)=scripts/kconfig $@

else
@@ -854,7 +856,7 @@ include/asm:

# Split autoconf.h into include/linux/config/*

-include/config/MARKER: include/linux/autoconf.h
+include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h
@echo ' SPLIT include/linux/autoconf.h -> include/config/*'
@scripts/basic/split-include include/linux/autoconf.h include/config
@touch $@

2005-09-10 20:35:06

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 5/7] kbuild: ignore all debugging info sections in scripts/reference_discarded.pl

GCC 4 emits more DWARF debugging information than before and there is now a
.debug_loc section as well. This causes "make buildcheck" to fail. Rather
than just add that one to the special case list, I used a regexp to ignore
any .debug_ANYTHING sections in case more show up in the future.

Signed-off-by: Roland McGrath <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>

---

scripts/reference_discarded.pl | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)

caba0233bc85ec311159a35f138d957d05cf2fe8
diff --git a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl
--- a/scripts/reference_discarded.pl
+++ b/scripts/reference_discarded.pl
@@ -91,12 +91,7 @@ foreach $object (keys(%object)) {
$from !~ /\.exit\.data$/ &&
$from !~ /\.altinstructions$/ &&
$from !~ /\.pdr$/ &&
- $from !~ /\.debug_info$/ &&
- $from !~ /\.debug_aranges$/ &&
- $from !~ /\.debug_ranges$/ &&
- $from !~ /\.debug_line$/ &&
- $from !~ /\.debug_frame$/ &&
- $from !~ /\.debug_loc$/ &&
+ $from !~ /\.debug_.*$/ &&
$from !~ /\.exitcall\.exit$/ &&
$from !~ /\.eh_frame$/ &&
$from !~ /\.stab$/)) {

2005-09-10 20:35:37

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 6/7] kbuild: add objectify

Use foo := $(call objectify, $(foo)) to prefix $(foo) with $(obj)/ unless
$(foo) is an absolute path.
For now no in-tree users - soon to come.

Signed-off-by: Sam Ravnborg <[email protected]>

---

scripts/Kbuild.include | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

0a504f259c90fb41d3495d490fc9dbe2530c8749
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -49,6 +49,9 @@ build := -f $(if $(KBUILD_SRC),$(srctree
cmd = @$(if $($(quiet)cmd_$(1)),\
echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))

+# Add $(obj)/ for paths that is not absolute
+objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
+
###
# if_changed - execute command if any prerequisite is newer than
# target, or command line has changed

2005-09-10 20:36:33

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 7/7] kbuild: fix generic asm-offsets.h support

This fixes a bug where the generated asm-offsets.h file was saved in
the source tree even with make O=.
Thanks to Stephen Rothwell <[email protected]> for the report.

Signed-off-by: Sam Ravnborg <[email protected]>

---

Kbuild | 5 +++--
Makefile | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)

8d36a62364b6b04dc7b0e9fe09f6968f4e5a1f0a
diff --git a/Kbuild b/Kbuild
--- a/Kbuild
+++ b/Kbuild
@@ -4,7 +4,7 @@
# 1) Generate asm-offsets.h

#####
-# 1) Generate asm-offsets.h
+# 1) Generate asm-offsets.h
#

offsets-file := include/asm-$(ARCH)/asm-offsets.h
@@ -22,6 +22,7 @@ sed-$(CONFIG_MIPS) := "/^@@@/s///p"

quiet_cmd_offsets = GEN $@
define cmd_offsets
+ mkdir -p $(dir $@); \
cat $< | \
(set -e; \
echo "#ifndef __ASM_OFFSETS_H__"; \
@@ -43,6 +44,6 @@ arch/$(ARCH)/kernel/asm-offsets.s: arch/
$(Q)mkdir -p $(dir $@)
$(call if_changed_dep,cc_s_c)

-$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
+$(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
$(call cmd,offsets)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -814,7 +814,7 @@ ifneq ($(KBUILD_MODULES),)
endif

prepare0: prepare prepare1 FORCE
- $(Q)$(MAKE) $(build)=$(srctree)
+ $(Q)$(MAKE) $(build)=.

# All the preparing..
prepare-all: prepare0

2005-09-11 12:27:26

by Denis Vlasenko

[permalink] [raw]
Subject: Re: [GIT PATCHES] final kbuild update before fix-only period

On Saturday 10 September 2005 23:03, Sam Ravnborg wrote:
> Hi Linus.
>
> Please pull from:
> rsync://sync.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git
>
> The updates are pushed to master.kernel.org - still waiting for
> mirroring to pick them up.
>
> This update contains a fix with make O= for generic asm-offsets.h, plus
> additional patches from my queue.
> This clears my queue of pending patches for 2.6.14.
>
> I will try to follow-up with all patches.

Hi Sam,

BUG()s etc which are using __FILE__ to get source filename
print horribly long names like

/.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c

if one builds kernel in separate object dir.
This is ugly and wastes space in kernel image. Any ideas how to fix this?
--
vda

2005-09-11 13:58:13

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [GIT PATCHES] final kbuild update before fix-only period

> Hi Sam,
>
> BUG()s etc which are using __FILE__ to get source filename
> print horribly long names like
>
> /.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c
>
> if one builds kernel in separate object dir.
> This is ugly and wastes space in kernel image. Any ideas how to fix this?

I have once experimenting with this on request from Olaf.
The only way I could fine was to pass a new define:
-DKBUILD_FILE='short-file-name' to gcc.
This has the sideeffect that we always accuse the main .c file for
being the culprint.
gcc warns if we override __FILE__

__FILE__ is used in 123 files of wich 26 is within arch/
so it will take a while to change...

I can cook up something if there is interest.

Sam

2005-09-12 07:20:55

by Denis Vlasenko

[permalink] [raw]
Subject: Re: [GIT PATCHES] final kbuild update before fix-only period

On Sunday 11 September 2005 17:00, Sam Ravnborg wrote:
> > BUG()s etc which are using __FILE__ to get source filename
> > print horribly long names like
> >
> > /.share/usr/src2/kernel/linux-2.6.13-mm2.src/drivers/net/.../some.c
> >
> > if one builds kernel in separate object dir.
> > This is ugly and wastes space in kernel image. Any ideas how to fix this?
>
> I have once experimenting with this on request from Olaf.
> The only way I could fine was to pass a new define:
> -DKBUILD_FILE='short-file-name' to gcc.
> This has the sideeffect that we always accuse the main .c file for
> being the culprint.
> gcc warns if we override __FILE__
>
> __FILE__ is used in 123 files of wich 26 is within arch/
> so it will take a while to change...

I think the worst offender is BUG/BUG_ON():

# grep -r BUG . | grep -v DEBUG | wc -l
5208

~5000 copies of "/.share/usr/src2/kernel/linux-2.6.13-mm2.src" string
in my kernel??! That's not funny...

> I can cook up something if there is interest.

/me is interested.
--
vda