浏览代码

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes:
  docbook: make cleandocs
  kbuild: fix spurious initramfs rebuild
  Documentation: explain the difference between __bitwise and __bitwise__
  kbuild: make it possible for the linker to discard local symbols from vmlinux
  kbuild: remove pointless strdup() on arguments passed to new_module() in modpost
  kbuild: fix a few typos in top-level Makefile
  kbuild: introduce destination-y for exported headers
  kbuild: use git svn instead of git-svn in setlocalversion
  kconfig: fix update-po-config to accect backslash in input
  kbuild: fix option processing for -I in headerdep
Linus Torvalds 16 年之前
父节点
当前提交
80a04d3f2f

+ 8 - 3
Documentation/DocBook/Makefile

@@ -31,7 +31,7 @@ PS_METHOD	= $(prefer-db2x)
 
 
 ###
 ###
 # The targets that may be used.
 # The targets that may be used.
-PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
+PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs
 
 
 BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
 BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
 xmldocs: $(BOOKS)
 xmldocs: $(BOOKS)
@@ -213,11 +213,12 @@ silent_gen_xml = :
 dochelp:
 dochelp:
 	@echo  ' Linux kernel internal documentation in different formats:'
 	@echo  ' Linux kernel internal documentation in different formats:'
 	@echo  '  htmldocs        - HTML'
 	@echo  '  htmldocs        - HTML'
-	@echo  '  installmandocs  - install man pages generated by mandocs'
-	@echo  '  mandocs         - man pages'
 	@echo  '  pdfdocs         - PDF'
 	@echo  '  pdfdocs         - PDF'
 	@echo  '  psdocs          - Postscript'
 	@echo  '  psdocs          - Postscript'
 	@echo  '  xmldocs         - XML DocBook'
 	@echo  '  xmldocs         - XML DocBook'
+	@echo  '  mandocs         - man pages'
+	@echo  '  installmandocs  - install man pages generated by mandocs'
+	@echo  '  cleandocs       - clean all generated DocBook files'
 
 
 ###
 ###
 # Temporary files left by various tools
 # Temporary files left by various tools
@@ -235,6 +236,10 @@ clean-files := $(DOCBOOKS) \
 
 
 clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
 clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
 
 
+cleandocs:
+	$(Q)rm -f $(call objectify, $(clean-files))
+	$(Q)rm -rf $(call objectify, $(clean-dirs))
+
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable se we can use it in if_changed and friends.
 # information in a variable se we can use it in if_changed and friends.
 
 

+ 75 - 8
Documentation/kbuild/makefiles.txt

@@ -40,10 +40,16 @@ This document describes the Linux kernel Makefiles.
 	   --- 6.7 Custom kbuild commands
 	   --- 6.7 Custom kbuild commands
 	   --- 6.8 Preprocessing linker scripts
 	   --- 6.8 Preprocessing linker scripts
 
 
-	=== 7 Kbuild Variables
-	=== 8 Makefile language
-	=== 9 Credits
-	=== 10 TODO
+	=== 7 Kbuild syntax for exported headers
+		--- 7.1 header-y
+		--- 7.2 objhdr-y
+		--- 7.3 destination-y
+		--- 7.4 unifdef-y (deprecated)
+
+	=== 8 Kbuild Variables
+	=== 9 Makefile language
+	=== 10 Credits
+	=== 11 TODO
 
 
 === 1 Overview
 === 1 Overview
 
 
@@ -1143,8 +1149,69 @@ When kbuild executes, the following steps are followed (roughly):
 	The kbuild infrastructure for *lds file are used in several
 	The kbuild infrastructure for *lds file are used in several
 	architecture-specific files.
 	architecture-specific files.
 
 
+=== 7 Kbuild syntax for exported headers
+
+The kernel include a set of headers that is exported to userspace.
+Many headers can be exported as-is but other headers requires  a
+minimal pre-processing before they are ready for user-space.
+The pre-processing does:
+- drop kernel specific annotations
+- drop include of compiler.h
+- drop all sections that is kernel internat (guarded by ifdef __KERNEL__)
+
+Each relevant directory contain a file name "Kbuild" which specify the
+headers to be exported.
+See subsequent chapter for the syntax of the Kbuild file.
+
+	--- 7.1 header-y
+
+	header-y specify header files to be exported.
+
+		Example:
+			#include/linux/Kbuild
+			header-y += usb/
+			header-y += aio_abi.h
+
+	The convention is to list one file per line and
+	preferably in alphabetic order.
+
+	header-y also specify which subdirectories to visit.
+	A subdirectory is identified by a trailing '/' which
+	can be seen in the example above for the usb subdirectory.
+
+	Subdirectories are visited before their parent directories.
+
+	--- 7.2 objhdr-y
+
+	objhdr-y specifies generated files to be exported.
+	Generated files are special as they need to be looked
+	up in another directory when doing 'make O=...' builds.
+
+		Example:
+			#include/linux/Kbuild
+			objhdr-y += version.h
+
+	--- 7.3 destination-y
+
+	When an architecture have a set of exported headers that needs to be
+	exported to a different directory destination-y is used.
+	destination-y specify the destination directory for all exported
+	headers in the file where it is present.
+
+		Example:
+			#arch/xtensa/platforms/s6105/include/platform/Kbuild
+			destination-y := include/linux
+
+	In the example above all exported headers in the Kbuild file
+	will be located in the directory "include/linux" when exported.
+
+
+	--- 7.4 unifdef-y (deprecated)
+
+	unifdef-y is deprecated. A direct replacement is header-y.
+
 
 
-=== 7 Kbuild Variables
+=== 8 Kbuild Variables
 
 
 The top Makefile exports the following variables:
 The top Makefile exports the following variables:
 
 
@@ -1206,7 +1273,7 @@ The top Makefile exports the following variables:
 	INSTALL_MOD_STRIP will used as the option(s) to the strip command.
 	INSTALL_MOD_STRIP will used as the option(s) to the strip command.
 
 
 
 
-=== 8 Makefile language
+=== 9 Makefile language
 
 
 The kernel Makefiles are designed to be run with GNU Make.  The Makefiles
 The kernel Makefiles are designed to be run with GNU Make.  The Makefiles
 use only the documented features of GNU Make, but they do use many
 use only the documented features of GNU Make, but they do use many
@@ -1225,14 +1292,14 @@ time the left-hand side is used.
 There are some cases where "=" is appropriate.  Usually, though, ":="
 There are some cases where "=" is appropriate.  Usually, though, ":="
 is the right choice.
 is the right choice.
 
 
-=== 9 Credits
+=== 10 Credits
 
 
 Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
 Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
 Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
 Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
 Updates by Sam Ravnborg <sam@ravnborg.org>
 Updates by Sam Ravnborg <sam@ravnborg.org>
 Language QA by Jan Engelhardt <jengelh@gmx.de>
 Language QA by Jan Engelhardt <jengelh@gmx.de>
 
 
-=== 10 TODO
+=== 11 TODO
 
 
 - Describe how kbuild supports shipped files with _shipped.
 - Describe how kbuild supports shipped files with _shipped.
 - Generating offset header files.
 - Generating offset header files.

+ 8 - 0
Documentation/sparse.txt

@@ -42,6 +42,14 @@ sure that bitwise types don't get mixed up (little-endian vs big-endian
 vs cpu-endian vs whatever), and there the constant "0" really _is_
 vs cpu-endian vs whatever), and there the constant "0" really _is_
 special.
 special.
 
 
+__bitwise__ - to be used for relatively compact stuff (gfp_t, etc.) that
+is mostly warning-free and is supposed to stay that way.  Warnings will
+be generated without __CHECK_ENDIAN__.
+
+__bitwise - noisy stuff; in particular, __le*/__be* are that.  We really
+don't want to drown in noise unless we'd explicitly asked for it.
+
+
 Getting sparse
 Getting sparse
 ~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~
 
 

+ 6 - 2
Makefile

@@ -567,7 +567,7 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 # disable pointer signed / unsigned warnings in gcc 4.0
 # disable pointer signed / unsigned warnings in gcc 4.0
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
 
-# disable invalid "can't wrap" optimzations for signed / pointers
+# disable invalid "can't wrap" optimizations for signed / pointers
 KBUILD_CFLAGS	+= $(call cc-option,-fwrapv)
 KBUILD_CFLAGS	+= $(call cc-option,-fwrapv)
 
 
 # revert to pre-gcc-4.4 behaviour of .eh_frame
 # revert to pre-gcc-4.4 behaviour of .eh_frame
@@ -597,6 +597,10 @@ LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
 LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
 
 
+ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
+LDFLAGS_vmlinux	+= -X
+endif
+
 # Default kernel image to build when no specific target is given.
 # Default kernel image to build when no specific target is given.
 # KBUILD_IMAGE may be overruled on the command line or
 # KBUILD_IMAGE may be overruled on the command line or
 # set in the environment
 # set in the environment
@@ -1587,5 +1591,5 @@ PHONY += FORCE
 FORCE:
 FORCE:
 
 
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # Declare the contents of the .PHONY variable as phony.  We keep that
-# information in a variable se we can use it in if_changed and friends.
+# information in a variable so we can use it in if_changed and friends.
 .PHONY: $(PHONY)
 .PHONY: $(PHONY)

+ 8 - 0
init/Kconfig

@@ -808,6 +808,14 @@ config KALLSYMS_EXTRA_PASS
 	   you wait for kallsyms to be fixed.
 	   you wait for kallsyms to be fixed.
 
 
 
 
+config STRIP_ASM_SYMS
+	bool "Strip assembler-generated symbols during link"
+	default n
+	help
+	  Strip internal assembler-generated symbols during a link (symbols
+	  that look like '.Lxxx') so they don't pollute the output of
+	  get_wchan() and suchlike.
+
 config HOTPLUG
 config HOTPLUG
 	bool "Support for hot-pluggable devices" if EMBEDDED
 	bool "Support for hot-pluggable devices" if EMBEDDED
 	default y
 	default y

+ 2 - 0
scripts/Makefile.headersinst

@@ -14,6 +14,8 @@ _dst := $(if $(dst),$(dst),$(obj))
 kbuild-file := $(srctree)/$(obj)/Kbuild
 kbuild-file := $(srctree)/$(obj)/Kbuild
 include $(kbuild-file)
 include $(kbuild-file)
 
 
+_dst := $(if $(destination-y),$(destination-y),$(_dst))
+
 include scripts/Kbuild.include
 include scripts/Kbuild.include
 
 
 install       := $(INSTALL_HDR_PATH)/$(_dst)
 install       := $(INSTALL_HDR_PATH)/$(_dst)

+ 1 - 1
scripts/gen_initramfs_list.sh

@@ -97,7 +97,7 @@ print_mtime() {
 }
 }
 
 
 list_parse() {
 list_parse() {
-	echo "$1 \\"
+	[ ! -L "$1" ] && echo "$1 \\" || :
 }
 }
 
 
 # for each file print a line in following format
 # for each file print a line in following format

+ 1 - 1
scripts/headerdep.pl

@@ -19,7 +19,7 @@ my $opt_graph;
 	version	=> \&version,
 	version	=> \&version,
 
 
 	all	=> \$opt_all,
 	all	=> \$opt_all,
-	I	=> \@opt_include,
+	"I=s"	=> \@opt_include,
 	graph	=> \$opt_graph,
 	graph	=> \$opt_graph,
 );
 );
 
 

+ 4 - 0
scripts/kconfig/kxgettext.c

@@ -43,6 +43,10 @@ static char *escape(const char* text, char *bf, int len)
 			++text;
 			++text;
 			goto next;
 			goto next;
 		}
 		}
+		else if (*text == '\\') {
+			*bfp++ = '\\';
+			len--;
+		}
 		*bfp++ = *text++;
 		*bfp++ = *text++;
 next:
 next:
 		--len;
 		--len;

+ 2 - 2
scripts/mod/modpost.c

@@ -1913,7 +1913,7 @@ static void read_dump(const char *fname, unsigned int kernel)
 		if (!mod) {
 		if (!mod) {
 			if (is_vmlinux(modname))
 			if (is_vmlinux(modname))
 				have_vmlinux = 1;
 				have_vmlinux = 1;
-			mod = new_module(NOFAIL(strdup(modname)));
+			mod = new_module(modname);
 			mod->skip = 1;
 			mod->skip = 1;
 		}
 		}
 		s = sym_add_exported(symname, mod, export_no(export));
 		s = sym_add_exported(symname, mod, export_no(export));
@@ -1997,7 +1997,7 @@ static void read_markers(const char *fname)
 
 
 		mod = find_module(modname);
 		mod = find_module(modname);
 		if (!mod) {
 		if (!mod) {
-			mod = new_module(NOFAIL(strdup(modname)));
+			mod = new_module(modname);
 			mod->skip = 1;
 			mod->skip = 1;
 		}
 		}
 		if (is_vmlinux(modname)) {
 		if (is_vmlinux(modname)) {

+ 1 - 1
scripts/setlocalversion

@@ -21,7 +21,7 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
 
 
 	# Is this git on svn?
 	# Is this git on svn?
 	if git config --get svn-remote.svn.url >/dev/null; then
 	if git config --get svn-remote.svn.url >/dev/null; then
-	        printf -- '-svn%s' "`git-svn find-rev $head`"
+	        printf -- '-svn%s' "`git svn find-rev $head`"
 	fi
 	fi
 
 
 	# Are there uncommitted changes?
 	# Are there uncommitted changes?