Commit 1e2795a1191bb5ff05e80d77feffd51ac875c06d

Authored by Artem Bityutskiy
Committed by Michal Marek
1 parent 71a83ec7da

kbuild: move KALLSYMS_EXTRA_PASS from Kconfig to Makefile

At the moment we have the CONFIG_KALLSYMS_EXTRA_PASS Kconfig switch,
which users can enable or disable while configuring the kernel. This
option is then used by 'make' to determine whether an extra kallsyms
pass is needed or not.

However, this approach is not nice and confusing, and this patch moves
CONFIG_KALLSYMS_EXTRA_PASS from Kconfig to Makefile instead. The
rationale is below.

1. CONFIG_KALLSYMS_EXTRA_PASS is really about the build time, not
   run-time. There is no real need for it to be in Kconfig. It is
   just an additional work-around which should be used only in rare
   cases, when someone breaks kallsyms, so Kbuild/Makefile is much
   better place for this option.
2. Grepping CONFIG_KALLSYMS_EXTRA_PASS shows that many defconfigs have
   it enabled, probably not because they try to work-around a kallsyms
   bug, but just because the Kconfig help text is confusing and does
   not really make it clear that this option should not be used unless
   except when kallsyms is broken.
3. And since many people have CONFIG_KALLSYMS_EXTRA_PASS enabled in
   their Kconfig, we do might fail to notice kallsyms bugs in time. E.g.,
   many testers use "make allyesconfig" to test builds, which will enable
   CONFIG_KALLSYMS_EXTRA_PASS and kallsyms breakage will not be noticed.

To address that, this patch:

1. Kills CONFIG_KALLSYMS_EXTRA_PASS
2. Changes Makefile so that people can use "make KALLSYMS_EXTRA_PASS=1"
   to enable the extra pass if needed. Additionally, they may define
   KALLSYMS_EXTRA_PASS as an environment variable.
3. By default KALLSYMS_EXTRA_PASS is disabled and if kallsyms has issues,
   "make" should print a warning and suggest using KALLSYMS_EXTRA_PASS

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
[mmarek: Removed make help text, is not necessary]
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 2 changed files with 8 additions and 17 deletions Side-by-side Diff

... ... @@ -797,16 +797,18 @@
797 797 # o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
798 798 # o Verify that the System.map from vmlinux matches the map from
799 799 # .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
800   -# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
  800 +# o If 'make KALLSYMS_EXTRA_PASS=1" was used, do an extra pass using
801 801 # .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a
802 802 # temporary bypass to allow the kernel to be built while the
803 803 # maintainers work out what went wrong with kallsyms.
804 804  
805   -ifdef CONFIG_KALLSYMS_EXTRA_PASS
806   -last_kallsyms := 3
807   -else
808 805 last_kallsyms := 2
  806 +
  807 +ifdef KALLSYMS_EXTRA_PASS
  808 +ifneq ($(KALLSYMS_EXTRA_PASS),0)
  809 +last_kallsyms := 3
809 810 endif
  811 +endif
810 812  
811 813 kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
812 814  
... ... @@ -816,7 +818,8 @@
816 818 $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
817 819 $(Q)cmp -s System.map .tmp_System.map || \
818 820 (echo Inconsistent kallsyms data; \
819   - echo Try setting CONFIG_KALLSYMS_EXTRA_PASS; \
  821 + echo This is a bug - please report about it; \
  822 + echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround; \
820 823 rm .tmp_kallsyms* ; /bin/false )
821 824 endef
822 825  
... ... @@ -981,18 +981,6 @@
981 981  
982 982 Say N unless you really need all symbols.
983 983  
984   -config KALLSYMS_EXTRA_PASS
985   - bool "Do an extra kallsyms pass"
986   - depends on KALLSYMS
987   - help
988   - If kallsyms is not working correctly, the build will fail with
989   - inconsistent kallsyms data. If that occurs, log a bug report and
990   - turn on KALLSYMS_EXTRA_PASS which should result in a stable build.
991   - Always say N here unless you find a bug in kallsyms, which must be
992   - reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while
993   - you wait for kallsyms to be fixed.
994   -
995   -
996 984 config HOTPLUG
997 985 bool "Support for hot-pluggable devices" if EXPERT
998 986 default y