Skip to content
  • Masahiro Yamada's avatar
    kbuild: restore autoksyms.h touch to the top Makefile · 07a422bb
    Masahiro Yamada authored
    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/531
    
    
    
    Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Acked-by: default avatarNicolas Pitre <nico@linaro.org>
    07a422bb