diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 15:06:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-25 15:06:46 -0400 |
commit | f7ce1f5e083fc099346019fb1f8d56a5452703ed (patch) | |
tree | 9d36e70d9253d87566256e779babacf697ee2774 | |
parent | dd0e101d630b0d7ed6c9e1ccf7af7fc91818330e (diff) | |
parent | 0254da07d9d51044140a904c47affaeeb8b74ae8 (diff) |
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
-rw-r--r-- | Documentation/kbuild/modules.txt | 9 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | lib/Kconfig.debug | 11 | ||||
-rw-r--r-- | scripts/Makefile.build | 6 | ||||
-rw-r--r-- | scripts/Makefile.clean | 2 | ||||
-rw-r--r-- | scripts/Makefile.host | 12 | ||||
-rw-r--r-- | scripts/Makefile.modpost | 8 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 27 |
8 files changed, 69 insertions, 15 deletions
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt index 1d247d59ad56..1821c077b435 100644 --- a/Documentation/kbuild/modules.txt +++ b/Documentation/kbuild/modules.txt | |||
@@ -486,7 +486,7 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
486 | Sometimes, an external module uses exported symbols from another | 486 | Sometimes, an external module uses exported symbols from another |
487 | external module. Kbuild needs to have full knowledge on all symbols | 487 | external module. Kbuild needs to have full knowledge on all symbols |
488 | to avoid spitting out warnings about undefined symbols. | 488 | to avoid spitting out warnings about undefined symbols. |
489 | Two solutions exist to let kbuild know all symbols of more than | 489 | Three solutions exist to let kbuild know all symbols of more than |
490 | one external module. | 490 | one external module. |
491 | The method with a top-level kbuild file is recommended but may be | 491 | The method with a top-level kbuild file is recommended but may be |
492 | impractical in certain situations. | 492 | impractical in certain situations. |
@@ -523,6 +523,13 @@ Module.symvers contains a list of all exported symbols from a kernel build. | |||
523 | containing the sum of all symbols defined and not part of the | 523 | containing the sum of all symbols defined and not part of the |
524 | kernel. | 524 | kernel. |
525 | 525 | ||
526 | Use make variable KBUILD_EXTRA_SYMBOLS in the Makefile | ||
527 | If it is impractical to copy Module.symvers from another | ||
528 | module, you can assign a space separated list of files to | ||
529 | KBUILD_EXTRA_SYMBOLS in your Makfile. These files will be | ||
530 | loaded by modpost during the initialisation of its symbol | ||
531 | tables. | ||
532 | |||
526 | === 8. Tips & Tricks | 533 | === 8. Tips & Tricks |
527 | 534 | ||
528 | --- 8.1 Testing for CONFIG_FOO_BAR | 535 | --- 8.1 Testing for CONFIG_FOO_BAR |
@@ -507,6 +507,10 @@ else | |||
507 | KBUILD_CFLAGS += -O2 | 507 | KBUILD_CFLAGS += -O2 |
508 | endif | 508 | endif |
509 | 509 | ||
510 | ifneq (CONFIG_FRAME_WARN,0) | ||
511 | KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) | ||
512 | endif | ||
513 | |||
510 | # Force gcc to behave correct even for buggy distributions | 514 | # Force gcc to behave correct even for buggy distributions |
511 | # Arch Makefiles may override this setting | 515 | # Arch Makefiles may override this setting |
512 | KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) | 516 | KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) |
@@ -1396,7 +1400,7 @@ define xtags | |||
1396 | $(all-kconfigs) | xargs $1 -a \ | 1400 | $(all-kconfigs) | xargs $1 -a \ |
1397 | --langdef=kconfig \ | 1401 | --langdef=kconfig \ |
1398 | --language-force=kconfig \ | 1402 | --language-force=kconfig \ |
1399 | --regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \ | 1403 | --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \ |
1400 | $(all-defconfigs) | xargs -r $1 -a \ | 1404 | $(all-defconfigs) | xargs -r $1 -a \ |
1401 | --langdef=dotconfig \ | 1405 | --langdef=dotconfig \ |
1402 | --language-force=dotconfig \ | 1406 | --language-force=dotconfig \ |
@@ -1404,7 +1408,7 @@ define xtags | |||
1404 | elif $1 --version 2>&1 | grep -iq emacs; then \ | 1408 | elif $1 --version 2>&1 | grep -iq emacs; then \ |
1405 | $(all-sources) | xargs $1 -a; \ | 1409 | $(all-sources) | xargs $1 -a; \ |
1406 | $(all-kconfigs) | xargs $1 -a \ | 1410 | $(all-kconfigs) | xargs $1 -a \ |
1407 | --regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ | 1411 | --regex='/^[ \t]*(menu|)config[ \t]+\([a-zA-Z0-9_]+\)/\2/'; \ |
1408 | $(all-defconfigs) | xargs -r $1 -a \ | 1412 | $(all-defconfigs) | xargs -r $1 -a \ |
1409 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | 1413 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ |
1410 | else \ | 1414 | else \ |
@@ -1539,7 +1543,6 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) | |||
1539 | cmd_rmfiles = rm -f $(rm-files) | 1543 | cmd_rmfiles = rm -f $(rm-files) |
1540 | 1544 | ||
1541 | # Run depmod only if we have System.map and depmod is executable | 1545 | # Run depmod only if we have System.map and depmod is executable |
1542 | # and we build for the host arch | ||
1543 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) | 1546 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) |
1544 | cmd_depmod = \ | 1547 | cmd_depmod = \ |
1545 | if [ -r System.map -a -x $(DEPMOD) ]; then \ | 1548 | if [ -r System.map -a -x $(DEPMOD) ]; then \ |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 623ef24c2381..754cc0027f2a 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -25,6 +25,17 @@ config ENABLE_MUST_CHECK | |||
25 | suppress the "warning: ignoring return value of 'foo', declared with | 25 | suppress the "warning: ignoring return value of 'foo', declared with |
26 | attribute warn_unused_result" messages. | 26 | attribute warn_unused_result" messages. |
27 | 27 | ||
28 | config FRAME_WARN | ||
29 | int "Warn for stack frames larger than (needs gcc 4.4)" | ||
30 | range 0 8192 | ||
31 | default 1024 if !64BIT | ||
32 | default 2048 if 64BIT | ||
33 | help | ||
34 | Tell gcc to warn at build time for stack frames larger than this. | ||
35 | Setting this too low will cause a lot of warnings. | ||
36 | Setting it to 0 disables the warning. | ||
37 | Requires gcc 4.4 | ||
38 | |||
28 | config MAGIC_SYSRQ | 39 | config MAGIC_SYSRQ |
29 | bool "Magic SysRq key" | 40 | bool "Magic SysRq key" |
30 | depends on !UML | 41 | depends on !UML |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 67fb4530a6ff..277cfe0b7100 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -27,12 +27,12 @@ ccflags-y := | |||
27 | cppflags-y := | 27 | cppflags-y := |
28 | ldflags-y := | 28 | ldflags-y := |
29 | 29 | ||
30 | # Read .config if it exist, otherwise ignore | 30 | # Read auto.conf if it exists, otherwise ignore |
31 | -include include/config/auto.conf | 31 | -include include/config/auto.conf |
32 | 32 | ||
33 | include scripts/Kbuild.include | 33 | include scripts/Kbuild.include |
34 | 34 | ||
35 | # For backward compatibility check that these variables does not change | 35 | # For backward compatibility check that these variables do not change |
36 | save-cflags := $(CFLAGS) | 36 | save-cflags := $(CFLAGS) |
37 | 37 | ||
38 | # The filename Kbuild has precedence over Makefile | 38 | # The filename Kbuild has precedence over Makefile |
@@ -55,7 +55,7 @@ hostprogs-y += $(host-progs) | |||
55 | endif | 55 | endif |
56 | endif | 56 | endif |
57 | 57 | ||
58 | # Do not include host rules unles needed | 58 | # Do not include host rules unless needed |
59 | ifneq ($(hostprogs-y)$(hostprogs-m),) | 59 | ifneq ($(hostprogs-y)$(hostprogs-m),) |
60 | include scripts/Makefile.host | 60 | include scripts/Makefile.host |
61 | endif | 61 | endif |
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 2c647107c9cc..6f89fbb56256 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean | |||
@@ -37,7 +37,7 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) | |||
37 | 37 | ||
38 | subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) | 38 | subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) |
39 | 39 | ||
40 | # build a list of files to remove, usually releative to the current | 40 | # build a list of files to remove, usually relative to the current |
41 | # directory | 41 | # directory |
42 | 42 | ||
43 | __clean-files := $(extra-y) $(always) \ | 43 | __clean-files := $(extra-y) $(always) \ |
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 6943a7a5bb98..1ac414fd5030 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
@@ -3,9 +3,9 @@ | |||
3 | # Binaries are used during the compilation of the kernel, for example | 3 | # Binaries are used during the compilation of the kernel, for example |
4 | # to preprocess a data file. | 4 | # to preprocess a data file. |
5 | # | 5 | # |
6 | # Both C and C++ is supported, but preferred language is C for such utilities. | 6 | # Both C and C++ are supported, but preferred language is C for such utilities. |
7 | # | 7 | # |
8 | # Samle syntax (see Documentation/kbuild/makefile.txt for reference) | 8 | # Sample syntax (see Documentation/kbuild/makefiles.txt for reference) |
9 | # hostprogs-y := bin2hex | 9 | # hostprogs-y := bin2hex |
10 | # Will compile bin2hex.c and create an executable named bin2hex | 10 | # Will compile bin2hex.c and create an executable named bin2hex |
11 | # | 11 | # |
@@ -23,10 +23,10 @@ | |||
23 | # hostprogs-y := conf | 23 | # hostprogs-y := conf |
24 | # conf-objs := conf.o libkconfig.so | 24 | # conf-objs := conf.o libkconfig.so |
25 | # libkconfig-objs := expr.o type.o | 25 | # libkconfig-objs := expr.o type.o |
26 | # Will create a shared library named libkconfig.so that consist of | 26 | # Will create a shared library named libkconfig.so that consists of |
27 | # expr.o and type.o (they are both compiled as C code and the object file | 27 | # expr.o and type.o (they are both compiled as C code and the object files |
28 | # are made as position independent code). | 28 | # are made as position independent code). |
29 | # conf.c is compiled as a c program, and conf.o is linked together with | 29 | # conf.c is compiled as a C program, and conf.o is linked together with |
30 | # libkconfig.so as the executable conf. | 30 | # libkconfig.so as the executable conf. |
31 | # Note: Shared libraries consisting of C++ files are not supported | 31 | # Note: Shared libraries consisting of C++ files are not supported |
32 | 32 | ||
@@ -61,7 +61,7 @@ host-cobjs := $(filter-out %.so,$(host-cobjs)) | |||
61 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) | 61 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) |
62 | 62 | ||
63 | # output directory for programs/.o files | 63 | # output directory for programs/.o files |
64 | # hostprogs-y := tools/build may have been specified. Retreive directory | 64 | # hostprogs-y := tools/build may have been specified. Retrieve directory |
65 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) | 65 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) |
66 | # directory of .o files from prog-objs notation | 66 | # directory of .o files from prog-objs notation |
67 | host-objdirs += $(foreach f,$(host-cmulti), \ | 67 | host-objdirs += $(foreach f,$(host-cmulti), \ |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 2d20640854b7..24b3c8fe6bca 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -42,6 +42,13 @@ _modpost: __modpost | |||
42 | 42 | ||
43 | include include/config/auto.conf | 43 | include include/config/auto.conf |
44 | include scripts/Kbuild.include | 44 | include scripts/Kbuild.include |
45 | |||
46 | ifneq ($(KBUILD_EXTMOD),) | ||
47 | # Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS | ||
48 | include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \ | ||
49 | $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile) | ||
50 | endif | ||
51 | |||
45 | include scripts/Makefile.lib | 52 | include scripts/Makefile.lib |
46 | 53 | ||
47 | kernelsymfile := $(objtree)/Module.symvers | 54 | kernelsymfile := $(objtree)/Module.symvers |
@@ -69,6 +76,7 @@ modpost = scripts/mod/modpost \ | |||
69 | $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ | 76 | $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ |
70 | $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ | 77 | $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ |
71 | $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ | 78 | $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ |
79 | $(if $(iKBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(EXTRA_SYMBOLS))) \ | ||
72 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ | 80 | $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ |
73 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 81 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
74 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ | 82 | $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 110cf243fa4e..f8b42ab0724b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -1552,6 +1552,10 @@ static void read_symbols(char *modname) | |||
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | license = get_modinfo(info.modinfo, info.modinfo_len, "license"); | 1554 | license = get_modinfo(info.modinfo, info.modinfo_len, "license"); |
1555 | if (!license && !is_vmlinux(modname)) | ||
1556 | fatal("modpost: missing MODULE_LICENSE() in %s\n" | ||
1557 | "see include/linux/module.h for " | ||
1558 | "more information\n", modname); | ||
1555 | while (license) { | 1559 | while (license) { |
1556 | if (license_is_gpl_compatible(license)) | 1560 | if (license_is_gpl_compatible(license)) |
1557 | mod->gpl_compatible = 1; | 1561 | mod->gpl_compatible = 1; |
@@ -2015,6 +2019,11 @@ static void write_markers(const char *fname) | |||
2015 | write_if_changed(&buf, fname); | 2019 | write_if_changed(&buf, fname); |
2016 | } | 2020 | } |
2017 | 2021 | ||
2022 | struct ext_sym_list { | ||
2023 | struct ext_sym_list *next; | ||
2024 | const char *file; | ||
2025 | }; | ||
2026 | |||
2018 | int main(int argc, char **argv) | 2027 | int main(int argc, char **argv) |
2019 | { | 2028 | { |
2020 | struct module *mod; | 2029 | struct module *mod; |
@@ -2025,8 +2034,10 @@ int main(int argc, char **argv) | |||
2025 | char *markers_write = NULL; | 2034 | char *markers_write = NULL; |
2026 | int opt; | 2035 | int opt; |
2027 | int err; | 2036 | int err; |
2037 | struct ext_sym_list *extsym_iter; | ||
2038 | struct ext_sym_list *extsym_start = NULL; | ||
2028 | 2039 | ||
2029 | while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) { | 2040 | while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) { |
2030 | switch (opt) { | 2041 | switch (opt) { |
2031 | case 'i': | 2042 | case 'i': |
2032 | kernel_read = optarg; | 2043 | kernel_read = optarg; |
@@ -2038,6 +2049,14 @@ int main(int argc, char **argv) | |||
2038 | case 'c': | 2049 | case 'c': |
2039 | cross_build = 1; | 2050 | cross_build = 1; |
2040 | break; | 2051 | break; |
2052 | case 'e': | ||
2053 | external_module = 1; | ||
2054 | extsym_iter = | ||
2055 | NOFAIL(malloc(sizeof(*extsym_iter))); | ||
2056 | extsym_iter->next = extsym_start; | ||
2057 | extsym_iter->file = optarg; | ||
2058 | extsym_start = extsym_iter; | ||
2059 | break; | ||
2041 | case 'm': | 2060 | case 'm': |
2042 | modversions = 1; | 2061 | modversions = 1; |
2043 | break; | 2062 | break; |
@@ -2071,6 +2090,12 @@ int main(int argc, char **argv) | |||
2071 | read_dump(kernel_read, 1); | 2090 | read_dump(kernel_read, 1); |
2072 | if (module_read) | 2091 | if (module_read) |
2073 | read_dump(module_read, 0); | 2092 | read_dump(module_read, 0); |
2093 | while (extsym_start) { | ||
2094 | read_dump(extsym_start->file, 0); | ||
2095 | extsym_iter = extsym_start->next; | ||
2096 | free(extsym_start); | ||
2097 | extsym_start = extsym_iter; | ||
2098 | } | ||
2074 | 2099 | ||
2075 | while (optind < argc) | 2100 | while (optind < argc) |
2076 | read_symbols(argv[optind++]); | 2101 | read_symbols(argv[optind++]); |