aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 22 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6d419f67939c..0f84c742ed0e 100644
--- a/Makefile
+++ b/Makefile
@@ -520,6 +520,11 @@ KBUILD_CFLAGS += -g
520KBUILD_AFLAGS += -gdwarf-2 520KBUILD_AFLAGS += -gdwarf-2
521endif 521endif
522 522
523# We trigger additional mismatches with less inlining
524ifdef CONFIG_DEBUG_SECTION_MISMATCH
525KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
526endif
527
523# Force gcc to behave correct even for buggy distributions 528# Force gcc to behave correct even for buggy distributions
524KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) 529KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
525 530
@@ -793,7 +798,7 @@ define rule_vmlinux-modpost
793endef 798endef
794 799
795# vmlinux image - including updated kernel symbols 800# vmlinux image - including updated kernel symbols
796vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE 801vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
797ifdef CONFIG_HEADERS_CHECK 802ifdef CONFIG_HEADERS_CHECK
798 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 803 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
799endif 804endif
@@ -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
807vmlinux.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
814vmlinux.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
1021all: modules 1028all: 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
1025PHONY += modules 1036PHONY += modules
1026modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) 1037modules: $(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
1428includecheck: 1444includecheck:
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
1433versioncheck: 1449versioncheck:
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
1438namespacecheck: 1454namespacecheck:
1439 $(PERL) $(srctree)/scripts/namespace.pl 1455 $(PERL) $(srctree)/scripts/namespace.pl