1. 28 6月, 2018 1 次提交
  2. 24 6月, 2018 1 次提交
  3. 17 6月, 2018 1 次提交
  4. 14 6月, 2018 1 次提交
    • L
      Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables · 050e9baa
      Linus Torvalds 提交于
      The changes to automatically test for working stack protector compiler
      support in the Kconfig files removed the special STACKPROTECTOR_AUTO
      option that picked the strongest stack protector that the compiler
      supported.
      
      That was all a nice cleanup - it makes no sense to have the AUTO case
      now that the Kconfig phase can just determine the compiler support
      directly.
      
      HOWEVER.
      
      It also meant that doing "make oldconfig" would now _disable_ the strong
      stackprotector if you had AUTO enabled, because in a legacy config file,
      the sane stack protector configuration would look like
      
        CONFIG_HAVE_CC_STACKPROTECTOR=y
        # CONFIG_CC_STACKPROTECTOR_NONE is not set
        # CONFIG_CC_STACKPROTECTOR_REGULAR is not set
        # CONFIG_CC_STACKPROTECTOR_STRONG is not set
        CONFIG_CC_STACKPROTECTOR_AUTO=y
      
      and when you ran this through "make oldconfig" with the Kbuild changes,
      it would ask you about the regular CONFIG_CC_STACKPROTECTOR (that had
      been renamed from CONFIG_CC_STACKPROTECTOR_REGULAR to just
      CONFIG_CC_STACKPROTECTOR), but it would think that the STRONG version
      used to be disabled (because it was really enabled by AUTO), and would
      disable it in the new config, resulting in:
      
        CONFIG_HAVE_CC_STACKPROTECTOR=y
        CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
        CONFIG_CC_STACKPROTECTOR=y
        # CONFIG_CC_STACKPROTECTOR_STRONG is not set
        CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
      
      That's dangerously subtle - people could suddenly find themselves with
      the weaker stack protector setup without even realizing.
      
      The solution here is to just rename not just the old RECULAR stack
      protector option, but also the strong one.  This does that by just
      removing the CC_ prefix entirely for the user choices, because it really
      is not about the compiler support (the compiler support now instead
      automatially impacts _visibility_ of the options to users).
      
      This results in "make oldconfig" actually asking the user for their
      choice, so that we don't have any silent subtle security model changes.
      The end result would generally look like this:
      
        CONFIG_HAVE_CC_STACKPROTECTOR=y
        CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
        CONFIG_STACKPROTECTOR=y
        CONFIG_STACKPROTECTOR_STRONG=y
        CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
      
      where the "CC_" versions really are about internal compiler
      infrastructure, not the user selections.
      Acked-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      050e9baa
  5. 11 6月, 2018 1 次提交
    • M
      kcov: test compiler capability in Kconfig and correct dependency · 5aadfdeb
      Masahiro Yamada 提交于
      As Documentation/kbuild/kconfig-language.txt notes, 'select' should be
      be used with care - it forces a lower limit of another symbol, ignoring
      the dependency.  Currently, KCOV can select GCC_PLUGINS even if arch
      does not select HAVE_GCC_PLUGINS.  This could cause the unmet direct
      dependency.
      
      Now that Kconfig can test compiler capability, let's handle this in a
      more sophisticated way.
      
      There are two ways to enable KCOV; use the compiler that natively
      supports -fsanitize-coverage=trace-pc, or build the SANCOV plugin if
      the compiler has ability to build GCC plugins.  Hence, the correct
      dependency for KCOV is:
      
        depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS
      
      You do not need to build the SANCOV plugin if the compiler already
      supports -fsanitize-coverage=trace-pc.  Hence, the select should be:
      
        select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC
      
      With this, GCC_PLUGIN_SANCOV is selected only when necessary, so
      scripts/Makefile.gcc-plugins can be cleaner.
      
      I also cleaned up Kconfig and scripts/Makefile.kcov as well.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      5aadfdeb
  6. 08 6月, 2018 2 次提交
    • M
      stack-protector: test compiler capability in Kconfig and drop AUTO mode · 2a61f474
      Masahiro Yamada 提交于
      Move the test for -fstack-protector(-strong) option to Kconfig.
      
      If the compiler does not support the option, the corresponding menu
      is automatically hidden.  If STRONG is not supported, it will fall
      back to REGULAR.  If REGULAR is not supported, it will be disabled.
      This means, AUTO is implicitly handled by the dependency solver of
      Kconfig, hence removed.
      
      I also turned the 'choice' into only two boolean symbols.  The use of
      'choice' is not a good idea here, because all of all{yes,mod,no}config
      would choose the first visible value, while we want allnoconfig to
      disable as many features as possible.
      
      X86 has additional shell scripts in case the compiler supports those
      options, but generates broken code.  I added CC_HAS_SANE_STACKPROTECTOR
      to test this.  I had to add -m32 to gcc-x86_32-has-stack-protector.sh
      to make it work correctly.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      2a61f474
    • M
      kbuild: fix endless syncconfig in case arch Makefile sets CROSS_COMPILE · 315bab4e
      Masahiro Yamada 提交于
      Commit 21c54b77 ("kconfig: show compiler version text in the top
      comment") was intended to detect the compiler upgrade, but Geert
      reported a breakage on the m68k build.
      
      The compiler upgrade is detected by the change of the environment
      variable, CC_VERSION_TEXT, which contains the first line of the output
      from $(CC) --version.  Currently, this works well when CROSS_COMPILE
      is given via the environment variable or the Make command line.
      
      However, some architectures such as m68k can specify CROSS_COMPILE
      from arch/$(SRCARCH)/Makefile as well.  In this case, "make ARCH=m68k"
      ends up with endless syncconfig loop.
      
        $ make ARCH=m68k defconfig
        *** Default configuration is based on 'multi_defconfig'
        #
        # configuration written to .config
        #
        $ make ARCH=m68k
        scripts/kconfig/conf  --syncconfig Kconfig
        scripts/kconfig/conf  --syncconfig Kconfig
        scripts/kconfig/conf  --syncconfig Kconfig
        scripts/kconfig/conf  --syncconfig Kconfig
      
      Things are happening like this:
      
      Because arch/$(SRCARCH)/Makefile is included after CC_VERSION_TEXT
      is set, it contains the host compiler version in the defconfig phase.
      
      To create or update auto.conf, the following line is triggered:
      
      include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
              $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
      
      This recurses the top Makefile after arch/$(SRCARCH)/Makefile is
      included.  CROSS_COMPILE is set to a m68k toolchain prefix and
      exported to the recursed Make.  Then, syncconfig is invoked with
      the target compiler version in CC_VERSION_TEXT.
      
      The Make will restart because auto.conf and auto.conf.cmd have been
      updated.  At this point, CROSS_COMPILE is reset, so CC_VERSION_TEXT
      is set to the host compiler version again.  Then, syncconfig is
      triggered due to the change of CC_VERSION_TEXT.  This loop continues
      eternally.
      
      To fix this problem, $(CC_VERSION_TEXT) must be evaluated only after
      arch/$(SRCARCH)/Makefile.  Setting it earlier is OK as long as it is
      defined by using the '=' operator instead of ':='.
      
      For the defconfig phase, $(CC_VERSION_TEXT) is evaluated when Kbuild
      descends into scripts/kconfig/, so it contains the target compiler
      version correctly.
      
      include/config/auto.conf.cmd references $(CC_VERSION_TEXT) as well,
      so it must be included after arch/$(SRCARCH)/Makefile.
      
      Fixes: 21c54b77 ("kconfig: show compiler version text in the top comment")
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      315bab4e
  7. 05 6月, 2018 1 次提交
  8. 04 6月, 2018 1 次提交
  9. 01 6月, 2018 1 次提交
  10. 29 5月, 2018 7 次提交
    • L
      kbuild: add endianness flag to CHEKCFLAGS · 14516765
      Luc Van Oostenryck 提交于
      The kernel depends on macros like __BYTE_ORDER__,
      __BIG_ENDIAN__ or __LITTLE_ENDIAN__.
      
      OTOH, sparse doesn't know about the endianness of the kernel and
      by default uses the same as the machine on which sparse was built.
      
      Ensure that sparse can predefine the macros corresponding to
      how the kernel was configured by adding -m{big,little}-endian
      to CHECKFLAGS in the main Makefile (and so for all archs).
      Also, remove the equivalent done in arch specific Makefiles.
      Signed-off-by: NLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      14516765
    • L
      kbuild: $(CHECK) doesnt need NOSTDINC_FLAGS twice · 59f7b584
      Luc Van Oostenryck 提交于
      Currently, $(CHECK) receives NOSTDINC_FLAGS twice:
      * first directly in the main Makefile via CHECKFLAGS,
      * then indirectly in scripts/Makefile.build via c_flags.
      
      Since once is enough, leave the occurence via c_flags and
      remove the one via CHECKFLAGS.
      Signed-off-by: NLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      59f7b584
    • M
      kconfig: show compiler version text in the top comment · 21c54b77
      Masahiro Yamada 提交于
      The kernel configuration phase is now tightly coupled with the compiler
      in use.  It will be nice to show the compiler information in Kconfig.
      
      The compiler information will be displayed like this:
      
        $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- config
        scripts/kconfig/conf  --oldaskconfig Kconfig
        *
        * Linux/arm64 4.16.0-rc1 Kernel Configuration
        *
        *
        * Compiler: aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
        *
        *
        * General setup
        *
        Compile also drivers which will not load (COMPILE_TEST) [N/y/?]
      
      If you use GUI methods such as menuconfig, it will be displayed in the
      top menu.
      
      This is simply implemented by using the 'comment' statement.  So, it
      will be saved into the .config file as well.
      
      This commit has a very important meaning.  If the compiler is upgraded,
      Kconfig must be re-run since different compilers have different sets
      of supported options.
      
      All referenced environments are written to include/config/auto.conf.cmd
      so that any environment change triggers syncconfig, and prompt the user
      to input new values if needed.
      
      With this commit, something like follows will be added to
      include/config/auto.conf.cmd
      
        ifneq "$(CC_VERSION_TEXT)" "aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011"
        include/config/auto.conf: FORCE
        endif
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      21c54b77
    • M
      kconfig: replace $(UNAME_RELEASE) with function call · 2972666a
      Masahiro Yamada 提交于
      Now that 'shell' function is supported, this can be self-contained in
      Kconfig.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      2972666a
    • M
      kconfig: reference environment variables directly and remove 'option env=' · 104daea1
      Masahiro Yamada 提交于
      To get access to environment variables, Kconfig needs to define a
      symbol using "option env=" syntax.  It is tedious to add a symbol entry
      for each environment variable given that we need to define much more
      such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability
      in Kconfig.
      
      Adding '$' for symbol references is grammatically inconsistent.
      Looking at the code, the symbols prefixed with 'S' are expanded by:
       - conf_expand_value()
         This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list'
       - sym_expand_string_value()
         This is used to expand strings in 'source' and 'mainmenu'
      
      All of them are fixed values independent of user configuration.  So,
      they can be changed into the direct expansion instead of symbols.
      
      This change makes the code much cleaner.  The bounce symbols 'SRCARCH',
      'ARCH', 'SUBARCH', 'KERNELVERSION' are gone.
      
      sym_init() hard-coding 'UNAME_RELEASE' is also gone.  'UNAME_RELEASE'
      should be replaced with an environment variable.
      
      ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced
      without '$' prefix.
      
      The new syntax is addicted by Make.  The variable reference needs
      parentheses, like $(FOO), but you can omit them for single-letter
      variables, like $F.  Yet, in Makefiles, people tend to use the
      parenthetical form for consistency / clarification.
      
      At this moment, only the environment variable is supported, but I will
      extend the concept of 'variable' later on.
      
      The variables are expanded in the lexer so we can simplify the token
      handling on the parser side.
      
      For example, the following code works.
      
      [Example code]
      
        config MY_TOOLCHAIN_LIST
                string
                default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)"
      
      [Result]
      
        $ make -s alldefconfig && tail -n 1 .config
        CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E"
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      104daea1
    • M
      kbuild: remove CONFIG_CROSS_COMPILE support · f1089c92
      Masahiro Yamada 提交于
      Kbuild provides a couple of ways to specify CROSS_COMPILE:
      
      [1] Command line
      [2] Environment
      [3] arch/*/Makefile (only some architectures)
      [4] CONFIG_CROSS_COMPILE
      
      [4] is problematic for the compiler capability tests in Kconfig.
      CONFIG_CROSS_COMPILE allows users to change the compiler prefix from
      'make menuconfig', etc.  It means, the compiler options would have
      to be all re-calculated everytime CONFIG_CROSS_COMPILE is changed.
      
      To avoid complexity and performance issues, I'd like to evaluate
      the shell commands statically, i.e. only parsing Kconfig files.
      
      I guess the majority is [1] or [2].  Currently, there are only
      5 defconfig files that specify CONFIG_CROSS_COMPILE.
        arch/arm/configs/lpc18xx_defconfig
        arch/hexagon/configs/comet_defconfig
        arch/nds32/configs/defconfig
        arch/openrisc/configs/or1ksim_defconfig
        arch/openrisc/configs/simple_smp_defconfig
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      f1089c92
    • M
      kbuild: remove kbuild cache · e08d6de4
      Masahiro Yamada 提交于
      The kbuild cache was introduced to remember the result of shell
      commands, some of which are expensive to compute, such as
      $(call cc-option,...).
      
      However, this turned out not so clever as I had first expected.
      Actually, it is problematic.  For example, "$(CC) -print-file-name"
      is cached.  If the compiler is updated, the stale search path causes
      build error, which is difficult to figure out.  Another problem
      scenario is cache files could be touched while install targets are
      running under the root permission.  We can patch them if desired,
      but the build infrastructure is getting uglier and uglier.
      
      Now, we are going to move compiler flag tests to the configuration
      phase.  If this is completed, the result of compiler tests will be
      naturally cached in the .config file.  We will not have performance
      issues of incremental building since this testing only happens at
      Kconfig time.
      
      To start this work with a cleaner code base, remove the kbuild
      cache first.
      
      Revert the following commits:
      Commit 9a234a2e ("kbuild: create directory for make cache only when necessary")
      Commit e17c400a ("kbuild: shrink .cache.mk when it exceeds 1000 lines")
      Commit 4e562071 ("kbuild: Cache a few more calls to the compiler")
      Commit 3298b690 ("kbuild: Add a cache for generated variables")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      e08d6de4
  11. 28 5月, 2018 1 次提交
  12. 21 5月, 2018 1 次提交
  13. 17 5月, 2018 4 次提交
  14. 14 5月, 2018 1 次提交
  15. 07 5月, 2018 1 次提交
  16. 30 4月, 2018 1 次提交
  17. 23 4月, 2018 1 次提交
  18. 16 4月, 2018 1 次提交
  19. 07 4月, 2018 4 次提交
    • M
      kbuild: use -fmacro-prefix-map to make __FILE__ a relative path · a73619a8
      Masahiro Yamada 提交于
      The __FILE__ macro is used everywhere in the kernel to locate the file
      printing the log message, such as WARN_ON(), etc.  If the kernel is
      built out of tree, this can be a long absolute path, like this:
      
        WARNING: CPU: 1 PID: 1 at /path/to/build/directory/arch/arm64/kernel/foo.c:...
      
      This is because Kbuild runs in the objtree instead of the srctree,
      then __FILE__ is expanded to a file path prefixed with $(srctree)/.
      
      Commit 9da0763b ("kbuild: Use relative path when building in a
      subdir of the source tree") improved this to some extent; $(srctree)
      becomes ".." if the objtree is a child of the srctree.
      
      For other cases of out-of-tree build, __FILE__ is still the absolute
      path.  It also means the kernel image depends on where it was built.
      
      A brand-new option from GCC, -fmacro-prefix-map, solves this problem.
      If your compiler supports it, __FILE__ is the relative path from the
      srctree regardless of O= option.  This provides more readable log and
      more reproducible builds.
      
      Please note __FILE__ is always an absolute path for external modules.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      a73619a8
    • M
      kbuild: rename *-asn1.[ch] to *.asn1.[ch] · 4fa8bc94
      Masahiro Yamada 提交于
      Our convention is to distinguish file types by suffixes with a period
      as a separator.
      
      *-asn1.[ch] is a different pattern from other generated sources such
      as *.lex.c, *.tab.[ch], *.dtb.S, etc.  More confusing, files with
      '-asn1.[ch]' are generated files, but '_asn1.[ch]' are checked-in
      files:
        net/netfilter/nf_conntrack_h323_asn1.c
        include/linux/netfilter/nf_conntrack_h323_asn1.h
        include/linux/sunrpc/gss_asn1.h
      
      Rename generated files to *.asn1.[ch] for consistency.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      4fa8bc94
    • M
      kbuild: clean up *-asn1.[ch] patterns from top-level Makefile · 3ca3273e
      Masahiro Yamada 提交于
      Clean up these patterns from the top Makefile to omit 'clean-files'
      in each Makefile.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      3ca3273e
    • M
      kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile · 9a8dfb39
      Masahiro Yamada 提交于
      Files suffixed by .lex.c, .tab.[ch] are generated lexers, parsers,
      respectively.  Clean them up globally from the top Makefile.
      
      Some of the final host programs those lexer/parser are linked into
      are necessary for building external modules, but the intermediates
      are unneeded.  They can be cleaned away by 'make clean' instead of
      'make mrproper'.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NFrank Rowand <frowand.list@gmail.com>
      9a8dfb39
  20. 02 4月, 2018 1 次提交
  21. 26 3月, 2018 7 次提交
    • L
      Linux 4.16-rc7 · 3eb2ce82
      Linus Torvalds 提交于
      3eb2ce82
    • M
      kbuild: add PYTHON2 and PYTHON3 variables · e9781b52
      Masahiro Yamada 提交于
      The variable 'PYTHON' allows users to specify a proper executable
      name in case the default 'python' does not work.  However, this does
      not address the case where both Python 2.x and 3.x scripts are used
      in one source tree.
      
      PEP 394 (https://www.python.org/dev/peps/pep-0394/) provides a
      convention for Python scripts portability.  Here is a quotation:
      
        In order to tolerate differences across platforms, all new code
        that needs to invoke the Python interpreter should not specify
        'python', but rather should specify either 'python2' or 'python3'.
        This distinction should be made in shebangs, when invoking from a
        shell script, when invoking via the system() call, or when invoking
        in any other context.
        One exception to this is scripts that are deliberately written to
        be source compatible with both Python 2.x and 3.x. Such scripts may
        continue to use python on their shebang line without affecting their
        portability.
      
      To meet this requirement, this commit adds new variables 'PYTHON2'
      and 'PYTHON3'.
      
      arch/ia64/scripts/unwcheck.py is the only script that has ever used
      $(PYTHON).  Recent commit bd5edbe6 ("ia64: convert unwcheck.py to
      python3") converted it to be compatible with both Python 2.x and 3.x,
      so this is the exceptional case where the use of 'python' is allowed.
      So, I did not touch arch/ia64/Makefile.
      
      tools/perf/Makefile.config sets PYTHON and PYTHON2 by itself, so it
      is not affected by this commit.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      e9781b52
    • M
      kconfig: rename silentoldconfig to syncconfig · 911a91c3
      Masahiro Yamada 提交于
      As commit cedd55d4 ("kconfig: Remove silentoldconfig from help
      and docs; fix kconfig/conf's help") mentioned, 'silentoldconfig' is a
      historical misnomer.  That commit removed it from help and docs since
      it is an internal interface.  If so, it should be allowed to rename
      it to something more intuitive.  'syncconfig' is the one I came up
      with because it updates the .config if necessary, then synchronize
      include/generated/autoconf.h and include/config/* with it.
      
      You should not manually invoke 'silentoldcofig'.  Display warning if
      used in case existing scripts are doing wrong.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      911a91c3
    • M
      kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS · 3fdc7d3f
      Masahiro Yamada 提交于
      If CONFIG_TRIM_UNUSED_KSYMS is enabled and the kernel is built from
      a pristine state, the vmlinux is linked twice.
      
      [1] A user runs 'make'
      
      [2] First build with empty autoksyms.h
      
      [3] adjust_autoksyms.sh updates autoksyms.h and recurses 'make vmlinux'
      
        --------(begin sub-make)--------
        [4] Second build with new autoksyms.h
      
        [5] link-vmlinux.sh is invoked because vmlinux is missing
        ---------(end sub-make)---------
      
      [6] link-vmlinux.sh is invoked again despite vmlinux is up-to-date.
      
      The reason of [6] is probably because Make already decided to update
      vmlinux at the time of [2] because vmlinux was missing when Make
      built up the dependency graph.
      
      Because if_changed is implemented based on $?, this issue can be
      narrowed down to how Make handles $?.
      
      You can test it with the following simple code:
      
      [Test Makefile]
        A: B
                @echo newer prerequisite: $?
                cp B A
      
        B: C
                cp C B
                touch A
      
      [Result]
        $ rm -f A B
        $ touch C
        $ make
        cp C B
        touch A
        newer prerequisite: B
        cp B A
      
      Here, 'A' has been touched in the recipe of 'B'.  So, the dependency
      'A: B' has already been met before the recipe of 'A' is executed.
      However, Make does not notice the fact that the recipe of 'B' also
      updates 'A' as a side-effect.
      
      The situation is similar in this case; the vmlinux has actually been
      updated in the vmlinux_prereq target.  Make cannot predict this, so
      judges the vmlinux is old.
      
      link-vmlinux.sh is costly, so it is better to not run it when unneeded.
      Split CONFIG_TRIM_UNUSED_KSYMS recursion to a dedicated target.
      
      The reason of commit 2441e78b ("kbuild: better abstract vmlinux
      sequential prerequisites") was to cater to CONFIG_BUILD_DOCSRC, but
      it was later removed by commit 18489292 ("samples: move blackfin
      gptimers-example from Documentation").
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      3fdc7d3f
    • M
      kbuild: move include/config/ksym/* to include/ksym/* · fbfa9be9
      Masahiro Yamada 提交于
      The idea of using fixdep was inspired by Kconfig, but autoksyms
      belongs to a different group.  So, I want to move those touched
      files under include/config/ksym/ to include/ksym/.
      
      The directory include/ksym/ can be removed by 'make clean' because
      it is meaningless for the external module building.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      fbfa9be9
    • M
      kbuild: move CONFIG_TRIM_UNUSED_KSYMS code unneeded for external module · 1f50b80a
      Masahiro Yamada 提交于
      The external module building does not need to parse this code because
      KBUILD_MODULES is always set anyway.
      
      Move this code inside the "ifeq ($(KBUILD_EXTMOD),) ... endif" block.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      1f50b80a
    • M
      kbuild: restore autoksyms.h touch to the top Makefile · 07a422bb
      Masahiro Yamada 提交于
      Commit d3fc425e ("kbuild: make sure autoksyms.h exists early")
      moved the code that touches autoksyms.h to scripts/kconfig/Makefile
      with obscure reason.
      
      From Nicolas' comment [1], he did not seem to be sure about the root
      cause.
      
      I guess I figured it out, so here is a fix-up I think is more correct.
      According to the error log in the original post [2], the build failed
      in scripts/mod/devicetable-offsets.c
      
      scripts/mod/Makefile is descended from scripts/Makefile, which is
      invoked from the top-level Makefile by the 'scripts' target.
      
      To build vmlinux and/or modules, Kbuild descend into $(vmlinux-dirs).
      This depends on 'prepare' and 'scripts' as follows:
      
        $(vmlinux-dirs): prepare scripts
      
      Because there is no dependency between 'prepare' and 'scripts', the
      parallel building can execute them simultaneously.
      
      'prepare' depends on 'prepare1', which touched autoksyms.h, while
      'scripts' descends into script/, then scripts/mod/, which needs
      <generated/autoksyms.h> if CONFIG_TRIM_UNUSED_KSYMS.  It was the
      reason of the race.
      
      I am not happy to have unrelated code in the Kconfig Makefile, so
      getting it back to the top Makefile.
      
      I removed the standalone test target because I want to use it to
      create an empty autoksyms.h file.  Here is a little improvement;
      unnecessary autoksyms.h is not created when CONFIG_TRIM_UNUSED_KSYMS
      is disabled.
      
      [1] https://lkml.org/lkml/2016/11/30/734
      [2] https://lkml.org/lkml/2016/11/30/531Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@linaro.org>
      07a422bb