diff options
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 14 | ||||
-rw-r--r-- | Makefile | 207 | ||||
-rw-r--r-- | arch/blackfin/boot/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/scripts/strip-symbols | 1 | ||||
-rw-r--r-- | init/Kconfig | 7 | ||||
-rw-r--r-- | kernel/kallsyms.c | 16 | ||||
-rw-r--r-- | scripts/Kbuild.include | 22 | ||||
-rw-r--r-- | scripts/Makefile.build | 67 | ||||
-rw-r--r-- | scripts/Makefile.lib | 15 | ||||
-rw-r--r-- | scripts/Makefile.modinst | 3 | ||||
-rwxr-xr-x | scripts/decodecode | 32 | ||||
-rwxr-xr-x | scripts/extract-ikconfig | 8 | ||||
-rw-r--r-- | scripts/genksyms/genksyms.c | 277 | ||||
-rw-r--r-- | scripts/genksyms/genksyms.h | 7 | ||||
-rw-r--r-- | scripts/genksyms/keywords.c_shipped | 189 | ||||
-rw-r--r-- | scripts/genksyms/keywords.gperf | 2 | ||||
-rwxr-xr-x | scripts/headerdep.pl | 193 | ||||
-rw-r--r-- | scripts/kallsyms.c | 21 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/check-lxdialog.sh | 2 | ||||
-rwxr-xr-x | scripts/kernel-doc | 67 | ||||
-rwxr-xr-x | scripts/mkcompile_h | 6 | ||||
-rw-r--r-- | scripts/mkmakefile | 4 | ||||
-rw-r--r-- | scripts/mksysmap | 7 | ||||
-rw-r--r-- | scripts/package/Makefile | 9 | ||||
-rwxr-xr-x | scripts/setlocalversion | 7 | ||||
-rw-r--r-- | scripts/strip-symbols | 22 | ||||
-rwxr-xr-x | scripts/tags.sh | 160 | ||||
-rw-r--r-- | usr/gen_init_cpio.c | 28 |
28 files changed, 1045 insertions, 350 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 7a7753321a26..51104f9194a5 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -383,6 +383,20 @@ more details, with real examples. | |||
383 | to prerequisites are referenced with $(src) (because they are not | 383 | to prerequisites are referenced with $(src) (because they are not |
384 | generated files). | 384 | generated files). |
385 | 385 | ||
386 | $(kecho) | ||
387 | echoing information to user in a rule is often a good practice | ||
388 | but when execution "make -s" one does not expect to see any output | ||
389 | except for warnings/errors. | ||
390 | To support this kbuild define $(kecho) which will echo out the | ||
391 | text following $(kecho) to stdout except if "make -s" is used. | ||
392 | |||
393 | Example: | ||
394 | #arch/blackfin/boot/Makefile | ||
395 | $(obj)/vmImage: $(obj)/vmlinux.gz | ||
396 | $(call if_changed,uimage) | ||
397 | @$(kecho) 'Kernel: $@ is ready' | ||
398 | |||
399 | |||
386 | --- 3.11 $(CC) support functions | 400 | --- 3.11 $(CC) support functions |
387 | 401 | ||
388 | The kernel may be built with several different versions of | 402 | The kernel may be built with several different versions of |
@@ -336,7 +336,7 @@ LINUXINCLUDE := -Iinclude \ | |||
336 | -I$(srctree)/arch/$(hdr-arch)/include \ | 336 | -I$(srctree)/arch/$(hdr-arch)/include \ |
337 | -include include/linux/autoconf.h | 337 | -include include/linux/autoconf.h |
338 | 338 | ||
339 | KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 339 | KBUILD_CPPFLAGS := -D__KERNEL__ |
340 | 340 | ||
341 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 341 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
342 | -fno-strict-aliasing -fno-common \ | 342 | -fno-strict-aliasing -fno-common \ |
@@ -439,7 +439,11 @@ ifeq ($(config-targets),1) | |||
439 | include $(srctree)/arch/$(SRCARCH)/Makefile | 439 | include $(srctree)/arch/$(SRCARCH)/Makefile |
440 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 440 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
441 | 441 | ||
442 | config %config: scripts_basic outputmakefile FORCE | 442 | config: scripts_basic outputmakefile FORCE |
443 | $(Q)mkdir -p include/linux include/config | ||
444 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | ||
445 | |||
446 | %config: scripts_basic outputmakefile FORCE | ||
443 | $(Q)mkdir -p include/linux include/config | 447 | $(Q)mkdir -p include/linux include/config |
444 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 448 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
445 | 449 | ||
@@ -600,20 +604,25 @@ export INSTALL_PATH ?= /boot | |||
600 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) | 604 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) |
601 | export MODLIB | 605 | export MODLIB |
602 | 606 | ||
603 | # | 607 | strip-symbols := $(srctree)/scripts/strip-symbols \ |
604 | # INSTALL_MOD_STRIP, if defined, will cause modules to be | 608 | $(wildcard $(srctree)/arch/$(ARCH)/scripts/strip-symbols) |
605 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then | ||
606 | # the default option --strip-debug will be used. Otherwise, | ||
607 | # INSTALL_MOD_STRIP will used as the options to the strip command. | ||
608 | 609 | ||
610 | # | ||
611 | # INSTALL_MOD_STRIP, if defined, will cause modules to be stripped while | ||
612 | # they get installed. If INSTALL_MOD_STRIP is '1', then the default | ||
613 | # options (see below) will be used. Otherwise, INSTALL_MOD_STRIP will | ||
614 | # be used as the option(s) to the objcopy command. | ||
609 | ifdef INSTALL_MOD_STRIP | 615 | ifdef INSTALL_MOD_STRIP |
610 | ifeq ($(INSTALL_MOD_STRIP),1) | 616 | ifeq ($(INSTALL_MOD_STRIP),1) |
611 | mod_strip_cmd = $(STRIP) --strip-debug | 617 | mod_strip_cmd = $(OBJCOPY) --strip-debug |
618 | ifeq ($(CONFIG_KALLSYMS_ALL),$(CONFIG_KALLSYMS_STRIP_GENERATED)) | ||
619 | mod_strip_cmd += --wildcard $(addprefix --strip-symbols ,$(strip-symbols)) | ||
620 | endif | ||
612 | else | 621 | else |
613 | mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) | 622 | mod_strip_cmd = $(OBJCOPY) $(INSTALL_MOD_STRIP) |
614 | endif # INSTALL_MOD_STRIP=1 | 623 | endif # INSTALL_MOD_STRIP=1 |
615 | else | 624 | else |
616 | mod_strip_cmd = true | 625 | mod_strip_cmd = false |
617 | endif # INSTALL_MOD_STRIP | 626 | endif # INSTALL_MOD_STRIP |
618 | export mod_strip_cmd | 627 | export mod_strip_cmd |
619 | 628 | ||
@@ -743,6 +752,7 @@ last_kallsyms := 2 | |||
743 | endif | 752 | endif |
744 | 753 | ||
745 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o | 754 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o |
755 | kallsyms.h := $(wildcard include/config/kallsyms/*.h) $(wildcard include/config/kallsyms/*/*.h) | ||
746 | 756 | ||
747 | define verify_kallsyms | 757 | define verify_kallsyms |
748 | $(Q)$(if $($(quiet)cmd_sysmap), \ | 758 | $(Q)$(if $($(quiet)cmd_sysmap), \ |
@@ -767,24 +777,41 @@ endef | |||
767 | 777 | ||
768 | # Generate .S file with all kernel symbols | 778 | # Generate .S file with all kernel symbols |
769 | quiet_cmd_kallsyms = KSYM $@ | 779 | quiet_cmd_kallsyms = KSYM $@ |
770 | cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ | 780 | cmd_kallsyms = { test $* -eq 0 || $(NM) -n $<; } \ |
771 | $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ | 781 | | $(KALLSYMS) $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) >$@ |
772 | 782 | ||
773 | .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE | 783 | quiet_cmd_kstrip = STRIP $@ |
784 | cmd_kstrip = $(OBJCOPY) --wildcard $(addprefix --strip$(if $(CONFIG_RELOCATABLE),-unneeded)-symbols ,$(filter %/scripts/strip-symbols,$^)) $< $@ | ||
785 | |||
786 | $(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): KBUILD_AFLAGS += -Wa,--strip-local-absolute | ||
787 | $(foreach n,0 1 2 3,.tmp_kallsyms$(n).o): %.o: %.S scripts FORCE | ||
774 | $(call if_changed_dep,as_o_S) | 788 | $(call if_changed_dep,as_o_S) |
775 | 789 | ||
776 | .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) | 790 | ifeq ($(CONFIG_KALLSYMS_STRIP_GENERATED),y) |
791 | strip-ext := .stripped | ||
792 | endif | ||
793 | |||
794 | .tmp_kallsyms%.S: .tmp_vmlinux%$(strip-ext) $(KALLSYMS) $(kallsyms.h) | ||
777 | $(call cmd,kallsyms) | 795 | $(call cmd,kallsyms) |
778 | 796 | ||
797 | # make -jN seems to have problems with intermediate files, see bug #3330. | ||
798 | .SECONDARY: $(foreach n,1 2 3,.tmp_vmlinux$(n).stripped) | ||
799 | .tmp_vmlinux%.stripped: .tmp_vmlinux% $(strip-symbols) $(kallsyms.h) | ||
800 | $(call cmd,kstrip) | ||
801 | |||
802 | ifneq ($(CONFIG_DEBUG_INFO),y) | ||
803 | .tmp_vmlinux%: LDFLAGS_vmlinux += -S | ||
804 | endif | ||
779 | # .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version | 805 | # .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version |
780 | .tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE | 806 | .tmp_vmlinux%: $(vmlinux-lds) $(vmlinux-all) FORCE |
781 | $(call if_changed_rule,ksym_ld) | 807 | $(if $(filter 1,$*),$(call if_changed_rule,ksym_ld),$(call if_changed,vmlinux__)) |
782 | 808 | ||
783 | .tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE | 809 | .tmp_vmlinux0$(strip-ext): |
784 | $(call if_changed,vmlinux__) | 810 | $(Q)echo "placeholder" >$@ |
785 | 811 | ||
786 | .tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE | 812 | .tmp_vmlinux1: .tmp_kallsyms0.o |
787 | $(call if_changed,vmlinux__) | 813 | .tmp_vmlinux2: .tmp_kallsyms1.o |
814 | .tmp_vmlinux3: .tmp_kallsyms2.o | ||
788 | 815 | ||
789 | # Needs to visit scripts/ before $(KALLSYMS) can be used. | 816 | # Needs to visit scripts/ before $(KALLSYMS) can be used. |
790 | $(KALLSYMS): scripts ; | 817 | $(KALLSYMS): scripts ; |
@@ -926,7 +953,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | |||
926 | # 2) Create the include2 directory, used for the second asm symlink | 953 | # 2) Create the include2 directory, used for the second asm symlink |
927 | prepare3: include/config/kernel.release | 954 | prepare3: include/config/kernel.release |
928 | ifneq ($(KBUILD_SRC),) | 955 | ifneq ($(KBUILD_SRC),) |
929 | @echo ' Using $(srctree) as source for kernel' | 956 | @$(kecho) ' Using $(srctree) as source for kernel' |
930 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ | 957 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ |
931 | echo " $(srctree) is not clean, please run 'make mrproper'";\ | 958 | echo " $(srctree) is not clean, please run 'make mrproper'";\ |
932 | echo " in the '$(srctree)' directory.";\ | 959 | echo " in the '$(srctree)' directory.";\ |
@@ -983,7 +1010,7 @@ endef | |||
983 | # directory for generated filesas used by some architectures. | 1010 | # directory for generated filesas used by some architectures. |
984 | define create-symlink | 1011 | define create-symlink |
985 | if [ ! -L include/asm ]; then \ | 1012 | if [ ! -L include/asm ]; then \ |
986 | echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ | 1013 | $(kecho) ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ |
987 | if [ ! -d include/asm-$(SRCARCH) ]; then \ | 1014 | if [ ! -d include/asm-$(SRCARCH) ]; then \ |
988 | mkdir -p include/asm-$(SRCARCH); \ | 1015 | mkdir -p include/asm-$(SRCARCH); \ |
989 | fi; \ | 1016 | fi; \ |
@@ -1022,6 +1049,10 @@ include/linux/version.h: $(srctree)/Makefile FORCE | |||
1022 | include/linux/utsrelease.h: include/config/kernel.release FORCE | 1049 | include/linux/utsrelease.h: include/config/kernel.release FORCE |
1023 | $(call filechk,utsrelease.h) | 1050 | $(call filechk,utsrelease.h) |
1024 | 1051 | ||
1052 | PHONY += headerdep | ||
1053 | headerdep: | ||
1054 | $(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl | ||
1055 | |||
1025 | # --------------------------------------------------------------------------- | 1056 | # --------------------------------------------------------------------------- |
1026 | 1057 | ||
1027 | PHONY += depend dep | 1058 | PHONY += depend dep |
@@ -1096,7 +1127,7 @@ all: modules | |||
1096 | PHONY += modules | 1127 | PHONY += modules |
1097 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) | 1128 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) |
1098 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order | 1129 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order |
1099 | @echo ' Building modules, stage 2.'; | 1130 | @$(kecho) ' Building modules, stage 2.'; |
1100 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1131 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1101 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild | 1132 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild |
1102 | 1133 | ||
@@ -1270,7 +1301,8 @@ help: | |||
1270 | @echo ' versioncheck - Sanity check on version.h usage' | 1301 | @echo ' versioncheck - Sanity check on version.h usage' |
1271 | @echo ' includecheck - Check for duplicate included header files' | 1302 | @echo ' includecheck - Check for duplicate included header files' |
1272 | @echo ' export_report - List the usages of all exported symbols' | 1303 | @echo ' export_report - List the usages of all exported symbols' |
1273 | @echo ' headers_check - Sanity check on exported headers'; \ | 1304 | @echo ' headers_check - Sanity check on exported headers' |
1305 | @echo ' headerdep - Detect inclusion cycles in headers'; \ | ||
1274 | echo '' | 1306 | echo '' |
1275 | @echo 'Kernel packaging:' | 1307 | @echo 'Kernel packaging:' |
1276 | @$(MAKE) $(build)=$(package-dir) help | 1308 | @$(MAKE) $(build)=$(package-dir) help |
@@ -1360,7 +1392,7 @@ $(module-dirs): crmodverdir $(objtree)/Module.symvers | |||
1360 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) | 1392 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) |
1361 | 1393 | ||
1362 | modules: $(module-dirs) | 1394 | modules: $(module-dirs) |
1363 | @echo ' Building modules, stage 2.'; | 1395 | @$(kecho) ' Building modules, stage 2.'; |
1364 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1396 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1365 | 1397 | ||
1366 | PHONY += modules_install | 1398 | PHONY += modules_install |
@@ -1409,123 +1441,12 @@ endif # KBUILD_EXTMOD | |||
1409 | 1441 | ||
1410 | # Generate tags for editors | 1442 | # Generate tags for editors |
1411 | # --------------------------------------------------------------------------- | 1443 | # --------------------------------------------------------------------------- |
1444 | quiet_cmd_tags = GEN $@ | ||
1445 | cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ | ||
1412 | 1446 | ||
1413 | #We want __srctree to totally vanish out when KBUILD_OUTPUT is not set | 1447 | tags TAGS cscope: FORCE |
1414 | #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file. | ||
1415 | #Adding $(srctree) adds about 20M on i386 to the size of the output file! | ||
1416 | |||
1417 | ifeq ($(src),$(obj)) | ||
1418 | __srctree = | ||
1419 | else | ||
1420 | __srctree = $(srctree)/ | ||
1421 | endif | ||
1422 | |||
1423 | ifeq ($(ALLSOURCE_ARCHS),) | ||
1424 | ifeq ($(ARCH),um) | ||
1425 | ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH) | ||
1426 | else | ||
1427 | ALLINCLUDE_ARCHS := $(SRCARCH) | ||
1428 | endif | ||
1429 | else | ||
1430 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. | ||
1431 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) | ||
1432 | endif | ||
1433 | |||
1434 | ALLSOURCE_ARCHS := $(SRCARCH) | ||
1435 | |||
1436 | define find-sources | ||
1437 | ( for arch in $(ALLSOURCE_ARCHS) ; do \ | ||
1438 | find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ | ||
1439 | -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \ | ||
1440 | -o -name $1 -print; \ | ||
1441 | done ; \ | ||
1442 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | ||
1443 | -name $1 -print; \ | ||
1444 | find $(__srctree)include $(RCS_FIND_IGNORE) \ | ||
1445 | \( -name config -o -name 'asm-*' \) -prune \ | ||
1446 | -o -name $1 -print; \ | ||
1447 | for arch in $(ALLINCLUDE_ARCHS) ; do \ | ||
1448 | test -e $(__srctree)include/asm-$${arch} && \ | ||
1449 | find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \ | ||
1450 | -name $1 -print; \ | ||
1451 | test -e $(__srctree)arch/$${arch}/include/asm && \ | ||
1452 | find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \ | ||
1453 | -name $1 -print; \ | ||
1454 | done ; \ | ||
1455 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | ||
1456 | -name $1 -print; \ | ||
1457 | find $(__srctree) $(RCS_FIND_IGNORE) \ | ||
1458 | \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ | ||
1459 | -name $1 -print; \ | ||
1460 | ) | ||
1461 | endef | ||
1462 | |||
1463 | define all-sources | ||
1464 | $(call find-sources,'*.[chS]') | ||
1465 | endef | ||
1466 | define all-kconfigs | ||
1467 | $(call find-sources,'Kconfig*') | ||
1468 | endef | ||
1469 | define all-defconfigs | ||
1470 | $(call find-sources,'defconfig') | ||
1471 | endef | ||
1472 | |||
1473 | define xtags | ||
1474 | if $1 --version 2>&1 | grep -iq exuberant; then \ | ||
1475 | $(all-sources) | xargs $1 -a \ | ||
1476 | -I __initdata,__exitdata,__acquires,__releases \ | ||
1477 | -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \ | ||
1478 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
1479 | --extra=+f --c-kinds=+px \ | ||
1480 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ | ||
1481 | $(all-kconfigs) | xargs $1 -a \ | ||
1482 | --langdef=kconfig \ | ||
1483 | --language-force=kconfig \ | ||
1484 | --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \ | ||
1485 | $(all-defconfigs) | xargs -r $1 -a \ | ||
1486 | --langdef=dotconfig \ | ||
1487 | --language-force=dotconfig \ | ||
1488 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \ | ||
1489 | elif $1 --version 2>&1 | grep -iq emacs; then \ | ||
1490 | $(all-sources) | xargs $1 -a; \ | ||
1491 | $(all-kconfigs) | xargs $1 -a \ | ||
1492 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \ | ||
1493 | $(all-defconfigs) | xargs -r $1 -a \ | ||
1494 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
1495 | else \ | ||
1496 | $(all-sources) | xargs $1 -a; \ | ||
1497 | fi | ||
1498 | endef | ||
1499 | |||
1500 | quiet_cmd_cscope-file = FILELST cscope.files | ||
1501 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files | ||
1502 | |||
1503 | quiet_cmd_cscope = MAKE cscope.out | ||
1504 | cmd_cscope = cscope -b -f cscope.out | ||
1505 | |||
1506 | cscope: FORCE | ||
1507 | $(call cmd,cscope-file) | ||
1508 | $(call cmd,cscope) | ||
1509 | |||
1510 | quiet_cmd_TAGS = MAKE $@ | ||
1511 | define cmd_TAGS | ||
1512 | rm -f $@; \ | ||
1513 | $(call xtags,etags) | ||
1514 | endef | ||
1515 | |||
1516 | TAGS: FORCE | ||
1517 | $(call cmd,TAGS) | ||
1518 | |||
1519 | quiet_cmd_tags = MAKE $@ | ||
1520 | define cmd_tags | ||
1521 | rm -f $@; \ | ||
1522 | $(call xtags,ctags) | ||
1523 | endef | ||
1524 | |||
1525 | tags: FORCE | ||
1526 | $(call cmd,tags) | 1448 | $(call cmd,tags) |
1527 | 1449 | ||
1528 | |||
1529 | # Scripts to check various things for consistency | 1450 | # Scripts to check various things for consistency |
1530 | # --------------------------------------------------------------------------- | 1451 | # --------------------------------------------------------------------------- |
1531 | 1452 | ||
@@ -1604,7 +1525,11 @@ endif | |||
1604 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) | 1525 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) |
1605 | 1526 | ||
1606 | # Modules | 1527 | # Modules |
1607 | / %/: prepare scripts FORCE | 1528 | /: prepare scripts FORCE |
1529 | $(cmd_crmodverdir) | ||
1530 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | ||
1531 | $(build)=$(build-dir) | ||
1532 | %/: prepare scripts FORCE | ||
1608 | $(cmd_crmodverdir) | 1533 | $(cmd_crmodverdir) |
1609 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ | 1534 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
1610 | $(build)=$(build-dir) | 1535 | $(build)=$(build-dir) |
@@ -1638,7 +1563,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ | |||
1638 | $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) | 1563 | $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) |
1639 | 1564 | ||
1640 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ | 1565 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ |
1641 | $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 1566 | $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \ |
1642 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) | 1567 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
1643 | 1568 | ||
1644 | quiet_cmd_as_o_S = AS $@ | 1569 | quiet_cmd_as_o_S = AS $@ |
diff --git a/arch/blackfin/boot/Makefile b/arch/blackfin/boot/Makefile index 522f3c124060..e028d13481a9 100644 --- a/arch/blackfin/boot/Makefile +++ b/arch/blackfin/boot/Makefile | |||
@@ -25,7 +25,7 @@ $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE | |||
25 | 25 | ||
26 | $(obj)/vmImage: $(obj)/vmlinux.gz | 26 | $(obj)/vmImage: $(obj)/vmlinux.gz |
27 | $(call if_changed,uimage) | 27 | $(call if_changed,uimage) |
28 | @echo 'Kernel: $@ is ready' | 28 | @$(kecho) 'Kernel: $@ is ready' |
29 | 29 | ||
30 | install: | 30 | install: |
31 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | 31 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |
diff --git a/arch/x86/scripts/strip-symbols b/arch/x86/scripts/strip-symbols new file mode 100644 index 000000000000..a2f1ccb827c7 --- /dev/null +++ b/arch/x86/scripts/strip-symbols | |||
@@ -0,0 +1 @@ | |||
__cpu_vendor_dev_X86_VENDOR_* | |||
diff --git a/init/Kconfig b/init/Kconfig index f291f086caa1..8a63c404ef44 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -588,6 +588,13 @@ config KALLSYMS_ALL | |||
588 | 588 | ||
589 | Say N. | 589 | Say N. |
590 | 590 | ||
591 | config KALLSYMS_STRIP_GENERATED | ||
592 | bool "Strip machine generated symbols from kallsyms" | ||
593 | depends on KALLSYMS_ALL | ||
594 | default y | ||
595 | help | ||
596 | Say N if you want kallsyms to retain even machine generated symbols. | ||
597 | |||
591 | config KALLSYMS_EXTRA_PASS | 598 | config KALLSYMS_EXTRA_PASS |
592 | bool "Do an extra kallsyms pass" | 599 | bool "Do an extra kallsyms pass" |
593 | depends on KALLSYMS | 600 | depends on KALLSYMS |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 7b8b0f21a5b1..e694afa0eb8c 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -30,20 +30,19 @@ | |||
30 | #define all_var 0 | 30 | #define all_var 0 |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | /* These will be re-linked against their real values during the second link stage */ | 33 | extern const unsigned long kallsyms_addresses[]; |
34 | extern const unsigned long kallsyms_addresses[] __attribute__((weak)); | 34 | extern const u8 kallsyms_names[]; |
35 | extern const u8 kallsyms_names[] __attribute__((weak)); | ||
36 | 35 | ||
37 | /* tell the compiler that the count isn't in the small data section if the arch | 36 | /* tell the compiler that the count isn't in the small data section if the arch |
38 | * has one (eg: FRV) | 37 | * has one (eg: FRV) |
39 | */ | 38 | */ |
40 | extern const unsigned long kallsyms_num_syms | 39 | extern const unsigned long kallsyms_num_syms |
41 | __attribute__((weak, section(".rodata"))); | 40 | __attribute__((__section__(".rodata"))); |
42 | 41 | ||
43 | extern const u8 kallsyms_token_table[] __attribute__((weak)); | 42 | extern const u8 kallsyms_token_table[]; |
44 | extern const u16 kallsyms_token_index[] __attribute__((weak)); | 43 | extern const u16 kallsyms_token_index[]; |
45 | 44 | ||
46 | extern const unsigned long kallsyms_markers[] __attribute__((weak)); | 45 | extern const unsigned long kallsyms_markers[]; |
47 | 46 | ||
48 | static inline int is_kernel_inittext(unsigned long addr) | 47 | static inline int is_kernel_inittext(unsigned long addr) |
49 | { | 48 | { |
@@ -168,9 +167,6 @@ static unsigned long get_symbol_pos(unsigned long addr, | |||
168 | unsigned long symbol_start = 0, symbol_end = 0; | 167 | unsigned long symbol_start = 0, symbol_end = 0; |
169 | unsigned long i, low, high, mid; | 168 | unsigned long i, low, high, mid; |
170 | 169 | ||
171 | /* This kernel should never had been booted. */ | ||
172 | BUG_ON(!kallsyms_addresses); | ||
173 | |||
174 | /* do a binary search on the sorted kallsyms_addresses array */ | 170 | /* do a binary search on the sorted kallsyms_addresses array */ |
175 | low = 0; | 171 | low = 0; |
176 | high = kallsyms_num_syms; | 172 | high = kallsyms_num_syms; |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 982dcae7bbe2..c29be8f90248 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -25,6 +25,13 @@ basetarget = $(basename $(notdir $@)) | |||
25 | escsq = $(subst $(squote),'\$(squote)',$1) | 25 | escsq = $(subst $(squote),'\$(squote)',$1) |
26 | 26 | ||
27 | ### | 27 | ### |
28 | # Easy method for doing a status message | ||
29 | kecho := : | ||
30 | quiet_kecho := echo | ||
31 | silent_kecho := : | ||
32 | kecho := $($(quiet)kecho) | ||
33 | |||
34 | ### | ||
28 | # filechk is used to check if the content of a generated file is updated. | 35 | # filechk is used to check if the content of a generated file is updated. |
29 | # Sample usage: | 36 | # Sample usage: |
30 | # define filechk_sample | 37 | # define filechk_sample |
@@ -39,22 +46,15 @@ escsq = $(subst $(squote),'\$(squote)',$1) | |||
39 | # - If they are equal no change, and no timestamp update | 46 | # - If they are equal no change, and no timestamp update |
40 | # - stdin is piped in from the first prerequisite ($<) so one has | 47 | # - stdin is piped in from the first prerequisite ($<) so one has |
41 | # to specify a valid file as first prerequisite (often the kbuild file) | 48 | # to specify a valid file as first prerequisite (often the kbuild file) |
42 | chk_filechk = : | ||
43 | quiet_chk_filechk = echo ' CHK $@' | ||
44 | silent_chk_filechk = : | ||
45 | upd_filechk = : | ||
46 | quiet_upd_filechk = echo ' UPD $@' | ||
47 | silent_upd_filechk = : | ||
48 | |||
49 | define filechk | 49 | define filechk |
50 | $(Q)set -e; \ | 50 | $(Q)set -e; \ |
51 | $($(quiet)chk_filechk); \ | 51 | $(kecho) ' CHK $@'; \ |
52 | mkdir -p $(dir $@); \ | 52 | mkdir -p $(dir $@); \ |
53 | $(filechk_$(1)) < $< > $@.tmp; \ | 53 | $(filechk_$(1)) < $< > $@.tmp; \ |
54 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ | 54 | if [ -r $@ ] && cmp -s $@ $@.tmp; then \ |
55 | rm -f $@.tmp; \ | 55 | rm -f $@.tmp; \ |
56 | else \ | 56 | else \ |
57 | $($(quiet)upd_filechk); \ | 57 | $(kecho) ' UPD $@'; \ |
58 | mv -f $@.tmp $@; \ | 58 | mv -f $@.tmp $@; \ |
59 | fi | 59 | fi |
60 | endef | 60 | endef |
@@ -144,7 +144,9 @@ ld-option = $(call try-run,\ | |||
144 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | 144 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj |
145 | 145 | ||
146 | # Prefix -I with $(srctree) if it is not an absolute path. | 146 | # Prefix -I with $(srctree) if it is not an absolute path. |
147 | addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) | 147 | # skip if -I has no parameter |
148 | addtree = $(if $(patsubst -I%,%,$(1)), \ | ||
149 | $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)) | ||
148 | 150 | ||
149 | # Find all -I options and call addtree | 151 | # Find all -I options and call addtree |
150 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) | 152 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 7a176773af85..5d900307de3e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -151,14 +151,20 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< | |||
151 | $(obj)/%.i: $(src)/%.c FORCE | 151 | $(obj)/%.i: $(src)/%.c FORCE |
152 | $(call if_changed_dep,cc_i_c) | 152 | $(call if_changed_dep,cc_i_c) |
153 | 153 | ||
154 | cmd_genksyms = \ | ||
155 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ | ||
156 | $(GENKSYMS) -T $@ -A -a $(ARCH) \ | ||
157 | $(if $(KBUILD_PRESERVE),-p) \ | ||
158 | $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) | ||
159 | |||
154 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ | 160 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ |
155 | cmd_cc_symtypes_c = \ | 161 | cmd_cc_symtypes_c = \ |
156 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | 162 | set -e; \ |
157 | | $(GENKSYMS) -T $@ >/dev/null; \ | 163 | $(call cmd_genksyms, true) >/dev/null; \ |
158 | test -s $@ || rm -f $@ | 164 | test -s $@ || rm -f $@ |
159 | 165 | ||
160 | $(obj)/%.symtypes : $(src)/%.c FORCE | 166 | $(obj)/%.symtypes : $(src)/%.c FORCE |
161 | $(call if_changed_dep,cc_symtypes_c) | 167 | $(call cmd,cc_symtypes_c) |
162 | 168 | ||
163 | # C (.c) files | 169 | # C (.c) files |
164 | # The C file is compiled and updated dependency information is generated. | 170 | # The C file is compiled and updated dependency information is generated. |
@@ -171,30 +177,38 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | |||
171 | 177 | ||
172 | else | 178 | else |
173 | # When module versioning is enabled the following steps are executed: | 179 | # When module versioning is enabled the following steps are executed: |
174 | # o compile a .tmp_<file>.o from <file>.c | 180 | # o compile a .tmp_<file>.s from <file>.c |
175 | # o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does | 181 | # o if .tmp_<file>.s doesn't contain a __ksymtab version, i.e. does |
176 | # not export symbols, we just rename .tmp_<file>.o to <file>.o and | 182 | # not export symbols, we just assemble .tmp_<file>.s to <file>.o and |
177 | # are done. | 183 | # are done. |
178 | # o otherwise, we calculate symbol versions using the good old | 184 | # o otherwise, we calculate symbol versions using the good old |
179 | # genksyms on the preprocessed source and postprocess them in a way | 185 | # genksyms on the preprocessed source and postprocess them in a way |
180 | # that they are usable as a linker script | 186 | # that they are usable as assembly source |
181 | # o generate <file>.o from .tmp_<file>.o using the linker to | 187 | # o assemble <file>.o from .tmp_<file>.s forcing inclusion of directives |
182 | # replace the unresolved symbols __crc_exported_symbol with | 188 | # defining the actual values of __crc_*, followed by objcopy-ing them |
183 | # the actual value of the checksum generated by genksyms | 189 | # to force these symbols to be local to permit stripping them later. |
190 | s_file = $(@D)/.tmp_$(@F:.o=.s) | ||
191 | v_file = $(@D)/.tmp_$(@F:.o=.v) | ||
192 | tmp_o_file = $(@D)/.tmp_$(@F) | ||
193 | no_g_c_flags = $(filter-out -g%,$(c_flags)) | ||
194 | |||
195 | cmd_cc_o_c = $(CC) $(c_flags) -S -o $(s_file) $< | ||
184 | 196 | ||
185 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | ||
186 | cmd_modversions = \ | 197 | cmd_modversions = \ |
187 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 198 | if grep -q __ksymtab $(s_file); then \ |
188 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | 199 | if $(call cmd_genksyms, $(KBUILD_SYMTYPES)) > $(v_file) \ |
189 | | $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \ | 200 | && $(CC) $(no_g_c_flags) -c -Wa,$(v_file) \ |
190 | -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH) \ | 201 | -o $(tmp_o_file) $(s_file) \ |
191 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 202 | && $(OBJCOPY) -L '__crc_*' -L '___crc_*' -w \ |
192 | \ | 203 | $(tmp_o_file) $@; \ |
193 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | 204 | then \ |
194 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | 205 | : ; \ |
195 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | 206 | else \ |
207 | rm -f $@; exit 1; \ | ||
208 | fi; \ | ||
196 | else \ | 209 | else \ |
197 | mv -f $(@D)/.tmp_$(@F) $@; \ | 210 | rm -f $(v_file); \ |
211 | $(CC) $(no_g_c_flags) -c -o $@ $(s_file); \ | ||
198 | fi; | 212 | fi; |
199 | endif | 213 | endif |
200 | 214 | ||
@@ -211,7 +225,12 @@ define rule_cc_o_c | |||
211 | $(cmd_record_mcount) \ | 225 | $(cmd_record_mcount) \ |
212 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 226 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
213 | $(dot-target).tmp; \ | 227 | $(dot-target).tmp; \ |
214 | rm -f $(depfile); \ | 228 | if [ -r $(@D)/.tmp_$(@F:.o=.v) ]; then \ |
229 | echo >> $(dot-target).tmp; \ | ||
230 | echo '$@: $(GENKSYMS)' >> $(dot-target).tmp; \ | ||
231 | echo '$(GENKSYMS):: ;' >> $(dot-target).tmp; \ | ||
232 | fi; \ | ||
233 | rm -f $(depfile) $(@D)/.tmp_$(@F:.o=.?); \ | ||
215 | mv -f $(dot-target).tmp $(dot-target).cmd | 234 | mv -f $(dot-target).tmp $(dot-target).cmd |
216 | endef | 235 | endef |
217 | 236 | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index b4ca38a21158..e06365775bdf 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -104,9 +104,11 @@ else | |||
104 | debug_flags = | 104 | debug_flags = |
105 | endif | 105 | endif |
106 | 106 | ||
107 | orig_c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o) | 107 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ |
108 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | ||
108 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 109 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
109 | _a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o) | 110 | _a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) \ |
111 | $(asflags-y) $(AFLAGS_$(basetarget).o) | ||
110 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | 112 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) |
111 | 113 | ||
112 | # If building the kernel in a separate objtree expand all occurrences | 114 | # If building the kernel in a separate objtree expand all occurrences |
@@ -127,15 +129,16 @@ __a_flags = $(call flags,_a_flags) | |||
127 | __cpp_flags = $(call flags,_cpp_flags) | 129 | __cpp_flags = $(call flags,_cpp_flags) |
128 | endif | 130 | endif |
129 | 131 | ||
130 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 132 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
131 | $(__c_flags) $(modkern_cflags) \ | 133 | $(__c_flags) $(modkern_cflags) \ |
132 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \ | 134 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \ |
133 | $(debug_flags) | 135 | $(debug_flags) |
134 | 136 | ||
135 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ | 137 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
136 | $(__a_flags) $(modkern_aflags) | 138 | $(__a_flags) $(modkern_aflags) |
137 | 139 | ||
138 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) | 140 | cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ |
141 | $(__cpp_flags) | ||
139 | 142 | ||
140 | ld_flags = $(LDFLAGS) $(ldflags-y) | 143 | ld_flags = $(LDFLAGS) $(ldflags-y) |
141 | 144 | ||
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index efa5d940e632..a5122dce1264 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
@@ -17,7 +17,8 @@ __modinst: $(modules) | |||
17 | @: | 17 | @: |
18 | 18 | ||
19 | quiet_cmd_modules_install = INSTALL $@ | 19 | quiet_cmd_modules_install = INSTALL $@ |
20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) | 20 | cmd_modules_install = mkdir -p $(2); \ |
21 | $(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2) | ||
21 | 22 | ||
22 | # Modules built outside the kernel source tree go into extra by default | 23 | # Modules built outside the kernel source tree go into extra by default |
23 | INSTALL_MOD_DIR ?= extra | 24 | INSTALL_MOD_DIR ?= extra |
diff --git a/scripts/decodecode b/scripts/decodecode index 235d3938529d..4b00647814bc 100755 --- a/scripts/decodecode +++ b/scripts/decodecode | |||
@@ -7,7 +7,7 @@ | |||
7 | # AFLAGS=--32 decodecode < 386.oops | 7 | # AFLAGS=--32 decodecode < 386.oops |
8 | 8 | ||
9 | cleanup() { | 9 | cleanup() { |
10 | rm -f $T $T.s $T.o | 10 | rm -f $T $T.s $T.o $T.oo $T.aa $T.aaa |
11 | exit 1 | 11 | exit 1 |
12 | } | 12 | } |
13 | 13 | ||
@@ -44,21 +44,33 @@ if [ $marker -eq 0 ]; then | |||
44 | marker=`expr index "$code" "\("` | 44 | marker=`expr index "$code" "\("` |
45 | fi | 45 | fi |
46 | 46 | ||
47 | touch $T.oo | ||
47 | if [ $marker -ne 0 ]; then | 48 | if [ $marker -ne 0 ]; then |
48 | beforemark=`echo "$code" | cut -c-$((${marker} - 1))` | 49 | echo All code >> $T.oo |
50 | echo ======== >> $T.oo | ||
51 | beforemark=`echo "$code"` | ||
49 | echo -n " .byte 0x" > $T.s | 52 | echo -n " .byte 0x" > $T.s |
50 | echo $beforemark | sed -e 's/ /,0x/g' >> $T.s | 53 | echo $beforemark | sed -e 's/ /,0x/g' | sed -e 's/<//g' | sed -e 's/>//g' >> $T.s |
51 | as $AFLAGS -o $T.o $T.s | 54 | as $AFLAGS -o $T.o $T.s &> /dev/null |
52 | objdump -S $T.o | 55 | objdump -S $T.o | grep -v "/tmp" | grep -v "Disassembly" | grep -v "\.text" | grep -v "^$" &> $T.ooo |
53 | rm $T.o $T.s | 56 | cat $T.ooo >> $T.oo |
57 | rm -f $T.o $T.s $T.ooo | ||
54 | 58 | ||
55 | # and fix code at-and-after marker | 59 | # and fix code at-and-after marker |
56 | code=`echo "$code" | cut -c$((${marker} + 1))-` | 60 | code=`echo "$code" | cut -c$((${marker} + 1))-` |
57 | fi | 61 | fi |
58 | 62 | echo Code starting with the faulting instruction > $T.aa | |
63 | echo =========================================== >> $T.aa | ||
59 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` | 64 | code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'` |
60 | echo -n " .byte 0x" > $T.s | 65 | echo -n " .byte 0x" > $T.s |
61 | echo $code >> $T.s | 66 | echo $code >> $T.s |
62 | as $AFLAGS -o $T.o $T.s | 67 | as $AFLAGS -o $T.o $T.s &> /dev/null |
63 | objdump -S $T.o | 68 | objdump -S $T.o | grep -v "Disassembly" | grep -v "/tmp" | grep -v "\.text" | grep -v "^$" &> $T.aaa |
64 | rm $T $T.s $T.o | 69 | cat $T.aaa >> $T.aa |
70 | |||
71 | faultline=`cat $T.aaa | head -1 | cut -d":" -f2` | ||
72 | |||
73 | cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" | ||
74 | echo | ||
75 | cat $T.aa | ||
76 | cleanup | ||
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig index 8187e6f0dc2f..72997c353cb3 100755 --- a/scripts/extract-ikconfig +++ b/scripts/extract-ikconfig | |||
@@ -8,8 +8,8 @@ test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1 | |||
8 | 8 | ||
9 | IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54" | 9 | IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54" |
10 | IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44" | 10 | IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44" |
11 | function dump_config { | 11 | dump_config() { |
12 | typeset file="$1" | 12 | file="$1" |
13 | 13 | ||
14 | start=`$binoffset $file $IKCFG_ST 2>/dev/null` | 14 | start=`$binoffset $file $IKCFG_ST 2>/dev/null` |
15 | [ "$?" != "0" ] && start="-1" | 15 | [ "$?" != "0" ] && start="-1" |
@@ -18,8 +18,8 @@ function dump_config { | |||
18 | fi | 18 | fi |
19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` | 19 | end=`$binoffset $file $IKCFG_ED 2>/dev/null` |
20 | 20 | ||
21 | let start="$start + 8" | 21 | start=`expr $start + 8` |
22 | let size="$end - $start" | 22 | size=`expr $end - $start` |
23 | 23 | ||
24 | dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat | 24 | dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat |
25 | 25 | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index c249274e005a..f8bb4cabd62d 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -42,7 +42,8 @@ static FILE *debugfile; | |||
42 | int cur_line = 1; | 42 | int cur_line = 1; |
43 | char *cur_filename; | 43 | char *cur_filename; |
44 | 44 | ||
45 | static int flag_debug, flag_dump_defs, flag_dump_types, flag_warnings; | 45 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, |
46 | flag_preserve, flag_warnings, flag_asm; | ||
46 | static const char *arch = ""; | 47 | static const char *arch = ""; |
47 | static const char *mod_prefix = ""; | 48 | static const char *mod_prefix = ""; |
48 | 49 | ||
@@ -58,6 +59,8 @@ static const char *const symbol_type_name[] = { | |||
58 | 59 | ||
59 | static int equal_list(struct string_list *a, struct string_list *b); | 60 | static int equal_list(struct string_list *a, struct string_list *b); |
60 | static void print_list(FILE * f, struct string_list *list); | 61 | static void print_list(FILE * f, struct string_list *list); |
62 | static void print_location(void); | ||
63 | static void print_type_name(enum symbol_type type, const char *name); | ||
61 | 64 | ||
62 | /*----------------------------------------------------------------------*/ | 65 | /*----------------------------------------------------------------------*/ |
63 | 66 | ||
@@ -151,27 +154,83 @@ struct symbol *find_symbol(const char *name, enum symbol_type ns) | |||
151 | 154 | ||
152 | for (sym = symtab[h]; sym; sym = sym->hash_next) | 155 | for (sym = symtab[h]; sym; sym = sym->hash_next) |
153 | if (map_to_ns(sym->type) == map_to_ns(ns) && | 156 | if (map_to_ns(sym->type) == map_to_ns(ns) && |
154 | strcmp(name, sym->name) == 0) | 157 | strcmp(name, sym->name) == 0 && |
158 | sym->is_declared) | ||
155 | break; | 159 | break; |
156 | 160 | ||
157 | return sym; | 161 | return sym; |
158 | } | 162 | } |
159 | 163 | ||
160 | struct symbol *add_symbol(const char *name, enum symbol_type type, | 164 | static int is_unknown_symbol(struct symbol *sym) |
161 | struct string_list *defn, int is_extern) | 165 | { |
166 | struct string_list *defn; | ||
167 | |||
168 | return ((sym->type == SYM_STRUCT || | ||
169 | sym->type == SYM_UNION || | ||
170 | sym->type == SYM_ENUM) && | ||
171 | (defn = sym->defn) && defn->tag == SYM_NORMAL && | ||
172 | strcmp(defn->string, "}") == 0 && | ||
173 | (defn = defn->next) && defn->tag == SYM_NORMAL && | ||
174 | strcmp(defn->string, "UNKNOWN") == 0 && | ||
175 | (defn = defn->next) && defn->tag == SYM_NORMAL && | ||
176 | strcmp(defn->string, "{") == 0); | ||
177 | } | ||
178 | |||
179 | struct symbol *__add_symbol(const char *name, enum symbol_type type, | ||
180 | struct string_list *defn, int is_extern, | ||
181 | int is_reference) | ||
162 | { | 182 | { |
163 | unsigned long h = crc32(name) % HASH_BUCKETS; | 183 | unsigned long h = crc32(name) % HASH_BUCKETS; |
164 | struct symbol *sym; | 184 | struct symbol *sym; |
185 | enum symbol_status status = STATUS_UNCHANGED; | ||
165 | 186 | ||
166 | for (sym = symtab[h]; sym; sym = sym->hash_next) { | 187 | for (sym = symtab[h]; sym; sym = sym->hash_next) { |
167 | if (map_to_ns(sym->type) == map_to_ns(type) | 188 | if (map_to_ns(sym->type) == map_to_ns(type) && |
168 | && strcmp(name, sym->name) == 0) { | 189 | strcmp(name, sym->name) == 0) { |
169 | if (!equal_list(sym->defn, defn)) | 190 | if (is_reference) |
191 | /* fall through */ ; | ||
192 | else if (sym->type == type && | ||
193 | equal_list(sym->defn, defn)) { | ||
194 | if (!sym->is_declared && sym->is_override) { | ||
195 | print_location(); | ||
196 | print_type_name(type, name); | ||
197 | fprintf(stderr, " modversion is " | ||
198 | "unchanged\n"); | ||
199 | } | ||
200 | sym->is_declared = 1; | ||
201 | return sym; | ||
202 | } else if (!sym->is_declared) { | ||
203 | if (sym->is_override && flag_preserve) { | ||
204 | print_location(); | ||
205 | fprintf(stderr, "ignoring "); | ||
206 | print_type_name(type, name); | ||
207 | fprintf(stderr, " modversion change\n"); | ||
208 | sym->is_declared = 1; | ||
209 | return sym; | ||
210 | } else { | ||
211 | status = is_unknown_symbol(sym) ? | ||
212 | STATUS_DEFINED : STATUS_MODIFIED; | ||
213 | } | ||
214 | } else { | ||
170 | error_with_pos("redefinition of %s", name); | 215 | error_with_pos("redefinition of %s", name); |
171 | return sym; | 216 | return sym; |
217 | } | ||
218 | break; | ||
172 | } | 219 | } |
173 | } | 220 | } |
174 | 221 | ||
222 | if (sym) { | ||
223 | struct symbol **psym; | ||
224 | |||
225 | for (psym = &symtab[h]; *psym; psym = &(*psym)->hash_next) { | ||
226 | if (*psym == sym) { | ||
227 | *psym = sym->hash_next; | ||
228 | break; | ||
229 | } | ||
230 | } | ||
231 | --nsyms; | ||
232 | } | ||
233 | |||
175 | sym = xmalloc(sizeof(*sym)); | 234 | sym = xmalloc(sizeof(*sym)); |
176 | sym->name = name; | 235 | sym->name = name; |
177 | sym->type = type; | 236 | sym->type = type; |
@@ -183,6 +242,10 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
183 | sym->hash_next = symtab[h]; | 242 | sym->hash_next = symtab[h]; |
184 | symtab[h] = sym; | 243 | symtab[h] = sym; |
185 | 244 | ||
245 | sym->is_declared = !is_reference; | ||
246 | sym->status = status; | ||
247 | sym->is_override = 0; | ||
248 | |||
186 | if (flag_debug) { | 249 | if (flag_debug) { |
187 | fprintf(debugfile, "Defn for %s %s == <", | 250 | fprintf(debugfile, "Defn for %s %s == <", |
188 | symbol_type_name[type], name); | 251 | symbol_type_name[type], name); |
@@ -196,6 +259,18 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
196 | return sym; | 259 | return sym; |
197 | } | 260 | } |
198 | 261 | ||
262 | struct symbol *add_symbol(const char *name, enum symbol_type type, | ||
263 | struct string_list *defn, int is_extern) | ||
264 | { | ||
265 | return __add_symbol(name, type, defn, is_extern, 0); | ||
266 | } | ||
267 | |||
268 | struct symbol *add_reference_symbol(const char *name, enum symbol_type type, | ||
269 | struct string_list *defn, int is_extern) | ||
270 | { | ||
271 | return __add_symbol(name, type, defn, is_extern, 1); | ||
272 | } | ||
273 | |||
199 | /*----------------------------------------------------------------------*/ | 274 | /*----------------------------------------------------------------------*/ |
200 | 275 | ||
201 | void free_node(struct string_list *node) | 276 | void free_node(struct string_list *node) |
@@ -236,6 +311,90 @@ static int equal_list(struct string_list *a, struct string_list *b) | |||
236 | return !a && !b; | 311 | return !a && !b; |
237 | } | 312 | } |
238 | 313 | ||
314 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | ||
315 | |||
316 | struct string_list *read_node(FILE *f) | ||
317 | { | ||
318 | char buffer[256]; | ||
319 | struct string_list node = { | ||
320 | .string = buffer, | ||
321 | .tag = SYM_NORMAL }; | ||
322 | int c; | ||
323 | |||
324 | while ((c = fgetc(f)) != EOF) { | ||
325 | if (c == ' ') { | ||
326 | if (node.string == buffer) | ||
327 | continue; | ||
328 | break; | ||
329 | } else if (c == '\n') { | ||
330 | if (node.string == buffer) | ||
331 | return NULL; | ||
332 | ungetc(c, f); | ||
333 | break; | ||
334 | } | ||
335 | if (node.string >= buffer + sizeof(buffer) - 1) { | ||
336 | fprintf(stderr, "Token too long\n"); | ||
337 | exit(1); | ||
338 | } | ||
339 | *node.string++ = c; | ||
340 | } | ||
341 | if (node.string == buffer) | ||
342 | return NULL; | ||
343 | *node.string = 0; | ||
344 | node.string = buffer; | ||
345 | |||
346 | if (node.string[1] == '#') { | ||
347 | int n; | ||
348 | |||
349 | for (n = 0; n < ARRAY_SIZE(symbol_type_name); n++) { | ||
350 | if (node.string[0] == symbol_type_name[n][0]) { | ||
351 | node.tag = n; | ||
352 | node.string += 2; | ||
353 | return copy_node(&node); | ||
354 | } | ||
355 | } | ||
356 | fprintf(stderr, "Unknown type %c\n", node.string[0]); | ||
357 | exit(1); | ||
358 | } | ||
359 | return copy_node(&node); | ||
360 | } | ||
361 | |||
362 | static void read_reference(FILE *f) | ||
363 | { | ||
364 | while (!feof(f)) { | ||
365 | struct string_list *defn = NULL; | ||
366 | struct string_list *sym, *def; | ||
367 | int is_extern = 0, is_override = 0; | ||
368 | struct symbol *subsym; | ||
369 | |||
370 | sym = read_node(f); | ||
371 | if (sym && sym->tag == SYM_NORMAL && | ||
372 | !strcmp(sym->string, "override")) { | ||
373 | is_override = 1; | ||
374 | free_node(sym); | ||
375 | sym = read_node(f); | ||
376 | } | ||
377 | if (!sym) | ||
378 | continue; | ||
379 | def = read_node(f); | ||
380 | if (def && def->tag == SYM_NORMAL && | ||
381 | !strcmp(def->string, "extern")) { | ||
382 | is_extern = 1; | ||
383 | free_node(def); | ||
384 | def = read_node(f); | ||
385 | } | ||
386 | while (def) { | ||
387 | def->next = defn; | ||
388 | defn = def; | ||
389 | def = read_node(f); | ||
390 | } | ||
391 | subsym = add_reference_symbol(xstrdup(sym->string), sym->tag, | ||
392 | defn, is_extern); | ||
393 | subsym->is_override = is_override; | ||
394 | free_node(sym); | ||
395 | } | ||
396 | } | ||
397 | |||
239 | static void print_node(FILE * f, struct string_list *list) | 398 | static void print_node(FILE * f, struct string_list *list) |
240 | { | 399 | { |
241 | if (list->tag != SYM_NORMAL) { | 400 | if (list->tag != SYM_NORMAL) { |
@@ -311,6 +470,7 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) | |||
311 | 470 | ||
312 | case SYM_TYPEDEF: | 471 | case SYM_TYPEDEF: |
313 | subsym = find_symbol(cur->string, cur->tag); | 472 | subsym = find_symbol(cur->string, cur->tag); |
473 | /* FIXME: Bad reference files can segfault here. */ | ||
314 | if (subsym->expansion_trail) { | 474 | if (subsym->expansion_trail) { |
315 | if (flag_dump_defs) | 475 | if (flag_dump_defs) |
316 | fprintf(debugfile, "%s ", cur->string); | 476 | fprintf(debugfile, "%s ", cur->string); |
@@ -347,9 +507,22 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) | |||
347 | t = n; | 507 | t = n; |
348 | 508 | ||
349 | n = xmalloc(sizeof(*n)); | 509 | n = xmalloc(sizeof(*n)); |
350 | n->string = xstrdup("{ UNKNOWN }"); | 510 | n->string = xstrdup("{"); |
511 | n->tag = SYM_NORMAL; | ||
512 | n->next = t; | ||
513 | t = n; | ||
514 | |||
515 | n = xmalloc(sizeof(*n)); | ||
516 | n->string = xstrdup("UNKNOWN"); | ||
517 | n->tag = SYM_NORMAL; | ||
518 | n->next = t; | ||
519 | t = n; | ||
520 | |||
521 | n = xmalloc(sizeof(*n)); | ||
522 | n->string = xstrdup("}"); | ||
351 | n->tag = SYM_NORMAL; | 523 | n->tag = SYM_NORMAL; |
352 | n->next = t; | 524 | n->next = t; |
525 | t = n; | ||
353 | 526 | ||
354 | subsym = | 527 | subsym = |
355 | add_symbol(cur->string, cur->tag, n, 0); | 528 | add_symbol(cur->string, cur->tag, n, 0); |
@@ -397,37 +570,75 @@ void export_symbol(const char *name) | |||
397 | error_with_pos("export undefined symbol %s", name); | 570 | error_with_pos("export undefined symbol %s", name); |
398 | else { | 571 | else { |
399 | unsigned long crc; | 572 | unsigned long crc; |
573 | int has_changed = 0; | ||
400 | 574 | ||
401 | if (flag_dump_defs) | 575 | if (flag_dump_defs) |
402 | fprintf(debugfile, "Export %s == <", name); | 576 | fprintf(debugfile, "Export %s == <", name); |
403 | 577 | ||
404 | expansion_trail = (struct symbol *)-1L; | 578 | expansion_trail = (struct symbol *)-1L; |
405 | 579 | ||
580 | sym->expansion_trail = expansion_trail; | ||
581 | expansion_trail = sym; | ||
406 | crc = expand_and_crc_sym(sym, 0xffffffff) ^ 0xffffffff; | 582 | crc = expand_and_crc_sym(sym, 0xffffffff) ^ 0xffffffff; |
407 | 583 | ||
408 | sym = expansion_trail; | 584 | sym = expansion_trail; |
409 | while (sym != (struct symbol *)-1L) { | 585 | while (sym != (struct symbol *)-1L) { |
410 | struct symbol *n = sym->expansion_trail; | 586 | struct symbol *n = sym->expansion_trail; |
587 | |||
588 | if (sym->status != STATUS_UNCHANGED) { | ||
589 | if (!has_changed) { | ||
590 | print_location(); | ||
591 | fprintf(stderr, "%s: %s: modversion " | ||
592 | "changed because of changes " | ||
593 | "in ", flag_preserve ? "error" : | ||
594 | "warning", name); | ||
595 | } else | ||
596 | fprintf(stderr, ", "); | ||
597 | print_type_name(sym->type, sym->name); | ||
598 | if (sym->status == STATUS_DEFINED) | ||
599 | fprintf(stderr, " (became defined)"); | ||
600 | has_changed = 1; | ||
601 | if (flag_preserve) | ||
602 | errors++; | ||
603 | } | ||
411 | sym->expansion_trail = 0; | 604 | sym->expansion_trail = 0; |
412 | sym = n; | 605 | sym = n; |
413 | } | 606 | } |
607 | if (has_changed) | ||
608 | fprintf(stderr, "\n"); | ||
414 | 609 | ||
415 | if (flag_dump_defs) | 610 | if (flag_dump_defs) |
416 | fputs(">\n", debugfile); | 611 | fputs(">\n", debugfile); |
417 | 612 | ||
418 | /* Used as a linker script. */ | 613 | /* Used as assembly source or a linker script. */ |
419 | printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc); | 614 | printf(flag_asm |
615 | ? ".equiv %s__crc_%s, %#08lx\n" | ||
616 | : "%s__crc_%s = %#08lx ;\n", | ||
617 | mod_prefix, name, crc); | ||
420 | } | 618 | } |
421 | } | 619 | } |
422 | 620 | ||
423 | /*----------------------------------------------------------------------*/ | 621 | /*----------------------------------------------------------------------*/ |
622 | |||
623 | static void print_location(void) | ||
624 | { | ||
625 | fprintf(stderr, "%s:%d: ", cur_filename ? : "<stdin>", cur_line); | ||
626 | } | ||
627 | |||
628 | static void print_type_name(enum symbol_type type, const char *name) | ||
629 | { | ||
630 | if (type != SYM_NORMAL) | ||
631 | fprintf(stderr, "%s %s", symbol_type_name[type], name); | ||
632 | else | ||
633 | fprintf(stderr, "%s", name); | ||
634 | } | ||
635 | |||
424 | void error_with_pos(const char *fmt, ...) | 636 | void error_with_pos(const char *fmt, ...) |
425 | { | 637 | { |
426 | va_list args; | 638 | va_list args; |
427 | 639 | ||
428 | if (flag_warnings) { | 640 | if (flag_warnings) { |
429 | fprintf(stderr, "%s:%d: ", cur_filename ? : "<stdin>", | 641 | print_location(); |
430 | cur_line); | ||
431 | 642 | ||
432 | va_start(args, fmt); | 643 | va_start(args, fmt); |
433 | vfprintf(stderr, fmt, args); | 644 | vfprintf(stderr, fmt, args); |
@@ -440,21 +651,27 @@ void error_with_pos(const char *fmt, ...) | |||
440 | 651 | ||
441 | static void genksyms_usage(void) | 652 | static void genksyms_usage(void) |
442 | { | 653 | { |
443 | fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" | 654 | fputs("Usage:\n" "genksyms [-aAdDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" |
444 | #ifdef __GNU_LIBRARY__ | 655 | #ifdef __GNU_LIBRARY__ |
445 | " -a, --arch Select architecture\n" | 656 | " -a, --arch Select architecture\n" |
657 | " -A, --asm Generate assembly rather than linker script\n" | ||
446 | " -d, --debug Increment the debug level (repeatable)\n" | 658 | " -d, --debug Increment the debug level (repeatable)\n" |
447 | " -D, --dump Dump expanded symbol defs (for debugging only)\n" | 659 | " -D, --dump Dump expanded symbol defs (for debugging only)\n" |
448 | " -T, --dump-types file Dump expanded types into file (for debugging only)\n" | 660 | " -r, --reference file Read reference symbols from a file\n" |
661 | " -T, --dump-types file Dump expanded types into file\n" | ||
662 | " -p, --preserve Preserve reference modversions or fail\n" | ||
449 | " -w, --warnings Enable warnings\n" | 663 | " -w, --warnings Enable warnings\n" |
450 | " -q, --quiet Disable warnings (default)\n" | 664 | " -q, --quiet Disable warnings (default)\n" |
451 | " -h, --help Print this message\n" | 665 | " -h, --help Print this message\n" |
452 | " -V, --version Print the release version\n" | 666 | " -V, --version Print the release version\n" |
453 | #else /* __GNU_LIBRARY__ */ | 667 | #else /* __GNU_LIBRARY__ */ |
454 | " -a Select architecture\n" | 668 | " -a Select architecture\n" |
669 | " -A Generate assembly rather than linker script\n" | ||
455 | " -d Increment the debug level (repeatable)\n" | 670 | " -d Increment the debug level (repeatable)\n" |
456 | " -D Dump expanded symbol defs (for debugging only)\n" | 671 | " -D Dump expanded symbol defs (for debugging only)\n" |
457 | " -T file Dump expanded types into file (for debugging only)\n" | 672 | " -r file Read reference symbols from a file\n" |
673 | " -T file Dump expanded types into file\n" | ||
674 | " -p Preserve reference modversions or fail\n" | ||
458 | " -w Enable warnings\n" | 675 | " -w Enable warnings\n" |
459 | " -q Disable warnings (default)\n" | 676 | " -q Disable warnings (default)\n" |
460 | " -h Print this message\n" | 677 | " -h Print this message\n" |
@@ -465,26 +682,29 @@ static void genksyms_usage(void) | |||
465 | 682 | ||
466 | int main(int argc, char **argv) | 683 | int main(int argc, char **argv) |
467 | { | 684 | { |
468 | FILE *dumpfile = NULL; | 685 | FILE *dumpfile = NULL, *ref_file = NULL; |
469 | int o; | 686 | int o; |
470 | 687 | ||
471 | #ifdef __GNU_LIBRARY__ | 688 | #ifdef __GNU_LIBRARY__ |
472 | struct option long_opts[] = { | 689 | struct option long_opts[] = { |
473 | {"arch", 1, 0, 'a'}, | 690 | {"arch", 1, 0, 'a'}, |
691 | {"asm", 0, 0, 'A'}, | ||
474 | {"debug", 0, 0, 'd'}, | 692 | {"debug", 0, 0, 'd'}, |
475 | {"warnings", 0, 0, 'w'}, | 693 | {"warnings", 0, 0, 'w'}, |
476 | {"quiet", 0, 0, 'q'}, | 694 | {"quiet", 0, 0, 'q'}, |
477 | {"dump", 0, 0, 'D'}, | 695 | {"dump", 0, 0, 'D'}, |
696 | {"reference", 1, 0, 'r'}, | ||
478 | {"dump-types", 1, 0, 'T'}, | 697 | {"dump-types", 1, 0, 'T'}, |
698 | {"preserve", 0, 0, 'p'}, | ||
479 | {"version", 0, 0, 'V'}, | 699 | {"version", 0, 0, 'V'}, |
480 | {"help", 0, 0, 'h'}, | 700 | {"help", 0, 0, 'h'}, |
481 | {0, 0, 0, 0} | 701 | {0, 0, 0, 0} |
482 | }; | 702 | }; |
483 | 703 | ||
484 | while ((o = getopt_long(argc, argv, "a:dwqVDT:h", | 704 | while ((o = getopt_long(argc, argv, "a:dwqVADr:T:ph", |
485 | &long_opts[0], NULL)) != EOF) | 705 | &long_opts[0], NULL)) != EOF) |
486 | #else /* __GNU_LIBRARY__ */ | 706 | #else /* __GNU_LIBRARY__ */ |
487 | while ((o = getopt(argc, argv, "a:dwqVDT:h")) != EOF) | 707 | while ((o = getopt(argc, argv, "a:dwqVADr:T:ph")) != EOF) |
488 | #endif /* __GNU_LIBRARY__ */ | 708 | #endif /* __GNU_LIBRARY__ */ |
489 | switch (o) { | 709 | switch (o) { |
490 | case 'a': | 710 | case 'a': |
@@ -502,9 +722,20 @@ int main(int argc, char **argv) | |||
502 | case 'V': | 722 | case 'V': |
503 | fputs("genksyms version 2.5.60\n", stderr); | 723 | fputs("genksyms version 2.5.60\n", stderr); |
504 | break; | 724 | break; |
725 | case 'A': | ||
726 | flag_asm = 1; | ||
727 | break; | ||
505 | case 'D': | 728 | case 'D': |
506 | flag_dump_defs = 1; | 729 | flag_dump_defs = 1; |
507 | break; | 730 | break; |
731 | case 'r': | ||
732 | flag_reference = 1; | ||
733 | ref_file = fopen(optarg, "r"); | ||
734 | if (!ref_file) { | ||
735 | perror(optarg); | ||
736 | return 1; | ||
737 | } | ||
738 | break; | ||
508 | case 'T': | 739 | case 'T': |
509 | flag_dump_types = 1; | 740 | flag_dump_types = 1; |
510 | dumpfile = fopen(optarg, "w"); | 741 | dumpfile = fopen(optarg, "w"); |
@@ -513,6 +744,9 @@ int main(int argc, char **argv) | |||
513 | return 1; | 744 | return 1; |
514 | } | 745 | } |
515 | break; | 746 | break; |
747 | case 'p': | ||
748 | flag_preserve = 1; | ||
749 | break; | ||
516 | case 'h': | 750 | case 'h': |
517 | genksyms_usage(); | 751 | genksyms_usage(); |
518 | return 0; | 752 | return 0; |
@@ -533,12 +767,17 @@ int main(int argc, char **argv) | |||
533 | /* setlinebuf(debugfile); */ | 767 | /* setlinebuf(debugfile); */ |
534 | } | 768 | } |
535 | 769 | ||
770 | if (flag_reference) | ||
771 | read_reference(ref_file); | ||
772 | |||
536 | yyparse(); | 773 | yyparse(); |
537 | 774 | ||
538 | if (flag_dump_types && visited_symbols) { | 775 | if (flag_dump_types && visited_symbols) { |
539 | while (visited_symbols != (struct symbol *)-1L) { | 776 | while (visited_symbols != (struct symbol *)-1L) { |
540 | struct symbol *sym = visited_symbols; | 777 | struct symbol *sym = visited_symbols; |
541 | 778 | ||
779 | if (sym->is_override) | ||
780 | fputs("override ", dumpfile); | ||
542 | if (sym->type != SYM_NORMAL) { | 781 | if (sym->type != SYM_NORMAL) { |
543 | putc(symbol_type_name[sym->type][0], dumpfile); | 782 | putc(symbol_type_name[sym->type][0], dumpfile); |
544 | putc('#', dumpfile); | 783 | putc('#', dumpfile); |
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index 2668287aa498..25c4d40cefc1 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
@@ -29,6 +29,10 @@ enum symbol_type { | |||
29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION | 29 | SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION |
30 | }; | 30 | }; |
31 | 31 | ||
32 | enum symbol_status { | ||
33 | STATUS_UNCHANGED, STATUS_DEFINED, STATUS_MODIFIED | ||
34 | }; | ||
35 | |||
32 | struct string_list { | 36 | struct string_list { |
33 | struct string_list *next; | 37 | struct string_list *next; |
34 | enum symbol_type tag; | 38 | enum symbol_type tag; |
@@ -43,6 +47,9 @@ struct symbol { | |||
43 | struct symbol *expansion_trail; | 47 | struct symbol *expansion_trail; |
44 | struct symbol *visited; | 48 | struct symbol *visited; |
45 | int is_extern; | 49 | int is_extern; |
50 | int is_declared; | ||
51 | enum symbol_status status; | ||
52 | int is_override; | ||
46 | }; | 53 | }; |
47 | 54 | ||
48 | typedef struct string_list **yystype; | 55 | typedef struct string_list **yystype; |
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped index 971e0113ae7a..83484fe93ede 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.c_shipped | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.2 */ | 1 | /* ANSI-C code produced by gperf version 3.0.1 */ |
2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ |
3 | 3 | ||
4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #line 3 "scripts/genksyms/keywords.gperf" | 33 | #line 3 "scripts/genksyms/keywords.gperf" |
34 | struct resword { const char *name; int token; }; | 34 | struct resword { const char *name; int token; }; |
35 | /* maximum key range = 62, duplicates = 0 */ | 35 | /* maximum key range = 64, duplicates = 0 */ |
36 | 36 | ||
37 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
38 | __inline | 38 | __inline |
@@ -46,32 +46,32 @@ is_reserved_hash (register const char *str, register unsigned int len) | |||
46 | { | 46 | { |
47 | static const unsigned char asso_values[] = | 47 | static const unsigned char asso_values[] = |
48 | { | 48 | { |
49 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 49 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
50 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 50 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
51 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 51 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
52 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 52 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
53 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 53 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
54 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 54 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
55 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 5, | 55 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, |
56 | 65, 65, 65, 65, 65, 65, 35, 65, 65, 65, | 56 | 67, 67, 67, 67, 67, 67, 15, 67, 67, 67, |
57 | 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 57 | 0, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
58 | 65, 65, 65, 65, 65, 0, 65, 0, 65, 5, | 58 | 67, 67, 67, 67, 67, 0, 67, 0, 67, 5, |
59 | 20, 15, 10, 30, 65, 15, 65, 65, 20, 0, | 59 | 25, 20, 15, 30, 67, 15, 67, 67, 10, 0, |
60 | 10, 35, 20, 65, 10, 5, 0, 10, 5, 65, | 60 | 10, 40, 20, 67, 10, 5, 0, 10, 15, 67, |
61 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 61 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
62 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 62 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
63 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 63 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
64 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 64 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
65 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 65 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
66 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 66 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
67 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 67 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
68 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 68 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
69 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 69 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
70 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 70 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
71 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 71 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
72 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 72 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
73 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 73 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, |
74 | 65, 65, 65, 65, 65, 65 | 74 | 67, 67, 67, 67, 67, 67 |
75 | }; | 75 | }; |
76 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; | 76 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; |
77 | } | 77 | } |
@@ -84,116 +84,119 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
84 | { | 84 | { |
85 | enum | 85 | enum |
86 | { | 86 | { |
87 | TOTAL_KEYWORDS = 43, | 87 | TOTAL_KEYWORDS = 45, |
88 | MIN_WORD_LENGTH = 3, | 88 | MIN_WORD_LENGTH = 3, |
89 | MAX_WORD_LENGTH = 24, | 89 | MAX_WORD_LENGTH = 24, |
90 | MIN_HASH_VALUE = 3, | 90 | MIN_HASH_VALUE = 3, |
91 | MAX_HASH_VALUE = 64 | 91 | MAX_HASH_VALUE = 66 |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static const struct resword wordlist[] = | 94 | static const struct resword wordlist[] = |
95 | { | 95 | { |
96 | {""}, {""}, {""}, | 96 | {""}, {""}, {""}, |
97 | #line 26 "scripts/genksyms/keywords.gperf" | 97 | #line 28 "scripts/genksyms/keywords.gperf" |
98 | {"asm", ASM_KEYW}, | 98 | {"asm", ASM_KEYW}, |
99 | {""}, | 99 | {""}, |
100 | #line 8 "scripts/genksyms/keywords.gperf" | 100 | #line 10 "scripts/genksyms/keywords.gperf" |
101 | {"__asm", ASM_KEYW}, | 101 | {"__asm", ASM_KEYW}, |
102 | {""}, | 102 | {""}, |
103 | #line 9 "scripts/genksyms/keywords.gperf" | 103 | #line 11 "scripts/genksyms/keywords.gperf" |
104 | {"__asm__", ASM_KEYW}, | 104 | {"__asm__", ASM_KEYW}, |
105 | {""}, {""}, | 105 | {""}, {""}, |
106 | #line 52 "scripts/genksyms/keywords.gperf" | 106 | #line 54 "scripts/genksyms/keywords.gperf" |
107 | {"__typeof__", TYPEOF_KEYW}, | 107 | {"__typeof__", TYPEOF_KEYW}, |
108 | {""}, | 108 | {""}, |
109 | #line 12 "scripts/genksyms/keywords.gperf" | 109 | #line 14 "scripts/genksyms/keywords.gperf" |
110 | {"__const", CONST_KEYW}, | 110 | {"__const", CONST_KEYW}, |
111 | #line 11 "scripts/genksyms/keywords.gperf" | ||
112 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
113 | #line 13 "scripts/genksyms/keywords.gperf" | 111 | #line 13 "scripts/genksyms/keywords.gperf" |
112 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
113 | #line 15 "scripts/genksyms/keywords.gperf" | ||
114 | {"__const__", CONST_KEYW}, | 114 | {"__const__", CONST_KEYW}, |
115 | #line 18 "scripts/genksyms/keywords.gperf" | 115 | #line 20 "scripts/genksyms/keywords.gperf" |
116 | {"__signed__", SIGNED_KEYW}, | 116 | {"__signed__", SIGNED_KEYW}, |
117 | #line 44 "scripts/genksyms/keywords.gperf" | 117 | #line 46 "scripts/genksyms/keywords.gperf" |
118 | {"static", STATIC_KEYW}, | 118 | {"static", STATIC_KEYW}, |
119 | #line 20 "scripts/genksyms/keywords.gperf" | 119 | {""}, |
120 | {"__volatile__", VOLATILE_KEYW}, | 120 | #line 41 "scripts/genksyms/keywords.gperf" |
121 | #line 39 "scripts/genksyms/keywords.gperf" | ||
122 | {"int", INT_KEYW}, | 121 | {"int", INT_KEYW}, |
123 | #line 32 "scripts/genksyms/keywords.gperf" | 122 | #line 34 "scripts/genksyms/keywords.gperf" |
124 | {"char", CHAR_KEYW}, | 123 | {"char", CHAR_KEYW}, |
125 | #line 33 "scripts/genksyms/keywords.gperf" | 124 | #line 35 "scripts/genksyms/keywords.gperf" |
126 | {"const", CONST_KEYW}, | 125 | {"const", CONST_KEYW}, |
127 | #line 45 "scripts/genksyms/keywords.gperf" | 126 | #line 47 "scripts/genksyms/keywords.gperf" |
128 | {"struct", STRUCT_KEYW}, | 127 | {"struct", STRUCT_KEYW}, |
129 | #line 24 "scripts/genksyms/keywords.gperf" | 128 | #line 26 "scripts/genksyms/keywords.gperf" |
130 | {"__restrict__", RESTRICT_KEYW}, | 129 | {"__restrict__", RESTRICT_KEYW}, |
131 | #line 25 "scripts/genksyms/keywords.gperf" | 130 | #line 27 "scripts/genksyms/keywords.gperf" |
132 | {"restrict", RESTRICT_KEYW}, | 131 | {"restrict", RESTRICT_KEYW}, |
133 | #line 23 "scripts/genksyms/keywords.gperf" | 132 | #line 7 "scripts/genksyms/keywords.gperf" |
134 | {"_restrict", RESTRICT_KEYW}, | 133 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, |
135 | #line 16 "scripts/genksyms/keywords.gperf" | 134 | #line 18 "scripts/genksyms/keywords.gperf" |
136 | {"__inline__", INLINE_KEYW}, | 135 | {"__inline__", INLINE_KEYW}, |
137 | #line 10 "scripts/genksyms/keywords.gperf" | ||
138 | {"__attribute", ATTRIBUTE_KEYW}, | ||
139 | {""}, | 136 | {""}, |
140 | #line 14 "scripts/genksyms/keywords.gperf" | 137 | #line 22 "scripts/genksyms/keywords.gperf" |
138 | {"__volatile__", VOLATILE_KEYW}, | ||
139 | #line 5 "scripts/genksyms/keywords.gperf" | ||
140 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | ||
141 | #line 25 "scripts/genksyms/keywords.gperf" | ||
142 | {"_restrict", RESTRICT_KEYW}, | ||
143 | {""}, | ||
144 | #line 12 "scripts/genksyms/keywords.gperf" | ||
145 | {"__attribute", ATTRIBUTE_KEYW}, | ||
146 | #line 6 "scripts/genksyms/keywords.gperf" | ||
147 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | ||
148 | #line 16 "scripts/genksyms/keywords.gperf" | ||
141 | {"__extension__", EXTENSION_KEYW}, | 149 | {"__extension__", EXTENSION_KEYW}, |
142 | #line 35 "scripts/genksyms/keywords.gperf" | 150 | #line 37 "scripts/genksyms/keywords.gperf" |
143 | {"enum", ENUM_KEYW}, | 151 | {"enum", ENUM_KEYW}, |
144 | #line 19 "scripts/genksyms/keywords.gperf" | 152 | #line 8 "scripts/genksyms/keywords.gperf" |
145 | {"__volatile", VOLATILE_KEYW}, | 153 | {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, |
146 | #line 36 "scripts/genksyms/keywords.gperf" | 154 | #line 38 "scripts/genksyms/keywords.gperf" |
147 | {"extern", EXTERN_KEYW}, | 155 | {"extern", EXTERN_KEYW}, |
148 | {""}, | 156 | {""}, |
149 | #line 17 "scripts/genksyms/keywords.gperf" | 157 | #line 19 "scripts/genksyms/keywords.gperf" |
150 | {"__signed", SIGNED_KEYW}, | 158 | {"__signed", SIGNED_KEYW}, |
151 | #line 7 "scripts/genksyms/keywords.gperf" | 159 | #line 9 "scripts/genksyms/keywords.gperf" |
152 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, | 160 | {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
153 | {""}, | 161 | #line 49 "scripts/genksyms/keywords.gperf" |
154 | #line 51 "scripts/genksyms/keywords.gperf" | 162 | {"union", UNION_KEYW}, |
163 | #line 53 "scripts/genksyms/keywords.gperf" | ||
155 | {"typeof", TYPEOF_KEYW}, | 164 | {"typeof", TYPEOF_KEYW}, |
156 | #line 46 "scripts/genksyms/keywords.gperf" | 165 | #line 48 "scripts/genksyms/keywords.gperf" |
157 | {"typedef", TYPEDEF_KEYW}, | 166 | {"typedef", TYPEDEF_KEYW}, |
158 | #line 15 "scripts/genksyms/keywords.gperf" | 167 | #line 17 "scripts/genksyms/keywords.gperf" |
159 | {"__inline", INLINE_KEYW}, | 168 | {"__inline", INLINE_KEYW}, |
160 | #line 31 "scripts/genksyms/keywords.gperf" | 169 | #line 33 "scripts/genksyms/keywords.gperf" |
161 | {"auto", AUTO_KEYW}, | 170 | {"auto", AUTO_KEYW}, |
162 | #line 47 "scripts/genksyms/keywords.gperf" | 171 | #line 21 "scripts/genksyms/keywords.gperf" |
163 | {"union", UNION_KEYW}, | 172 | {"__volatile", VOLATILE_KEYW}, |
164 | {""}, {""}, | ||
165 | #line 48 "scripts/genksyms/keywords.gperf" | ||
166 | {"unsigned", UNSIGNED_KEYW}, | ||
167 | #line 49 "scripts/genksyms/keywords.gperf" | ||
168 | {"void", VOID_KEYW}, | ||
169 | #line 42 "scripts/genksyms/keywords.gperf" | ||
170 | {"short", SHORT_KEYW}, | ||
171 | {""}, {""}, | 173 | {""}, {""}, |
172 | #line 50 "scripts/genksyms/keywords.gperf" | 174 | #line 50 "scripts/genksyms/keywords.gperf" |
173 | {"volatile", VOLATILE_KEYW}, | 175 | {"unsigned", UNSIGNED_KEYW}, |
174 | {""}, | ||
175 | #line 37 "scripts/genksyms/keywords.gperf" | ||
176 | {"float", FLOAT_KEYW}, | ||
177 | #line 34 "scripts/genksyms/keywords.gperf" | ||
178 | {"double", DOUBLE_KEYW}, | ||
179 | {""}, | 176 | {""}, |
180 | #line 5 "scripts/genksyms/keywords.gperf" | 177 | #line 44 "scripts/genksyms/keywords.gperf" |
181 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | 178 | {"short", SHORT_KEYW}, |
182 | {""}, {""}, | 179 | #line 40 "scripts/genksyms/keywords.gperf" |
183 | #line 38 "scripts/genksyms/keywords.gperf" | ||
184 | {"inline", INLINE_KEYW}, | 180 | {"inline", INLINE_KEYW}, |
185 | #line 6 "scripts/genksyms/keywords.gperf" | ||
186 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | ||
187 | #line 41 "scripts/genksyms/keywords.gperf" | ||
188 | {"register", REGISTER_KEYW}, | ||
189 | {""}, | 181 | {""}, |
190 | #line 22 "scripts/genksyms/keywords.gperf" | 182 | #line 52 "scripts/genksyms/keywords.gperf" |
183 | {"volatile", VOLATILE_KEYW}, | ||
184 | #line 42 "scripts/genksyms/keywords.gperf" | ||
185 | {"long", LONG_KEYW}, | ||
186 | #line 24 "scripts/genksyms/keywords.gperf" | ||
191 | {"_Bool", BOOL_KEYW}, | 187 | {"_Bool", BOOL_KEYW}, |
192 | #line 43 "scripts/genksyms/keywords.gperf" | ||
193 | {"signed", SIGNED_KEYW}, | ||
194 | {""}, {""}, | 188 | {""}, {""}, |
195 | #line 40 "scripts/genksyms/keywords.gperf" | 189 | #line 43 "scripts/genksyms/keywords.gperf" |
196 | {"long", LONG_KEYW} | 190 | {"register", REGISTER_KEYW}, |
191 | #line 51 "scripts/genksyms/keywords.gperf" | ||
192 | {"void", VOID_KEYW}, | ||
193 | #line 39 "scripts/genksyms/keywords.gperf" | ||
194 | {"float", FLOAT_KEYW}, | ||
195 | #line 36 "scripts/genksyms/keywords.gperf" | ||
196 | {"double", DOUBLE_KEYW}, | ||
197 | {""}, {""}, {""}, {""}, | ||
198 | #line 45 "scripts/genksyms/keywords.gperf" | ||
199 | {"signed", SIGNED_KEYW} | ||
197 | }; | 200 | }; |
198 | 201 | ||
199 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 202 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index 5ef3733225fb..8abe7ab8d88f 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf | |||
@@ -5,6 +5,8 @@ struct resword { const char *name; int token; } | |||
5 | EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW | 5 | EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW |
6 | EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW | 6 | EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW |
7 | EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW | 7 | EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW |
8 | EXPORT_UNUSED_SYMBOL, EXPORT_SYMBOL_KEYW | ||
9 | EXPORT_UNUSED_SYMBOL_GPL, EXPORT_SYMBOL_KEYW | ||
8 | __asm, ASM_KEYW | 10 | __asm, ASM_KEYW |
9 | __asm__, ASM_KEYW | 11 | __asm__, ASM_KEYW |
10 | __attribute, ATTRIBUTE_KEYW | 12 | __attribute, ATTRIBUTE_KEYW |
diff --git a/scripts/headerdep.pl b/scripts/headerdep.pl new file mode 100755 index 000000000000..97399da89ef2 --- /dev/null +++ b/scripts/headerdep.pl | |||
@@ -0,0 +1,193 @@ | |||
1 | #! /usr/bin/perl | ||
2 | # | ||
3 | # Detect cycles in the header file dependency graph | ||
4 | # Vegard Nossum <vegardno@ifi.uio.no> | ||
5 | # | ||
6 | |||
7 | use strict; | ||
8 | use warnings; | ||
9 | |||
10 | use Getopt::Long; | ||
11 | |||
12 | my $opt_all; | ||
13 | my @opt_include; | ||
14 | my $opt_graph; | ||
15 | |||
16 | &Getopt::Long::Configure(qw(bundling pass_through)); | ||
17 | &GetOptions( | ||
18 | help => \&help, | ||
19 | version => \&version, | ||
20 | |||
21 | all => \$opt_all, | ||
22 | I => \@opt_include, | ||
23 | graph => \$opt_graph, | ||
24 | ); | ||
25 | |||
26 | push @opt_include, 'include'; | ||
27 | my %deps = (); | ||
28 | my %linenos = (); | ||
29 | |||
30 | my @headers = grep { strip($_) } @ARGV; | ||
31 | |||
32 | parse_all(@headers); | ||
33 | |||
34 | if($opt_graph) { | ||
35 | graph(); | ||
36 | } else { | ||
37 | detect_cycles(@headers); | ||
38 | } | ||
39 | |||
40 | |||
41 | sub help { | ||
42 | print "Usage: $0 [options] file...\n"; | ||
43 | print "\n"; | ||
44 | print "Options:\n"; | ||
45 | print " --all\n"; | ||
46 | print " --graph\n"; | ||
47 | print "\n"; | ||
48 | print " -I includedir\n"; | ||
49 | print "\n"; | ||
50 | print "To make nice graphs, try:\n"; | ||
51 | print " $0 --graph include/linux/kernel.h | dot -Tpng -o graph.png\n"; | ||
52 | exit; | ||
53 | } | ||
54 | |||
55 | sub version { | ||
56 | print "headerdep version 2\n"; | ||
57 | exit; | ||
58 | } | ||
59 | |||
60 | # Get a file name that is relative to our include paths | ||
61 | sub strip { | ||
62 | my $filename = shift; | ||
63 | |||
64 | for my $i (@opt_include) { | ||
65 | my $stripped = $filename; | ||
66 | $stripped =~ s/^$i\///; | ||
67 | |||
68 | return $stripped if $stripped ne $filename; | ||
69 | } | ||
70 | |||
71 | return $filename; | ||
72 | } | ||
73 | |||
74 | # Search for the file name in the list of include paths | ||
75 | sub search { | ||
76 | my $filename = shift; | ||
77 | return $filename if -f $filename; | ||
78 | |||
79 | for my $i (@opt_include) { | ||
80 | my $path = "$i/$filename"; | ||
81 | return $path if -f $path; | ||
82 | } | ||
83 | |||
84 | return undef; | ||
85 | } | ||
86 | |||
87 | sub parse_all { | ||
88 | # Parse all the headers. | ||
89 | my @queue = @_; | ||
90 | while(@queue) { | ||
91 | my $header = pop @queue; | ||
92 | next if exists $deps{$header}; | ||
93 | |||
94 | $deps{$header} = [] unless exists $deps{$header}; | ||
95 | |||
96 | my $path = search($header); | ||
97 | next unless $path; | ||
98 | |||
99 | open(my $file, '<', $path) or die($!); | ||
100 | chomp(my @lines = <$file>); | ||
101 | close($file); | ||
102 | |||
103 | for my $i (0 .. $#lines) { | ||
104 | my $line = $lines[$i]; | ||
105 | if(my($dep) = ($line =~ m/^#\s*include\s*<(.*?)>/)) { | ||
106 | push @queue, $dep; | ||
107 | push @{$deps{$header}}, [$i + 1, $dep]; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | sub print_cycle { | ||
114 | # $cycle[n] includes $cycle[n + 1]; | ||
115 | # $cycle[-1] will be the culprit | ||
116 | my $cycle = shift; | ||
117 | |||
118 | # Adjust the line numbers | ||
119 | for my $i (0 .. $#$cycle - 1) { | ||
120 | $cycle->[$i]->[0] = $cycle->[$i + 1]->[0]; | ||
121 | } | ||
122 | $cycle->[-1]->[0] = 0; | ||
123 | |||
124 | my $first = shift @$cycle; | ||
125 | my $last = pop @$cycle; | ||
126 | |||
127 | my $msg = "In file included"; | ||
128 | printf "%s from %s,\n", $msg, $last->[1] if defined $last; | ||
129 | |||
130 | for my $header (reverse @$cycle) { | ||
131 | printf "%s from %s:%d%s\n", | ||
132 | " " x length $msg, | ||
133 | $header->[1], $header->[0], | ||
134 | $header->[1] eq $last->[1] ? ' <-- here' : ''; | ||
135 | } | ||
136 | |||
137 | printf "%s:%d: warning: recursive header inclusion\n", | ||
138 | $first->[1], $first->[0]; | ||
139 | } | ||
140 | |||
141 | # Find and print the smallest cycle starting in the specified node. | ||
142 | sub detect_cycles { | ||
143 | my @queue = map { [[0, $_]] } @_; | ||
144 | while(@queue) { | ||
145 | my $top = pop @queue; | ||
146 | my $name = $top->[-1]->[1]; | ||
147 | |||
148 | for my $dep (@{$deps{$name}}) { | ||
149 | my $chain = [@$top, [$dep->[0], $dep->[1]]]; | ||
150 | |||
151 | # If the dep already exists in the chain, we have a | ||
152 | # cycle... | ||
153 | if(grep { $_->[1] eq $dep->[1] } @$top) { | ||
154 | print_cycle($chain); | ||
155 | next if $opt_all; | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | push @queue, $chain; | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
164 | sub mangle { | ||
165 | $_ = shift; | ||
166 | s/\//__/g; | ||
167 | s/\./_/g; | ||
168 | s/-/_/g; | ||
169 | $_; | ||
170 | } | ||
171 | |||
172 | # Output dependency graph in GraphViz language. | ||
173 | sub graph { | ||
174 | print "digraph {\n"; | ||
175 | |||
176 | print "\t/* vertices */\n"; | ||
177 | for my $header (keys %deps) { | ||
178 | printf "\t%s [label=\"%s\"];\n", | ||
179 | mangle($header), $header; | ||
180 | } | ||
181 | |||
182 | print "\n"; | ||
183 | |||
184 | print "\t/* edges */\n"; | ||
185 | for my $header (keys %deps) { | ||
186 | for my $dep (@{$deps{$header}}) { | ||
187 | printf "\t%s -> %s;\n", | ||
188 | mangle($header), mangle($dep->[1]); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | print "}\n"; | ||
193 | } | ||
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ad2434b26970..92758120a767 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -130,18 +130,9 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
130 | static int symbol_valid(struct sym_entry *s) | 130 | static int symbol_valid(struct sym_entry *s) |
131 | { | 131 | { |
132 | /* Symbols which vary between passes. Passes 1 and 2 must have | 132 | /* Symbols which vary between passes. Passes 1 and 2 must have |
133 | * identical symbol lists. The kallsyms_* symbols below are only added | 133 | * identical symbol lists. |
134 | * after pass 1, they would be included in pass 2 when --all-symbols is | ||
135 | * specified so exclude them to get a stable symbol list. | ||
136 | */ | 134 | */ |
137 | static char *special_symbols[] = { | 135 | static char *special_symbols[] = { |
138 | "kallsyms_addresses", | ||
139 | "kallsyms_num_syms", | ||
140 | "kallsyms_names", | ||
141 | "kallsyms_markers", | ||
142 | "kallsyms_token_table", | ||
143 | "kallsyms_token_index", | ||
144 | |||
145 | /* Exclude linker generated symbols which vary between passes */ | 136 | /* Exclude linker generated symbols which vary between passes */ |
146 | "_SDA_BASE_", /* ppc */ | 137 | "_SDA_BASE_", /* ppc */ |
147 | "_SDA2_BASE_", /* ppc */ | 138 | "_SDA2_BASE_", /* ppc */ |
@@ -173,7 +164,9 @@ static int symbol_valid(struct sym_entry *s) | |||
173 | } | 164 | } |
174 | 165 | ||
175 | /* Exclude symbols which vary between passes. */ | 166 | /* Exclude symbols which vary between passes. */ |
176 | if (strstr((char *)s->sym + offset, "_compiled.")) | 167 | if (strstr((char *)s->sym + offset, "_compiled.") || |
168 | strncmp((char*)s->sym + offset, "__compound_literal.", 19) == 0 || | ||
169 | strncmp((char*)s->sym + offset, "__compound_literal$", 19) == 0) | ||
177 | return 0; | 170 | return 0; |
178 | 171 | ||
179 | for (i = 0; special_symbols[i]; i++) | 172 | for (i = 0; special_symbols[i]; i++) |
@@ -550,8 +543,10 @@ int main(int argc, char **argv) | |||
550 | usage(); | 543 | usage(); |
551 | 544 | ||
552 | read_map(stdin); | 545 | read_map(stdin); |
553 | sort_symbols(); | 546 | if (table_cnt) { |
554 | optimize_token_table(); | 547 | sort_symbols(); |
548 | optimize_token_table(); | ||
549 | } | ||
555 | write_src(); | 550 | write_src(); |
556 | 551 | ||
557 | return 0; | 552 | return 0; |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 5552154cbedb..fcef0f59d553 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -52,7 +52,7 @@ EOF | |||
52 | } | 52 | } |
53 | 53 | ||
54 | usage() { | 54 | usage() { |
55 | printf "Usage: $0 [-check compiler options|-header|-library]\n" | 55 | printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" |
56 | } | 56 | } |
57 | 57 | ||
58 | if [ $# -eq 0 ]; then | 58 | if [ $# -eq 0 ]; then |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index d27aad78e1d8..8bb83a100edb 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -289,6 +289,8 @@ my %parameterdescs; | |||
289 | my @parameterlist; | 289 | my @parameterlist; |
290 | my %sections; | 290 | my %sections; |
291 | my @sectionlist; | 291 | my @sectionlist; |
292 | my $sectcheck; | ||
293 | my $struct_actual; | ||
292 | 294 | ||
293 | my $contents = ""; | 295 | my $contents = ""; |
294 | my $section_default = "Description"; # default section | 296 | my $section_default = "Description"; # default section |
@@ -378,10 +380,12 @@ sub dump_section { | |||
378 | # print STDERR "parameter def '$1' = '$contents'\n"; | 380 | # print STDERR "parameter def '$1' = '$contents'\n"; |
379 | $name = $1; | 381 | $name = $1; |
380 | $parameterdescs{$name} = $contents; | 382 | $parameterdescs{$name} = $contents; |
383 | $sectcheck = $sectcheck . $name . " "; | ||
381 | } elsif ($name eq "@\.\.\.") { | 384 | } elsif ($name eq "@\.\.\.") { |
382 | # print STDERR "parameter def '...' = '$contents'\n"; | 385 | # print STDERR "parameter def '...' = '$contents'\n"; |
383 | $name = "..."; | 386 | $name = "..."; |
384 | $parameterdescs{$name} = $contents; | 387 | $parameterdescs{$name} = $contents; |
388 | $sectcheck = $sectcheck . $name . " "; | ||
385 | } else { | 389 | } else { |
386 | # print STDERR "other section '$name' = '$contents'\n"; | 390 | # print STDERR "other section '$name' = '$contents'\n"; |
387 | if (defined($sections{$name}) && ($sections{$name} ne "")) { | 391 | if (defined($sections{$name}) && ($sections{$name} ne "")) { |
@@ -1405,21 +1409,25 @@ sub dump_union($$) { | |||
1405 | sub dump_struct($$) { | 1409 | sub dump_struct($$) { |
1406 | my $x = shift; | 1410 | my $x = shift; |
1407 | my $file = shift; | 1411 | my $file = shift; |
1412 | my $nested; | ||
1408 | 1413 | ||
1409 | if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { | 1414 | if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { |
1410 | $declaration_name = $2; | 1415 | $declaration_name = $2; |
1411 | my $members = $3; | 1416 | my $members = $3; |
1412 | 1417 | ||
1413 | # ignore embedded structs or unions | 1418 | # ignore embedded structs or unions |
1414 | $members =~ s/{.*}//g; | 1419 | $members =~ s/({.*})//g; |
1420 | $nested = $1; | ||
1415 | 1421 | ||
1416 | # ignore members marked private: | 1422 | # ignore members marked private: |
1417 | $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; | 1423 | $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; |
1418 | $members =~ s/\/\*.*?private:.*//gos; | 1424 | $members =~ s/\/\*.*?private:.*//gos; |
1419 | # strip comments: | 1425 | # strip comments: |
1420 | $members =~ s/\/\*.*?\*\///gos; | 1426 | $members =~ s/\/\*.*?\*\///gos; |
1427 | $nested =~ s/\/\*.*?\*\///gos; | ||
1421 | 1428 | ||
1422 | create_parameterlist($members, ';', $file); | 1429 | create_parameterlist($members, ';', $file); |
1430 | check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); | ||
1423 | 1431 | ||
1424 | output_declaration($declaration_name, | 1432 | output_declaration($declaration_name, |
1425 | 'struct', | 1433 | 'struct', |
@@ -1505,6 +1513,14 @@ sub dump_typedef($$) { | |||
1505 | } | 1513 | } |
1506 | } | 1514 | } |
1507 | 1515 | ||
1516 | sub save_struct_actual($) { | ||
1517 | my $actual = shift; | ||
1518 | |||
1519 | # strip all spaces from the actual param so that it looks like one string item | ||
1520 | $actual =~ s/\s*//g; | ||
1521 | $struct_actual = $struct_actual . $actual . " "; | ||
1522 | } | ||
1523 | |||
1508 | sub create_parameterlist($$$) { | 1524 | sub create_parameterlist($$$) { |
1509 | my $args = shift; | 1525 | my $args = shift; |
1510 | my $splitter = shift; | 1526 | my $splitter = shift; |
@@ -1537,6 +1553,7 @@ sub create_parameterlist($$$) { | |||
1537 | $param = $1; | 1553 | $param = $1; |
1538 | $type = $arg; | 1554 | $type = $arg; |
1539 | $type =~ s/([^\(]+\(\*?)\s*$param/$1/; | 1555 | $type =~ s/([^\(]+\(\*?)\s*$param/$1/; |
1556 | save_struct_actual($param); | ||
1540 | push_parameter($param, $type, $file); | 1557 | push_parameter($param, $type, $file); |
1541 | } elsif ($arg) { | 1558 | } elsif ($arg) { |
1542 | $arg =~ s/\s*:\s*/:/g; | 1559 | $arg =~ s/\s*:\s*/:/g; |
@@ -1561,14 +1578,17 @@ sub create_parameterlist($$$) { | |||
1561 | 1578 | ||
1562 | foreach $param (@args) { | 1579 | foreach $param (@args) { |
1563 | if ($param =~ m/^(\*+)\s*(.*)/) { | 1580 | if ($param =~ m/^(\*+)\s*(.*)/) { |
1581 | save_struct_actual($2); | ||
1564 | push_parameter($2, "$type $1", $file); | 1582 | push_parameter($2, "$type $1", $file); |
1565 | } | 1583 | } |
1566 | elsif ($param =~ m/(.*?):(\d+)/) { | 1584 | elsif ($param =~ m/(.*?):(\d+)/) { |
1567 | if ($type ne "") { # skip unnamed bit-fields | 1585 | if ($type ne "") { # skip unnamed bit-fields |
1586 | save_struct_actual($1); | ||
1568 | push_parameter($1, "$type:$2", $file) | 1587 | push_parameter($1, "$type:$2", $file) |
1569 | } | 1588 | } |
1570 | } | 1589 | } |
1571 | else { | 1590 | else { |
1591 | save_struct_actual($param); | ||
1572 | push_parameter($param, $type, $file); | 1592 | push_parameter($param, $type, $file); |
1573 | } | 1593 | } |
1574 | } | 1594 | } |
@@ -1634,6 +1654,46 @@ sub push_parameter($$$) { | |||
1634 | $parametertypes{$param} = $type; | 1654 | $parametertypes{$param} = $type; |
1635 | } | 1655 | } |
1636 | 1656 | ||
1657 | sub check_sections($$$$$$) { | ||
1658 | my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck, $nested) = @_; | ||
1659 | my @sects = split ' ', $sectcheck; | ||
1660 | my @prms = split ' ', $prmscheck; | ||
1661 | my $err; | ||
1662 | my ($px, $sx); | ||
1663 | my $prm_clean; # strip trailing "[array size]" and/or beginning "*" | ||
1664 | |||
1665 | foreach $sx (0 .. $#sects) { | ||
1666 | $err = 1; | ||
1667 | foreach $px (0 .. $#prms) { | ||
1668 | $prm_clean = $prms[$px]; | ||
1669 | $prm_clean =~ s/\[.*\]//; | ||
1670 | $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//; | ||
1671 | ##$prm_clean =~ s/^\**//; | ||
1672 | if ($prm_clean eq $sects[$sx]) { | ||
1673 | $err = 0; | ||
1674 | last; | ||
1675 | } | ||
1676 | } | ||
1677 | if ($err) { | ||
1678 | if ($decl_type eq "function") { | ||
1679 | print STDERR "Warning(${file}:$.): " . | ||
1680 | "Excess function parameter " . | ||
1681 | "'$sects[$sx]' " . | ||
1682 | "description in '$decl_name'\n"; | ||
1683 | ++$warnings; | ||
1684 | } else { | ||
1685 | if ($nested !~ m/\Q$sects[$sx]\E/) { | ||
1686 | print STDERR "Warning(${file}:$.): " . | ||
1687 | "Excess struct/union/enum/typedef member " . | ||
1688 | "'$sects[$sx]' " . | ||
1689 | "description in '$decl_name'\n"; | ||
1690 | ++$warnings; | ||
1691 | } | ||
1692 | } | ||
1693 | } | ||
1694 | } | ||
1695 | } | ||
1696 | |||
1637 | ## | 1697 | ## |
1638 | # takes a function prototype and the name of the current file being | 1698 | # takes a function prototype and the name of the current file being |
1639 | # processed and spits out all the details stored in the global | 1699 | # processed and spits out all the details stored in the global |
@@ -1699,6 +1759,9 @@ sub dump_function($$) { | |||
1699 | return; | 1759 | return; |
1700 | } | 1760 | } |
1701 | 1761 | ||
1762 | my $prms = join " ", @parameterlist; | ||
1763 | check_sections($file, $declaration_name, "function", $sectcheck, $prms, ""); | ||
1764 | |||
1702 | output_declaration($declaration_name, | 1765 | output_declaration($declaration_name, |
1703 | 'function', | 1766 | 'function', |
1704 | {'function' => $declaration_name, | 1767 | {'function' => $declaration_name, |
@@ -1757,6 +1820,8 @@ sub reset_state { | |||
1757 | @parameterlist = (); | 1820 | @parameterlist = (); |
1758 | %sections = (); | 1821 | %sections = (); |
1759 | @sectionlist = (); | 1822 | @sectionlist = (); |
1823 | $sectcheck = ""; | ||
1824 | $struct_actual = ""; | ||
1760 | $prototype = ""; | 1825 | $prototype = ""; |
1761 | 1826 | ||
1762 | $state = 0; | 1827 | $state = 0; |
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index a8740df07b09..6a12dd9f1181 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h | |||
@@ -4,6 +4,8 @@ SMP=$3 | |||
4 | PREEMPT=$4 | 4 | PREEMPT=$4 |
5 | CC=$5 | 5 | CC=$5 |
6 | 6 | ||
7 | vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } | ||
8 | |||
7 | # If compile.h exists already and we don't own autoconf.h | 9 | # If compile.h exists already and we don't own autoconf.h |
8 | # (i.e. we're not the same user who did make *config), don't | 10 | # (i.e. we're not the same user who did make *config), don't |
9 | # modify compile.h | 11 | # modify compile.h |
@@ -11,7 +13,7 @@ CC=$5 | |||
11 | # do "compiled by root" | 13 | # do "compiled by root" |
12 | 14 | ||
13 | if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then | 15 | if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then |
14 | echo " SKIPPED $TARGET" | 16 | vecho " SKIPPED $TARGET" |
15 | exit 0 | 17 | exit 0 |
16 | fi | 18 | fi |
17 | 19 | ||
@@ -89,7 +91,7 @@ if [ -r $TARGET ] && \ | |||
89 | cmp -s .tmpver.1 .tmpver.2; then | 91 | cmp -s .tmpver.1 .tmpver.2; then |
90 | rm -f .tmpcompile | 92 | rm -f .tmpcompile |
91 | else | 93 | else |
92 | echo " UPD $TARGET" | 94 | vecho " UPD $TARGET" |
93 | mv -f .tmpcompile $TARGET | 95 | mv -f .tmpcompile $TARGET |
94 | fi | 96 | fi |
95 | rm -f .tmpver.1 .tmpver.2 | 97 | rm -f .tmpver.1 .tmpver.2 |
diff --git a/scripts/mkmakefile b/scripts/mkmakefile index e65d8b33faa4..67d59c7a18dc 100644 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile | |||
@@ -17,7 +17,9 @@ if test -e $2/Makefile && ! grep -q Automatically $2/Makefile | |||
17 | then | 17 | then |
18 | exit 0 | 18 | exit 0 |
19 | fi | 19 | fi |
20 | echo " GEN $2/Makefile" | 20 | if [ "${quiet}" != "silent_" ]; then |
21 | echo " GEN $2/Makefile" | ||
22 | fi | ||
21 | 23 | ||
22 | cat << EOF > $2/Makefile | 24 | cat << EOF > $2/Makefile |
23 | # Automatically generated by $0: don't edit | 25 | # Automatically generated by $0: don't edit |
diff --git a/scripts/mksysmap b/scripts/mksysmap index 6e133a0bae7a..1db316a3712b 100644 --- a/scripts/mksysmap +++ b/scripts/mksysmap | |||
@@ -37,9 +37,6 @@ | |||
37 | 37 | ||
38 | # readprofile starts reading symbols when _stext is found, and | 38 | # readprofile starts reading symbols when _stext is found, and |
39 | # continue until it finds a symbol which is not either of 'T', 't', | 39 | # continue until it finds a symbol which is not either of 'T', 't', |
40 | # 'W' or 'w'. __crc_ are 'A' and placed in the middle | 40 | # 'W' or 'w'. |
41 | # so we just ignore them to let readprofile continue to work. | ||
42 | # (At least sparc64 has __crc_ in the middle). | ||
43 | |||
44 | $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2 | ||
45 | 41 | ||
42 | $NM -n $1 | grep -v '\( [aNUw] \)\|\( \$[adt]\)' > $2 | ||
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 5e326078a4a2..8c6b7b09606a 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -1,10 +1,6 @@ | |||
1 | # Makefile for the different targets used to generate full packages of a kernel | 1 | # Makefile for the different targets used to generate full packages of a kernel |
2 | # It uses the generic clean infrastructure of kbuild | 2 | # It uses the generic clean infrastructure of kbuild |
3 | 3 | ||
4 | # Ignore the following files/directories during tar operation | ||
5 | TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS | ||
6 | |||
7 | |||
8 | # RPM target | 4 | # RPM target |
9 | # --------------------------------------------------------------------------- | 5 | # --------------------------------------------------------------------------- |
10 | # The rpm target generates two rpm files: | 6 | # The rpm target generates two rpm files: |
@@ -47,7 +43,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE | |||
47 | set -e; \ | 43 | set -e; \ |
48 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 44 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
49 | 45 | ||
50 | $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz | 46 | $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz |
51 | rm ../$(KERNELPATH).tar.gz | 47 | rm ../$(KERNELPATH).tar.gz |
52 | 48 | ||
53 | clean-files := $(objtree)/kernel.spec | 49 | clean-files := $(objtree)/kernel.spec |
@@ -64,7 +60,8 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE | |||
64 | set -e; \ | 60 | set -e; \ |
65 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 61 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
66 | 62 | ||
67 | $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $< | 63 | $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ |
64 | $(UTS_MACHINE) -bb $< | ||
68 | 65 | ||
69 | clean-files += $(objtree)/binkernel.spec | 66 | clean-files += $(objtree)/binkernel.spec |
70 | 67 | ||
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 72d233528ade..f6946cf99ce1 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -19,6 +19,11 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | |||
19 | fi | 19 | fi |
20 | fi | 20 | fi |
21 | 21 | ||
22 | # Is this git on svn? | ||
23 | if git config --get svn-remote.svn.url >/dev/null; then | ||
24 | printf -- '-svn%s' "`git-svn find-rev $head`" | ||
25 | fi | ||
26 | |||
22 | # Are there uncommitted changes? | 27 | # Are there uncommitted changes? |
23 | git update-index --refresh --unmerged > /dev/null | 28 | git update-index --refresh --unmerged > /dev/null |
24 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | 29 | if git diff-index --name-only HEAD | grep -v "^scripts/package" \ |
@@ -51,7 +56,7 @@ if hgid=`hg id 2>/dev/null`; then | |||
51 | fi | 56 | fi |
52 | 57 | ||
53 | # Check for svn and a svn repo. | 58 | # Check for svn and a svn repo. |
54 | if rev=`svn info 2>/dev/null | grep '^Revision'`; then | 59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
55 | rev=`echo $rev | awk '{print $NF}'` | 60 | rev=`echo $rev | awk '{print $NF}'` |
56 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` | 61 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` |
57 | 62 | ||
diff --git a/scripts/strip-symbols b/scripts/strip-symbols new file mode 100644 index 000000000000..29ee8c1a014b --- /dev/null +++ b/scripts/strip-symbols | |||
@@ -0,0 +1,22 @@ | |||
1 | <*> | ||
2 | *.h | ||
3 | __compound_literal[$.][0-9]* | ||
4 | __crc_[a-zA-Z_]* | ||
5 | __exitcall_[a-zA-Z_]* | ||
6 | __func__[$.][0-9]* | ||
7 | __FUNCTION__[$.][0-9]* | ||
8 | gcc[0-9]_compiled[$.] | ||
9 | __initcall_[a-zA-Z_]* | ||
10 | __kcrctab_[a-zA-Z_]* | ||
11 | __kstrtab_[a-zA-Z_]* | ||
12 | __ksymtab_[a-zA-Z_]* | ||
13 | __mod_[a-zA-Z_]*[0-9] | ||
14 | __module_depends | ||
15 | __param_[a-zA-Z_]* | ||
16 | __pci_fixup_*PCI_ANY_IDPCI_ANY_ID* | ||
17 | __pci_fixup_*PCI_ANY_IDPCI_DEVICE_ID_* | ||
18 | __pci_fixup_*PCI_VENDOR_ID_*PCI_ANY_ID* | ||
19 | __pci_fixup_*PCI_VENDOR_ID_*PCI_DEVICE_ID_* | ||
20 | __PRETTY_FUNCTION__[$.][0-9]* | ||
21 | __setup_[a-zA-Z_]* | ||
22 | ____versions | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh new file mode 100755 index 000000000000..4e7547209852 --- /dev/null +++ b/scripts/tags.sh | |||
@@ -0,0 +1,160 @@ | |||
1 | #!/bin/sh | ||
2 | # Generate tags or cscope files | ||
3 | # Usage tags.sh <mode> | ||
4 | # | ||
5 | # mode may be any of: tags, TAGS, cscope | ||
6 | # | ||
7 | # Uses the following environment variables: | ||
8 | # ARCH, SUBARCH, srctree, src, obj | ||
9 | |||
10 | if [ "$KBUILD_VERBOSE" = "1" ]; then | ||
11 | set -x | ||
12 | fi | ||
13 | |||
14 | # This is a duplicate of RCS_FIND_IGNORE without escaped '()' | ||
15 | ignore="( -name SCCS -o -name BitKeeper -o -name .svn -o \ | ||
16 | -name CVS -o -name .pc -o -name .hg -o \ | ||
17 | -name .git ) \ | ||
18 | -prune -o" | ||
19 | |||
20 | # Do not use full path is we do not use O=.. builds | ||
21 | if [ "${KBUILD_SRC}" = "" ]; then | ||
22 | tree= | ||
23 | else | ||
24 | tree=${srctree}/ | ||
25 | fi | ||
26 | |||
27 | # find sources in arch/$ARCH | ||
28 | find_arch_sources() | ||
29 | { | ||
30 | find ${tree}arch/$1 $ignore -name "$2" -print; | ||
31 | } | ||
32 | |||
33 | # find sources in arch/$1/include | ||
34 | find_arch_include_sources() | ||
35 | { | ||
36 | find ${tree}arch/$1/include $ignore -name "$2" -print; | ||
37 | } | ||
38 | |||
39 | # find sources in include/ | ||
40 | find_include_sources() | ||
41 | { | ||
42 | find ${tree}include $ignore -name config -prune -o -name "$1" -print; | ||
43 | } | ||
44 | |||
45 | # find sources in rest of tree | ||
46 | # we could benefit from a list of dirs to search in here | ||
47 | find_other_sources() | ||
48 | { | ||
49 | find ${tree}* $ignore \ | ||
50 | \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ | ||
51 | -name "$1" -print; | ||
52 | } | ||
53 | |||
54 | find_sources() | ||
55 | { | ||
56 | find_arch_sources $1 "$2" | ||
57 | find_include_sources "$2" | ||
58 | find_other_sources "$2" | ||
59 | } | ||
60 | |||
61 | all_sources() | ||
62 | { | ||
63 | find_sources $SRCARCH '*.[chS]' | ||
64 | if [ ! -z "$archinclude" ]; then | ||
65 | find_arch_include_sources $archinclude '*.[chS]' | ||
66 | fi | ||
67 | } | ||
68 | |||
69 | all_kconfigs() | ||
70 | { | ||
71 | find_sources $SRCARCH 'Kconfig*' | ||
72 | } | ||
73 | |||
74 | all_defconfigs() | ||
75 | { | ||
76 | find_sources $SRCARCH "defconfig" | ||
77 | } | ||
78 | |||
79 | docscope() | ||
80 | { | ||
81 | (echo \-k; echo \-q; all_sources) > cscope.files | ||
82 | cscope -b -f cscope.out | ||
83 | } | ||
84 | |||
85 | exuberant() | ||
86 | { | ||
87 | all_sources > all | ||
88 | all_sources | xargs $1 -a \ | ||
89 | -I __initdata,__exitdata,__acquires,__releases \ | ||
90 | -I __read_mostly,____cacheline_aligned \ | ||
91 | -I ____cacheline_aligned_in_smp \ | ||
92 | -I ____cacheline_internodealigned_in_smp \ | ||
93 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
94 | --extra=+f --c-kinds=+px \ | ||
95 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' | ||
96 | |||
97 | all_kconfigs | xargs $1 -a \ | ||
98 | --langdef=kconfig --language-force=kconfig \ | ||
99 | --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/' | ||
100 | |||
101 | all_kconfigs | xargs $1 -a \ | ||
102 | --langdef=kconfig --language-force=kconfig \ | ||
103 | --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/CONFIG_\2/' | ||
104 | |||
105 | all_defconfigs | xargs -r $1 -a \ | ||
106 | --langdef=dotconfig --language-force=dotconfig \ | ||
107 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' | ||
108 | |||
109 | } | ||
110 | |||
111 | emacs() | ||
112 | { | ||
113 | all_sources | xargs $1 -a | ||
114 | |||
115 | all_kconfigs | xargs $1 -a \ | ||
116 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | ||
117 | |||
118 | all_kconfigs | xargs $1 -a \ | ||
119 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/CONFIG_\3/' | ||
120 | |||
121 | all_defconfigs | xargs -r $1 -a \ | ||
122 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/' | ||
123 | } | ||
124 | |||
125 | xtags() | ||
126 | { | ||
127 | if $1 --version 2>&1 | grep -iq exuberant; then | ||
128 | exuberant $1 | ||
129 | elif $1 --version 2>&1 | grep -iq emacs; then | ||
130 | emacs $1 | ||
131 | else | ||
132 | all_sources | xargs $1 -a | ||
133 | fi | ||
134 | } | ||
135 | |||
136 | |||
137 | # Support um (which uses SUBARCH) | ||
138 | if [ "${ARCH}" = "um" ]; then | ||
139 | if [ "$SUBARCH" = "i386" ]; then | ||
140 | archinclude=x86 | ||
141 | elif [ "$SUBARCH" = "x86_64" ]; then | ||
142 | archinclude=x86 | ||
143 | else | ||
144 | archinclude=${SUBARCH} | ||
145 | fi | ||
146 | fi | ||
147 | |||
148 | case "$1" in | ||
149 | "cscope") | ||
150 | docscope | ||
151 | ;; | ||
152 | |||
153 | "tags") | ||
154 | xtags ctags | ||
155 | ;; | ||
156 | |||
157 | "TAGS") | ||
158 | xtags etags | ||
159 | ;; | ||
160 | esac | ||
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index 7abc07f0fcd2..f1d3fe34176a 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c | |||
@@ -370,6 +370,30 @@ error: | |||
370 | return rc; | 370 | return rc; |
371 | } | 371 | } |
372 | 372 | ||
373 | static char *cpio_replace_env(char *new_location) | ||
374 | { | ||
375 | char expanded[PATH_MAX + 1]; | ||
376 | char env_var[PATH_MAX + 1]; | ||
377 | char *start; | ||
378 | char *end; | ||
379 | |||
380 | for (start = NULL; (start = strstr(new_location, "${")); ) { | ||
381 | end = strchr(start, '}'); | ||
382 | if (start < end) { | ||
383 | *env_var = *expanded = '\0'; | ||
384 | strncat(env_var, start + 2, end - start - 2); | ||
385 | strncat(expanded, new_location, start - new_location); | ||
386 | strncat(expanded, getenv(env_var), PATH_MAX); | ||
387 | strncat(expanded, end + 1, PATH_MAX); | ||
388 | strncpy(new_location, expanded, PATH_MAX); | ||
389 | } else | ||
390 | break; | ||
391 | } | ||
392 | |||
393 | return new_location; | ||
394 | } | ||
395 | |||
396 | |||
373 | static int cpio_mkfile_line(const char *line) | 397 | static int cpio_mkfile_line(const char *line) |
374 | { | 398 | { |
375 | char name[PATH_MAX + 1]; | 399 | char name[PATH_MAX + 1]; |
@@ -415,7 +439,8 @@ static int cpio_mkfile_line(const char *line) | |||
415 | } else { | 439 | } else { |
416 | dname = name; | 440 | dname = name; |
417 | } | 441 | } |
418 | rc = cpio_mkfile(dname, location, mode, uid, gid, nlinks); | 442 | rc = cpio_mkfile(dname, cpio_replace_env(location), |
443 | mode, uid, gid, nlinks); | ||
419 | fail: | 444 | fail: |
420 | if (dname_len) free(dname); | 445 | if (dname_len) free(dname); |
421 | return rc; | 446 | return rc; |
@@ -439,6 +464,7 @@ void usage(const char *prog) | |||
439 | "\n" | 464 | "\n" |
440 | "<name> name of the file/dir/nod/etc in the archive\n" | 465 | "<name> name of the file/dir/nod/etc in the archive\n" |
441 | "<location> location of the file in the current filesystem\n" | 466 | "<location> location of the file in the current filesystem\n" |
467 | " expands shell variables quoted with ${}\n" | ||
442 | "<target> link target\n" | 468 | "<target> link target\n" |
443 | "<mode> mode/permissions of the file\n" | 469 | "<mode> mode/permissions of the file\n" |
444 | "<uid> user id (0=root)\n" | 470 | "<uid> user id (0=root)\n" |