From c8447161470d0292cc96b4f28f03a8eedb7806e9 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Thu, 3 Jun 2010 10:54:58 +0200 Subject: Makefile: clarify a comment os user writes: From the last comment, arch makefile will override vmlinux. It seems vmlinux will not be checked by `make'. But from my test, although `all:' will be re-defined in arch Makefile (ARM arch), vmlinux will still be checked and the commands associated will be executed. Should we use another word instead of "overridden"? Reported-by: os user Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ea5f0bee1934..46040e887d83 100644 --- a/Makefile +++ b/Makefile @@ -526,7 +526,7 @@ endif # $(dot-config) # The all: target is the default when no target is given on the # command line. # This allow a user to issue only 'make' to build a kernel including modules -# Defaults vmlinux but it is usually overridden in the arch makefile +# Defaults to vmlinux, but the arch makefile usually adds further targets all: vmlinux ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -- cgit v1.2.3 From 74425eee71eb44c9f370bd922f72282b69bb0eab Mon Sep 17 00:00:00 2001 From: Nicolas Palix Date: Sun, 6 Jun 2010 17:15:01 +0200 Subject: Add a target to use the Coccinelle checker A 'coccicheck' target is added. It can be called with four different modes. Each one generates a different kind of output, i.e. context, patch, org, report, according to the corresponding mode to be activated. The new target calls the 'coccicheck' front-end in the 'scripts' directory with the MODE argument. Every SmPL file in the subdirectories of 'scripts/coccinelle' is then given to the front-end and applied to the entire source tree. The four modes behave as follows: 'report' generates a list in the following format: file:line:column-column: message 'patch' proposes a fix, when possible. 'context' highlights lines of interest and their context in a diff-like style. Lines of interest are indicated with '-'. 'org' generates a report in the Org mode format of Emacs. Signed-off-by: Nicolas Palix Signed-off-by: Julia Lawall Acked-by: Sam Ravnborg Acked-by: Joerg Roedel Signed-off-by: Michal Marek --- MAINTAINERS | 10 ++++++++++ Makefile | 10 +++++++--- scripts/Makefile.help | 3 +++ scripts/coccicheck | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 scripts/Makefile.help create mode 100755 scripts/coccicheck (limited to 'Makefile') diff --git a/MAINTAINERS b/MAINTAINERS index ce3601e5e3c8..0572b7ea5f9f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1476,6 +1476,16 @@ M: Daniel Oliveira Nascimento S: Supported F: drivers/platform/x86/classmate-laptop.c +COCCINELLE/Semantic Patches (SmPL) +M: Julia Lawall +M: Gilles Muller +M: Nicolas Palix +L: cocci@diku.dk (moderated for non-subscribers) +W: http://coccinelle.lip6.fr/ +S: Supported +F: scripts/coccinelle/ +F: scripts/coccicheck + CODA FILE SYSTEM M: Jan Harkes M: coda@cs.cmu.edu diff --git a/Makefile b/Makefile index ea5f0bee1934..5a4bf98e83a5 100644 --- a/Makefile +++ b/Makefile @@ -412,7 +412,7 @@ endif # of make so .config is not included in this case either (for *config). no-dot-config-targets := clean mrproper distclean \ - cscope TAGS tags help %docs check% \ + cscope TAGS tags help %docs check% coccicheck \ include/linux/version.h headers_% \ kernelrelease kernelversion @@ -1279,8 +1279,9 @@ help: @echo ' includecheck - Check for duplicate included header files' @echo ' export_report - List the usages of all exported symbols' @echo ' headers_check - Sanity check on exported headers' - @echo ' headerdep - Detect inclusion cycles in headers'; \ - echo '' + @echo ' headerdep - Detect inclusion cycles in headers' + @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help + @echo '' @echo 'Kernel packaging:' @$(MAKE) $(build)=$(package-dir) help @echo '' @@ -1439,6 +1440,9 @@ versioncheck: -name '*.[hcS]' -type f -print | sort \ | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl +coccicheck: + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@ + namespacecheck: $(PERL) $(srctree)/scripts/namespace.pl diff --git a/scripts/Makefile.help b/scripts/Makefile.help new file mode 100644 index 000000000000..d03608f5db04 --- /dev/null +++ b/scripts/Makefile.help @@ -0,0 +1,3 @@ + +checker-help: + @echo ' coccicheck - Check with Coccinelle.' diff --git a/scripts/coccicheck b/scripts/coccicheck new file mode 100755 index 000000000000..037424b9ede5 --- /dev/null +++ b/scripts/coccicheck @@ -0,0 +1,54 @@ +#!/bin/sh + +SPATCH="`which ${SPATCH:=spatch}`" + +if [ ! -x "$SPATCH" ]; then + echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' + exit 1 +fi + +if [ "$MODE" = "" ] ; then + echo 'You have not explicitly specify the mode to use. Fallback to "report".' + echo 'You can specify the mode with "make coccicheck MODE="' + echo 'Available modes are: report, patch, context, org' + MODE="report" +fi + +echo '' +echo 'Please check for false positives in the output before submitting a patch.' +echo 'When using "patch" mode, carefully review the patch before submitting it.' +echo '' + +function coccinelle { + COCCI="$1" + DIR="$2" + + OPT=`grep "Option" $COCCI | cut -d':' -f2` + FILE=`echo $COCCI | sed "s|$DIR/||"` + + echo "Processing `basename $COCCI` with option(s) \"$OPT\"" + echo 'Message example to submit a patch:' + + sed -e '/\/\/\//!d' -e 's|^///||' $COCCI + + echo ' The semantic patch that makes this change is available' + echo " in $FILE." + echo '' + echo ' More information about semantic patching is available at' + echo ' http://coccinelle.lip6.fr/' + echo '' + +# The option '-parse_cocci' can be used to syntaxically check the SmPL files. +# +# $SPATCH -D $MODE -very_quiet -parse_cocci $COCCI $OPT > /dev/null + + $SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR +} + +if [ "$COCCI" = "" ] ; then + for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do + coccinelle $f $srctree; + done +else + coccinelle $COCCI $srctree +fi -- cgit v1.2.3 From 01ab17887f4cdcb8bb5a5d1bc3b160d186e6e99b Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Mon, 28 Jun 2010 10:45:21 +0800 Subject: Makefile: "make kernelrelease" should show the correct full kernel version After commit 85a256d8e0116c8f5ad276730830f5d4d473344d, 'make kernelrelease' doesn't show the correct full kernel version. This patch fixes it, 'make kernelrelease' will show the same version name with the one you finally get. Cc: David Rientjes Cc: Michal Marek Signed-off-by: Amerigo Wang [mmarek: merged with 0915512 and added dependency on include/config/kernel.release] Signed-off-by: Michal Marek --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a86ac8c4798e..dceb4f19f786 100644 --- a/Makefile +++ b/Makefile @@ -414,7 +414,7 @@ endif no-dot-config-targets := clean mrproper distclean \ cscope TAGS tags help %docs check% \ include/linux/version.h headers_% \ - kernelrelease kernelversion + kernelversion config-targets := 0 mixed-targets := 0 @@ -1395,9 +1395,9 @@ checkstack: $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH) -kernelrelease: - $(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \ - $(error kernelrelease not valid - run 'make prepare' to update it)) +kernelrelease: include/config/kernel.release + @echo $(KERNELRELEASE) + kernelversion: @echo $(KERNELVERSION) -- cgit v1.2.3 From 9554c87306e1ced2ef1131829ca0f45f92e57b90 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 5 Jul 2010 23:36:16 +0200 Subject: kbuild: Fix path to scripts/setlocalversion Commit 0a564b2 broke LOCALVERSION for O=... builds. Ouch. Reported-by: Stephen Rothwell Reported-by: Rafael J. Wysocki Signed-off-by: Michal Marek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a1b409001e8b..18196cccce5e 100644 --- a/Makefile +++ b/Makefile @@ -886,7 +886,7 @@ $(vmlinux-dirs): prepare scripts # Store (new) KERNELRELASE string in include/config/kernel.release include/config/kernel.release: include/config/auto.conf FORCE $(Q)rm -f $@ - $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) scripts/setlocalversion $(srctree))" > $@ + $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@ # Things we need to do before we recursively start building the kernel -- cgit v1.2.3 From d6f4ceb796ebf1a8c8a9ad4a8ea0d181aaec7de6 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 14 Jul 2010 15:43:52 +0200 Subject: Kbuild: Add option to set -femit-struct-debug-baseonly Newer gcc has a -femit-struct-debug-baseonly option that dramatically reduces the size of object files with debug info. What it does is to only emit type information for structures when the structures are defined in the same file or in a header file. This means the type information for most headers are not included. This is not good when the type information is actually needed (e.g. with kgdb or systemtap) But often kernel hackers only care about line numbers and don't need all the type information anyways. In this case setting the option can be a big win: A build dir for a specific x86-64 configuration with gcc 4.5 shrunk from 2.3G to 1.2G. The compilation was also nearly a minute faster. Signed-off-by: Andi Kleen [mmarek: reformatted help text] Signed-off-by: Michal Marek --- Makefile | 4 ++++ lib/Kconfig.debug | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index dceb4f19f786..e1dfb90c6092 100644 --- a/Makefile +++ b/Makefile @@ -557,6 +557,10 @@ KBUILD_CFLAGS += -g KBUILD_AFLAGS += -gdwarf-2 endif +ifdef CONFIG_DEBUG_INFO_REDUCED +KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) +endif + ifdef CONFIG_FUNCTION_TRACER KBUILD_CFLAGS += -pg endif diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 25c3ed594c54..2af5d84ec824 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -595,6 +595,19 @@ config DEBUG_INFO If unsure, say N. +config DEBUG_INFO_REDUCED + bool "Reduce debugging information" + depends on DEBUG_INFO + help + If you say Y here gcc is instructed to generate less debugging + information for structure types. This means that tools that + need full debugging information (like kgdb or systemtap) won't + be happy. But if you merely need debugging information to + resolve line numbers there is no loss. Advantage is that + build directory object sizes shrink dramatically over a full + DEBUG_INFO build and compile times are reduced too. + Only works with newer gcc versions. + config DEBUG_VM bool "Debug VM" depends on DEBUG_KERNEL -- cgit v1.2.3