diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g | |||
520 | KBUILD_AFLAGS += -gdwarf-2 | 520 | KBUILD_AFLAGS += -gdwarf-2 |
521 | endif | 521 | endif |
522 | 522 | ||
523 | # We trigger additional mismatches with less inlining | ||
524 | ifdef CONFIG_DEBUG_SECTION_MISMATCH | ||
525 | KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) | ||
526 | endif | ||
527 | |||
523 | # Force gcc to behave correct even for buggy distributions | 528 | # Force gcc to behave correct even for buggy distributions |
524 | KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) | 529 | KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) |
525 | 530 | ||
@@ -793,7 +798,7 @@ define rule_vmlinux-modpost | |||
793 | endef | 798 | endef |
794 | 799 | ||
795 | # vmlinux image - including updated kernel symbols | 800 | # vmlinux image - including updated kernel symbols |
796 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE | 801 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE |
797 | ifdef CONFIG_HEADERS_CHECK | 802 | ifdef CONFIG_HEADERS_CHECK |
798 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check | 803 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check |
799 | endif | 804 | endif |
@@ -804,7 +809,9 @@ endif | |||
804 | $(call if_changed_rule,vmlinux__) | 809 | $(call if_changed_rule,vmlinux__) |
805 | $(Q)rm -f .old_version | 810 | $(Q)rm -f .old_version |
806 | 811 | ||
807 | vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE | 812 | # build vmlinux.o first to catch section mismatch errors early |
813 | $(kallsyms.o): vmlinux.o | ||
814 | vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE | ||
808 | $(call if_changed_rule,vmlinux-modpost) | 815 | $(call if_changed_rule,vmlinux-modpost) |
809 | 816 | ||
810 | # The actual objects are generated when descending, | 817 | # The actual objects are generated when descending, |
@@ -1021,9 +1028,14 @@ ifdef CONFIG_MODULES | |||
1021 | all: modules | 1028 | all: modules |
1022 | 1029 | ||
1023 | # Build modules | 1030 | # Build modules |
1031 | # | ||
1032 | # A module can be listed more than once in obj-m resulting in | ||
1033 | # duplicate lines in modules.order files. Those are removed | ||
1034 | # using awk while concatenating to the final file. | ||
1024 | 1035 | ||
1025 | PHONY += modules | 1036 | PHONY += modules |
1026 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 1037 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) |
1038 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order | ||
1027 | @echo ' Building modules, stage 2.'; | 1039 | @echo ' Building modules, stage 2.'; |
1028 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1040 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1029 | 1041 | ||
@@ -1051,6 +1063,7 @@ _modinst_: | |||
1051 | rm -f $(MODLIB)/build ; \ | 1063 | rm -f $(MODLIB)/build ; \ |
1052 | ln -s $(objtree) $(MODLIB)/build ; \ | 1064 | ln -s $(objtree) $(MODLIB)/build ; \ |
1053 | fi | 1065 | fi |
1066 | @cp -f $(objtree)/modules.order $(MODLIB)/ | ||
1054 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst | 1067 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst |
1055 | 1068 | ||
1056 | # This depmod is only for convenience to give the initial | 1069 | # This depmod is only for convenience to give the initial |
@@ -1110,7 +1123,7 @@ clean: archclean $(clean-dirs) | |||
1110 | @find . $(RCS_FIND_IGNORE) \ | 1123 | @find . $(RCS_FIND_IGNORE) \ |
1111 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1124 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ |
1112 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1125 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
1113 | -o -name '*.symtypes' \) \ | 1126 | -o -name '*.symtypes' -o -name 'modules.order' \) \ |
1114 | -type f -print | xargs rm -f | 1127 | -type f -print | xargs rm -f |
1115 | 1128 | ||
1116 | # mrproper - Delete all generated files, including .config | 1129 | # mrproper - Delete all generated files, including .config |
@@ -1175,7 +1188,7 @@ help: | |||
1175 | @echo ' dir/ - Build all files in dir and below' | 1188 | @echo ' dir/ - Build all files in dir and below' |
1176 | @echo ' dir/file.[ois] - Build specified target only' | 1189 | @echo ' dir/file.[ois] - Build specified target only' |
1177 | @echo ' dir/file.ko - Build module including final link' | 1190 | @echo ' dir/file.ko - Build module including final link' |
1178 | @echo ' rpm - Build a kernel as an RPM package' | 1191 | @echo ' prepare - Set up for building external modules' |
1179 | @echo ' tags/TAGS - Generate tags file for editors' | 1192 | @echo ' tags/TAGS - Generate tags file for editors' |
1180 | @echo ' cscope - Generate cscope index' | 1193 | @echo ' cscope - Generate cscope index' |
1181 | @echo ' kernelrelease - Output the release version string' | 1194 | @echo ' kernelrelease - Output the release version string' |
@@ -1188,6 +1201,8 @@ help: | |||
1188 | @echo 'Static analysers' | 1201 | @echo 'Static analysers' |
1189 | @echo ' checkstack - Generate a list of stack hogs' | 1202 | @echo ' checkstack - Generate a list of stack hogs' |
1190 | @echo ' namespacecheck - Name space analysis on compiled kernel' | 1203 | @echo ' namespacecheck - Name space analysis on compiled kernel' |
1204 | @echo ' versioncheck - Sanity check on version.h usage' | ||
1205 | @echo ' includecheck - Check for duplicate included header files' | ||
1191 | @echo ' export_report - List the usages of all exported symbols' | 1206 | @echo ' export_report - List the usages of all exported symbols' |
1192 | @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ | 1207 | @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \ |
1193 | echo ' headers_check - Sanity check on exported headers'; \ | 1208 | echo ' headers_check - Sanity check on exported headers'; \ |
@@ -1371,6 +1386,7 @@ define xtags | |||
1371 | if $1 --version 2>&1 | grep -iq exuberant; then \ | 1386 | if $1 --version 2>&1 | grep -iq exuberant; then \ |
1372 | $(all-sources) | xargs $1 -a \ | 1387 | $(all-sources) | xargs $1 -a \ |
1373 | -I __initdata,__exitdata,__acquires,__releases \ | 1388 | -I __initdata,__exitdata,__acquires,__releases \ |
1389 | -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \ | ||
1374 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 1390 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
1375 | --extra=+f --c-kinds=+px \ | 1391 | --extra=+f --c-kinds=+px \ |
1376 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ | 1392 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ |
@@ -1428,12 +1444,12 @@ tags: FORCE | |||
1428 | includecheck: | 1444 | includecheck: |
1429 | find * $(RCS_FIND_IGNORE) \ | 1445 | find * $(RCS_FIND_IGNORE) \ |
1430 | -name '*.[hcS]' -type f -print | sort \ | 1446 | -name '*.[hcS]' -type f -print | sort \ |
1431 | | xargs $(PERL) -w scripts/checkincludes.pl | 1447 | | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl |
1432 | 1448 | ||
1433 | versioncheck: | 1449 | versioncheck: |
1434 | find * $(RCS_FIND_IGNORE) \ | 1450 | find * $(RCS_FIND_IGNORE) \ |
1435 | -name '*.[hcS]' -type f -print | sort \ | 1451 | -name '*.[hcS]' -type f -print | sort \ |
1436 | | xargs $(PERL) -w scripts/checkversion.pl | 1452 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl |
1437 | 1453 | ||
1438 | namespacecheck: | 1454 | namespacecheck: |
1439 | $(PERL) $(srctree)/scripts/namespace.pl | 1455 | $(PERL) $(srctree)/scripts/namespace.pl |