提交 f7ce1f5e 编写于 作者: L Linus Torvalds

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

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
  kbuild: fix depmod comment
  kbuild: Add new Kbuild variable KBUILD_EXTRA_SYMBOLS
  kbuild: support loading extra symbols in modpost
  Add option to enable -Wframe-larger-than= on gcc 4.4
  kbuild: add kconfig symbols to tags output
  kbuild: fix some minor typoes
  kbuild: error out on missing MODULE_LICENSE
...@@ -486,7 +486,7 @@ Module.symvers contains a list of all exported symbols from a kernel build. ...@@ -486,7 +486,7 @@ Module.symvers contains a list of all exported symbols from a kernel build.
Sometimes, an external module uses exported symbols from another Sometimes, an external module uses exported symbols from another
external module. Kbuild needs to have full knowledge on all symbols external module. Kbuild needs to have full knowledge on all symbols
to avoid spitting out warnings about undefined symbols. to avoid spitting out warnings about undefined symbols.
Two solutions exist to let kbuild know all symbols of more than Three solutions exist to let kbuild know all symbols of more than
one external module. one external module.
The method with a top-level kbuild file is recommended but may be The method with a top-level kbuild file is recommended but may be
impractical in certain situations. impractical in certain situations.
...@@ -523,6 +523,13 @@ Module.symvers contains a list of all exported symbols from a kernel build. ...@@ -523,6 +523,13 @@ Module.symvers contains a list of all exported symbols from a kernel build.
containing the sum of all symbols defined and not part of the containing the sum of all symbols defined and not part of the
kernel. kernel.
Use make variable KBUILD_EXTRA_SYMBOLS in the Makefile
If it is impractical to copy Module.symvers from another
module, you can assign a space separated list of files to
KBUILD_EXTRA_SYMBOLS in your Makfile. These files will be
loaded by modpost during the initialisation of its symbol
tables.
=== 8. Tips & Tricks === 8. Tips & Tricks
--- 8.1 Testing for CONFIG_FOO_BAR --- 8.1 Testing for CONFIG_FOO_BAR
......
...@@ -507,6 +507,10 @@ else ...@@ -507,6 +507,10 @@ else
KBUILD_CFLAGS += -O2 KBUILD_CFLAGS += -O2
endif endif
ifneq (CONFIG_FRAME_WARN,0)
KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
endif
# Force gcc to behave correct even for buggy distributions # Force gcc to behave correct even for buggy distributions
# Arch Makefiles may override this setting # Arch Makefiles may override this setting
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
...@@ -1396,7 +1400,7 @@ define xtags ...@@ -1396,7 +1400,7 @@ define xtags
$(all-kconfigs) | xargs $1 -a \ $(all-kconfigs) | xargs $1 -a \
--langdef=kconfig \ --langdef=kconfig \
--language-force=kconfig \ --language-force=kconfig \
--regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \ --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \
$(all-defconfigs) | xargs -r $1 -a \ $(all-defconfigs) | xargs -r $1 -a \
--langdef=dotconfig \ --langdef=dotconfig \
--language-force=dotconfig \ --language-force=dotconfig \
...@@ -1404,7 +1408,7 @@ define xtags ...@@ -1404,7 +1408,7 @@ define xtags
elif $1 --version 2>&1 | grep -iq emacs; then \ elif $1 --version 2>&1 | grep -iq emacs; then \
$(all-sources) | xargs $1 -a; \ $(all-sources) | xargs $1 -a; \
$(all-kconfigs) | xargs $1 -a \ $(all-kconfigs) | xargs $1 -a \
--regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ --regex='/^[ \t]*(menu|)config[ \t]+\([a-zA-Z0-9_]+\)/\2/'; \
$(all-defconfigs) | xargs -r $1 -a \ $(all-defconfigs) | xargs -r $1 -a \
--regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
else \ else \
...@@ -1539,7 +1543,6 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) ...@@ -1539,7 +1543,6 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))
cmd_rmfiles = rm -f $(rm-files) cmd_rmfiles = rm -f $(rm-files)
# Run depmod only if we have System.map and depmod is executable # Run depmod only if we have System.map and depmod is executable
# and we build for the host arch
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = \ cmd_depmod = \
if [ -r System.map -a -x $(DEPMOD) ]; then \ if [ -r System.map -a -x $(DEPMOD) ]; then \
......
...@@ -25,6 +25,17 @@ config ENABLE_MUST_CHECK ...@@ -25,6 +25,17 @@ config ENABLE_MUST_CHECK
suppress the "warning: ignoring return value of 'foo', declared with suppress the "warning: ignoring return value of 'foo', declared with
attribute warn_unused_result" messages. attribute warn_unused_result" messages.
config FRAME_WARN
int "Warn for stack frames larger than (needs gcc 4.4)"
range 0 8192
default 1024 if !64BIT
default 2048 if 64BIT
help
Tell gcc to warn at build time for stack frames larger than this.
Setting this too low will cause a lot of warnings.
Setting it to 0 disables the warning.
Requires gcc 4.4
config MAGIC_SYSRQ config MAGIC_SYSRQ
bool "Magic SysRq key" bool "Magic SysRq key"
depends on !UML depends on !UML
......
...@@ -27,12 +27,12 @@ ccflags-y := ...@@ -27,12 +27,12 @@ ccflags-y :=
cppflags-y := cppflags-y :=
ldflags-y := ldflags-y :=
# Read .config if it exist, otherwise ignore # Read auto.conf if it exists, otherwise ignore
-include include/config/auto.conf -include include/config/auto.conf
include scripts/Kbuild.include include scripts/Kbuild.include
# For backward compatibility check that these variables does not change # For backward compatibility check that these variables do not change
save-cflags := $(CFLAGS) save-cflags := $(CFLAGS)
# The filename Kbuild has precedence over Makefile # The filename Kbuild has precedence over Makefile
...@@ -55,7 +55,7 @@ hostprogs-y += $(host-progs) ...@@ -55,7 +55,7 @@ hostprogs-y += $(host-progs)
endif endif
endif endif
# Do not include host rules unles needed # Do not include host rules unless needed
ifneq ($(hostprogs-y)$(hostprogs-m),) ifneq ($(hostprogs-y)$(hostprogs-m),)
include scripts/Makefile.host include scripts/Makefile.host
endif endif
......
...@@ -37,7 +37,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) ...@@ -37,7 +37,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
# build a list of files to remove, usually releative to the current # build a list of files to remove, usually relative to the current
# directory # directory
__clean-files := $(extra-y) $(always) \ __clean-files := $(extra-y) $(always) \
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
# Binaries are used during the compilation of the kernel, for example # Binaries are used during the compilation of the kernel, for example
# to preprocess a data file. # to preprocess a data file.
# #
# Both C and C++ is supported, but preferred language is C for such utilities. # Both C and C++ are supported, but preferred language is C for such utilities.
# #
# Samle syntax (see Documentation/kbuild/makefile.txt for reference) # Sample syntax (see Documentation/kbuild/makefiles.txt for reference)
# hostprogs-y := bin2hex # hostprogs-y := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex # Will compile bin2hex.c and create an executable named bin2hex
# #
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
# hostprogs-y := conf # hostprogs-y := conf
# conf-objs := conf.o libkconfig.so # conf-objs := conf.o libkconfig.so
# libkconfig-objs := expr.o type.o # libkconfig-objs := expr.o type.o
# Will create a shared library named libkconfig.so that consist of # Will create a shared library named libkconfig.so that consists of
# expr.o and type.o (they are both compiled as C code and the object file # expr.o and type.o (they are both compiled as C code and the object files
# are made as position independent code). # are made as position independent code).
# conf.c is compiled as a c program, and conf.o is linked together with # conf.c is compiled as a C program, and conf.o is linked together with
# libkconfig.so as the executable conf. # libkconfig.so as the executable conf.
# Note: Shared libraries consisting of C++ files are not supported # Note: Shared libraries consisting of C++ files are not supported
...@@ -61,7 +61,7 @@ host-cobjs := $(filter-out %.so,$(host-cobjs)) ...@@ -61,7 +61,7 @@ host-cobjs := $(filter-out %.so,$(host-cobjs))
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
# output directory for programs/.o files # output directory for programs/.o files
# hostprogs-y := tools/build may have been specified. Retreive directory # hostprogs-y := tools/build may have been specified. Retrieve directory
host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
# directory of .o files from prog-objs notation # directory of .o files from prog-objs notation
host-objdirs += $(foreach f,$(host-cmulti), \ host-objdirs += $(foreach f,$(host-cmulti), \
......
...@@ -42,6 +42,13 @@ _modpost: __modpost ...@@ -42,6 +42,13 @@ _modpost: __modpost
include include/config/auto.conf include include/config/auto.conf
include scripts/Kbuild.include include scripts/Kbuild.include
ifneq ($(KBUILD_EXTMOD),)
# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
$(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
endif
include scripts/Makefile.lib include scripts/Makefile.lib
kernelsymfile := $(objtree)/Module.symvers kernelsymfile := $(objtree)/Module.symvers
...@@ -69,6 +76,7 @@ modpost = scripts/mod/modpost \ ...@@ -69,6 +76,7 @@ modpost = scripts/mod/modpost \
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(iKBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
......
...@@ -1552,6 +1552,10 @@ static void read_symbols(char *modname) ...@@ -1552,6 +1552,10 @@ static void read_symbols(char *modname)
} }
license = get_modinfo(info.modinfo, info.modinfo_len, "license"); license = get_modinfo(info.modinfo, info.modinfo_len, "license");
if (!license && !is_vmlinux(modname))
fatal("modpost: missing MODULE_LICENSE() in %s\n"
"see include/linux/module.h for "
"more information\n", modname);
while (license) { while (license) {
if (license_is_gpl_compatible(license)) if (license_is_gpl_compatible(license))
mod->gpl_compatible = 1; mod->gpl_compatible = 1;
...@@ -2015,6 +2019,11 @@ static void write_markers(const char *fname) ...@@ -2015,6 +2019,11 @@ static void write_markers(const char *fname)
write_if_changed(&buf, fname); write_if_changed(&buf, fname);
} }
struct ext_sym_list {
struct ext_sym_list *next;
const char *file;
};
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct module *mod; struct module *mod;
...@@ -2025,8 +2034,10 @@ int main(int argc, char **argv) ...@@ -2025,8 +2034,10 @@ int main(int argc, char **argv)
char *markers_write = NULL; char *markers_write = NULL;
int opt; int opt;
int err; int err;
struct ext_sym_list *extsym_iter;
struct ext_sym_list *extsym_start = NULL;
while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) { while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) {
switch (opt) { switch (opt) {
case 'i': case 'i':
kernel_read = optarg; kernel_read = optarg;
...@@ -2038,6 +2049,14 @@ int main(int argc, char **argv) ...@@ -2038,6 +2049,14 @@ int main(int argc, char **argv)
case 'c': case 'c':
cross_build = 1; cross_build = 1;
break; break;
case 'e':
external_module = 1;
extsym_iter =
NOFAIL(malloc(sizeof(*extsym_iter)));
extsym_iter->next = extsym_start;
extsym_iter->file = optarg;
extsym_start = extsym_iter;
break;
case 'm': case 'm':
modversions = 1; modversions = 1;
break; break;
...@@ -2071,6 +2090,12 @@ int main(int argc, char **argv) ...@@ -2071,6 +2090,12 @@ int main(int argc, char **argv)
read_dump(kernel_read, 1); read_dump(kernel_read, 1);
if (module_read) if (module_read)
read_dump(module_read, 0); read_dump(module_read, 0);
while (extsym_start) {
read_dump(extsym_start->file, 0);
extsym_iter = extsym_start->next;
free(extsym_start);
extsym_start = extsym_iter;
}
while (optind < argc) while (optind < argc)
read_symbols(argv[optind++]); read_symbols(argv[optind++]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册