1. 21 8月, 2019 2 次提交
  2. 15 8月, 2019 2 次提交
  3. 12 8月, 2019 1 次提交
  4. 11 8月, 2019 1 次提交
  5. 10 8月, 2019 2 次提交
    • M
      kbuild: show hint if subdir-y/m is used to visit module Makefile · c07d8d47
      Masahiro Yamada 提交于
      Since commit ff9b45c5 ("kbuild: modpost: read modules.order instead
      of $(MODVERDIR)/*.mod"), a module is no longer built in the following
      pattern:
      
        [Makefile]
        subdir-y := some-module
      
        [some-module/Makefile]
        obj-m := some-module.o
      
      You cannot write Makefile this way in upstream because modules.order is
      not correctly generated. subdir-y is used to descend to a sub-directory
      that builds tools, device trees, etc.
      
      For external modules, the modules order does not matter. So, the
      Makefile above was known to work.
      
      I believe the Makefile should be re-written as follows:
      
        [Makefile]
        obj-m := some-module/
      
        [some-module/Makefile]
        obj-m := some-module.o
      
      However, people will have no idea if their Makefile suddenly stops
      working. In fact, I received questions from multiple people.
      
      Show a warning for a while if obj-m is specified in a Makefile visited
      by subdir-y or subdir-m.
      
      I touched the %/ rule to avoid false-positive warnings for the single
      target.
      
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: Tom Stonecypher <thomas.edwardx.stonecypher@intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NJan Kiszka <jan.kiszka@siemens.com>
      c07d8d47
    • M
      kbuild: revive single target %.ko · 47801c97
      Masahiro Yamada 提交于
      I removed the single target %.ko in commit ff9b45c5 ("kbuild:
      modpost: read modules.order instead of $(MODVERDIR)/*.mod") because
      the modpost stage does not work reliably. For instance, the module
      dependency, modversion, etc. do not work if we lack symbol information
      from the other modules.
      
      Yet, some people still want to build only one module in their interest,
      and it may be still useful if it is used within those limitations.
      
      Fixes: ff9b45c5 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
      Reported-by: NDon Brace <don.brace@microsemi.com>
      Reported-by: NArend Van Spriel <arend.vanspriel@broadcom.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      47801c97
  6. 08 8月, 2019 1 次提交
  7. 05 8月, 2019 1 次提交
  8. 31 7月, 2019 1 次提交
  9. 29 7月, 2019 1 次提交
  10. 26 7月, 2019 1 次提交
    • G
      Makefile: Globally enable fall-through warning · a035d552
      Gustavo A. R. Silva 提交于
      Now that all the fall-through warnings have been addressed in the
      kernel, enable the fall-through warning globally.
      
      Also, update the deprecated.rst file to include implicit fall-through
      as 'deprecated' so people can be pointed to a single location for
      justification.
      
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: linux-kbuild@vger.kernel.org
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      a035d552
  11. 22 7月, 2019 1 次提交
  12. 20 7月, 2019 1 次提交
  13. 18 7月, 2019 3 次提交
    • M
      kbuild: remove 'prepare1' target · 30527cef
      Masahiro Yamada 提交于
      Now that there is no rule for 'prepare1', it can go away.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      30527cef
    • M
      kbuild: create *.mod with full directory path and remove MODVERDIR · b7dca6dd
      Masahiro Yamada 提交于
      While descending directories, Kbuild produces objects for modules,
      but do not link final *.ko files; it is done in the modpost.
      
      To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR)
      for every module it is building. Some post-processing steps read the
      necessary information from *.mod files. This avoids descending into
      directories again. This mechanism was introduced in 2003 or so.
      
      Later, commit 551559e1 ("kbuild: implement modules.order") added
      modules.order. So, we can simply read it out to know all the modules
      with directory paths. This is easier than parsing the first line of
      *.mod files.
      
      $(MODVERDIR) has a flat directory structure, that is, *.mod files
      are named only with base names. This is based on the assumption that
      the module name is unique across the tree. This assumption is really
      fragile.
      
      Stephen Rothwell reported a race condition caused by a module name
      conflict:
      
        https://lkml.org/lkml/2019/5/13/991
      
      In parallel building, two different threads could write to the same
      $(MODVERDIR)/*.mod simultaneously.
      
      Non-unique module names are the source of all kind of troubles, hence
      commit 3a48a919 ("kbuild: check uniqueness of module names")
      introduced a new checker script.
      
      However, it is still fragile in the build system point of view because
      this race happens before scripts/modules-check.sh is invoked. If it
      happens again, the modpost will emit unclear error messages.
      
      To fix this issue completely, create *.mod with full directory path
      so that two threads never attempt to write to the same file.
      
      $(MODVERDIR) is no longer needed.
      
      Since modules with directory paths are listed in modules.order, Kbuild
      is still able to find *.mod files without additional descending.
      
      I also killed cmd_secanalysis; scripts/mod/sumversion.c computes MD4 hash
      for modules with MODULE_VERSION(). When CONFIG_DEBUG_SECTION_MISMATCH=y,
      it occurs not only in the modpost stage, but also during directory
      descending, where sumversion.c may parse stale *.mod files. It would emit
      'No such file or directory' warning when an object consisting a module is
      renamed, or when a single-obj module is turned into a multi-obj module or
      vice versa.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@fluxnic.net>
      b7dca6dd
    • M
      kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod · ff9b45c5
      Masahiro Yamada 提交于
      Towards the goal of removing MODVERDIR, read out modules.order to get
      the list of modules to be processed. This is simpler than parsing *.mod
      files in $(MODVERDIR).
      
      For external modules, $(KBUILD_EXTMOD)/modules.order should be read.
      
      I removed the single target %.ko from the top Makefile. To make sure
      modpost works correctly, vmlinux and the other modules must be built.
      You cannot build a particular .ko file alone.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      ff9b45c5
  14. 17 7月, 2019 4 次提交
    • M
      kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin} · 1bd9a468
      Masahiro Yamada 提交于
      Removing the 'kernel/' prefix will make our life easier because we can
      simply do 'cat modules.order' to get all built modules with full paths.
      
      Currently, we parse the first line of '*.mod' files in $(MODVERDIR).
      Since we have duplicated functionality here, I plan to remove MODVERDIR
      entirely.
      
      In fact, modules.order is generated also for external modules in a
      broken format. It adds the 'kernel/' prefix to the absolute path of
      the module, like this:
      
        kernel//path/to/your/external/module/foo.ko
      
      This is fine for now since modules.order is not used for external
      modules. However, I want to sanitize the format everywhere towards
      the goal of removing MODVERDIR.
      
      We cannot change the format of installed module.{order,builtin}.
      So, 'make modules_install' will add the 'kernel/' prefix while copying
      them to $(MODLIB)/.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      1bd9a468
    • M
      kbuild: do not create empty modules.order in the prepare stage · 7e131918
      Masahiro Yamada 提交于
      Currently, $(objtree)/modules.order is touched in two places.
      
      In the 'prepare0' rule, scripts/Makefile.build creates an empty
      modules.order while processing 'obj=.'
      
      In the 'modules' rule, the top-level Makefile overwrites it with
      the correct list of modules.
      
      While this might be a good side-effect that modules.order is made
      empty every time (probably this is not intended functionality),
      I personally do not like this behavior.
      
      Create modules.order only when it is sensible to do so.
      
      This avoids creating the following pointless files:
      
        scripts/basic/modules.order
        scripts/dtc/modules.order
        scripts/gcc-plugins/modules.order
        scripts/genksyms/modules.order
        scripts/mod/modules.order
        scripts/modules.order
        scripts/selinux/genheaders/modules.order
        scripts/selinux/mdp/modules.order
        scripts/selinux/modules.order
      
      Going forward, $(objtree)/modules.order lists the modules that
      was built in the last successful build.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      7e131918
    • M
      kbuild: remove tag files by distclean instead of mrproper · 46457133
      Masahiro Yamada 提交于
      It takes somewhat long time to generate these tag files.
      Keep such precious files until we run 'make distclean'.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      46457133
    • M
      kbuild: add --hash-style= and --build-id unconditionally · 89ff7131
      Masahiro Yamada 提交于
      As commit 1e022137 ("mips: vdso: drop unnecessary cc-ldoption")
      explained, these flags are supported by the minimal required version
      of binutils. They are supported by ld.lld too.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Tested-by: NNathan Chancellor <natechancellor@gmail.com>
      89ff7131
  15. 10 7月, 2019 4 次提交
    • G
      kbuild: Inform user to pass ARCH= for make mrproper · 3a475b21
      Geert Uytterhoeven 提交于
      When cross-compiling an out-of-tree build with an unclean source tree
      directory, the build fails with:
      
        /path/to/kernel/source/tree is not clean, please run 'make mrproper'
        in the '/path/to/kernel/source/tree' directory.
      
      However, doing so does not fix the problem, as "make mrproper" now
      requires passing the target architecture to the make command, else it
      won't remove $(srctree)/arch/$(SRCARCH)/include/generated.
      "git ls-files -o" doesn't give a clue, as it doesn't list (empty)
      directories, only files.
      
      Improve usability by including the ARCH= option in the error output.
      
      Fixes: a788b2ed ("kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      3a475b21
    • M
      kbuild: add a flag to force absolute path for srctree · 95fd3f87
      Masahiro Yamada 提交于
      In old days, Kbuild always used an absolute path for $(srctree).
      
      Since commit 890676c6 ("kbuild: Use relative path when building in
      the source tree"), $(srctree) is '.' when O= was not passed from the
      command line.
      
      Yet, using absolute paths is useful in some cases even without O=, for
      instance, to create a cscope file with absolute path tags.
      
      'O=.' was known to work as a workaround to force Kbuild to use absolute
      paths even when you are building in the source tree.
      
      Since commit 25b146c5 ("kbuild: allow Kbuild to start from any
      directory"), Kbuild is too clever to be tricked. Even if you pass 'O=.'
      Kbuild notices you are building in the source tree, then use '.' for
      $(srctree).
      
      So, 'make O=. cscope' is no help to create absolute path tags.
      
      We cannot force one or the other according to commit e93bc1a0
      ("Revert "kbuild: specify absolute paths for cscope""). Both of
      relative path and absolute path have pros and cons.
      
      This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to
      choose the absolute path for $(srctree).
      
      'make KBUILD_ABS_SRCTREE=1 cscope' will work as a replacement of
      'make O=. cscope'.
      Reported-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      95fd3f87
    • M
      kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree · 051f278e
      Masahiro Yamada 提交于
      Commit 25b146c5 ("kbuild: allow Kbuild to start from any directory")
      deprecated KBUILD_SRCTREE.
      
      It is only used in tools/testing/selftest/ to distinguish out-of-tree
      build. Replace it with a new boolean flag, building_out_of_srctree.
      
      I also replaced the conditional ($(srctree),.) because the next commit
      will allow an absolute path to be used for $(srctree) even when building
      in the source tree.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      051f278e
    • M
      kbuild: remove src and obj from the top Makefile · 75dd4747
      Masahiro Yamada 提交于
      Replace $(src) and $(obj) with $(srctree) and $(objtree), respectively.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      75dd4747
  16. 09 7月, 2019 2 次提交
    • M
      kbuild: compile-test kernel headers to ensure they are self-contained · 43c78d88
      Masahiro Yamada 提交于
      The headers in include/ are globally used in the kernel source tree
      to provide common APIs. They are included from external modules, too.
      
      It will be useful to make as many headers self-contained as possible
      so that we do not have to rely on a specific include order.
      
      There are more than 4000 headers in include/. In my rough analysis,
      70% of them are already self-contained. With efforts, most of them
      can be self-contained.
      
      For now, we must exclude more than 1000 headers just because they
      cannot be compiled as standalone units. I added them to header-test-.
      The blacklist was mostly generated by a script, so the reason of the
      breakage should be checked later.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NJani Nikula <jani.nikula@intel.com>
      Reviewed-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      43c78d88
    • M
      kbuild: do not create wrappers for header-test-y · c93a0368
      Masahiro Yamada 提交于
      header-test-y does not work with headers in sub-directories.
      
      For example, you may want to write a Makefile, like this:
      
      include/linux/Kbuild:
      
        header-test-y += mtd/nand.h
      
      This entry will create a wrapper include/linux/mtd/nand.hdrtest.c
      with the following content:
      
        #include "mtd/nand.h"
      
      To make this work, we need to add $(srctree)/include/linux to the
      header search path. It would be tedious to add ccflags-y.
      
      Instead, we could change the *.hdrtest.c rule to wrap:
      
        #include "nand.h"
      
      This works for in-tree build since #include "..." searches in the
      relative path from the header with this directive. For O=... build,
      we need to add $(srctree)/include/linux/mtd to the header search path,
      which will be even more tedious.
      
      After all, I thought it would be handier to compile headers directly
      without creating wrappers.
      
      I added a new build rule to compile %.h into %.h.s
      
      The target is %.h.s instead of %.h.o because it is slightly faster.
      Also, as for GCC, an empty assembly is smaller than an empty object.
      
      I wrote the build rule:
      
        $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
      
      instead of:
      
        $(CC) $(c_flags) -S -o $@ -x c $<
      
      Both work fine with GCC, but the latter is bad for Clang.
      
      This comes down to the difference in the -Wunused-function policy.
      GCC does not warn about unused 'static inline' functions at all.
      Clang does not warn about the ones in included headers, but does
      about the ones in the source. So, we should handle headers as
      headers, not as source files.
      
      In fact, this has been hidden since commit abb2ea7d ("compiler,
      clang: suppress warning for unused static inline functions"), but we
      should not rely on that.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NJani Nikula <jani.nikula@intel.com>
      Tested-by: NJani Nikula <jani.nikula@intel.com>
      c93a0368
  17. 08 7月, 2019 3 次提交
    • M
      kbuild: compile-test exported headers to ensure they are self-contained · d6fc9fcb
      Masahiro Yamada 提交于
      Multiple people have suggested compile-testing UAPI headers to ensure
      they can be really included from user-space. "make headers_check" is
      obviously not enough to catch bugs, and we often leak unresolved
      references to user-space.
      
      Use the new header-test-y syntax to implement it. Please note exported
      headers are compile-tested with a completely different set of compiler
      flags. The header search path is set to $(objtree)/usr/include since
      exported headers should not include unexported ones.
      
      We use -std=gnu89 for the kernel space since the kernel code highly
      depends on GNU extensions. On the other hand, UAPI headers should be
      written in more standardized C, so they are compiled with -std=c90.
      This will emit errors if C++ style comments, the keyword 'inline', etc.
      are used. Please use C style comments (/* ... */), '__inline__', etc.
      in UAPI headers.
      
      There is additional compiler requirement to enable this test because
      many of UAPI headers include <stdlib.h>, <sys/ioctl.h>, <sys/time.h>,
      etc. directly or indirectly. You cannot use kernel.org pre-built
      toolchains [1] since they lack <stdlib.h>.
      
      I reused CONFIG_CC_CAN_LINK to check the system header availability.
      The intention is slightly different, but a compiler that can link
      userspace programs provide system headers.
      
      For now, a lot of headers need to be excluded because they cannot
      be compiled standalone, but this is a good start point.
      
      [1] https://mirrors.edge.kernel.org/pub/tools/crosstool/index.htmlSigned-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      d6fc9fcb
    • L
      Linux 5.2 · 0ecfebd2
      Linus Torvalds 提交于
      0ecfebd2
    • M
      kbuild: add more hints about SUBDIRS replacement · 4e8fc3f5
      Masahiro Yamada 提交于
      Commit 0126be38 ("kbuild: announce removal of SUBDIRS if used")
      added a hint about the 'SUBDIRS' replacement, but it was not clear
      enough.
      
      Multiple people sent me similar questions, patches. For instance,
      
        https://lkml.org/lkml/2019/1/17/456
      
      I did not mean to use M= for building a subdirectory in the kernel tree.
      
      From commit 669efc76 ("net: hns3: fix compile error"), people
      already (ab)use M=... to do that because it seems to work to some extent.
      
      Documentation/kbuild/kbuild.txt says M= and KBUILD_EXTMOD are used for
      building external modules.
      
      In fact, Kbuild supports the single target '%/' for this purpose, but
      this may not be noticed much.
      
      Kindly add more hints.
      
      Makefile:213: ================= WARNING ================
      Makefile:214: 'SUBDIRS' will be removed after Linux 5.3
      Makefile:215:
      Makefile:216: If you are building an individual subdirectory
      Makefile:217: in the kernel tree, you can do like this:
      Makefile:218: $ make path/to/dir/you/want/to/build/
      Makefile:219: (Do not forget the trailing slash)
      Makefile:220:
      Makefile:221: If you are building an external module,
      Makefile:222: Please use 'M=' or 'KBUILD_EXTMOD' instead
      Makefile:223: ==========================================
      Suggested-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      4e8fc3f5
  18. 04 7月, 2019 1 次提交
  19. 01 7月, 2019 2 次提交
  20. 30 6月, 2019 1 次提交
  21. 24 6月, 2019 1 次提交
  22. 23 6月, 2019 1 次提交
  23. 17 6月, 2019 1 次提交
  24. 15 6月, 2019 2 次提交