1. 25 4月, 2021 8 次提交
    • M
      kbuild: dwarf: use AS_VERSION instead of test_dwarf5_support.sh · 2e988157
      Masahiro Yamada 提交于
      The test code in scripts/test_dwarf5_support.sh is somewhat difficult
      to understand, but after all, we want to check binutils >= 2.35.2
      
      From the former discussion, the requirement for generating DWARF v5 from
      C code is as follows:
      
       - gcc + gnu as          -> requires gcc 5.0+ (but 7.0+ for full support)
       - clang + gnu as        -> requires binutils 2.35.2+
       - clang + integrated as -> OK
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      2e988157
    • M
      kbuild: check the minimum assembler version in Kconfig · ba64beb1
      Masahiro Yamada 提交于
      Documentation/process/changes.rst defines the minimum assembler version
      (binutils version), but we have never checked it in the build time.
      
      Kbuild never invokes 'as' directly because all assembly files in the
      kernel tree are *.S, hence must be preprocessed. I do not expect
      raw assembly source files (*.s) would be added to the kernel tree.
      
      Therefore, we always use $(CC) as the assembler driver, and commit
      aa824e0c ("kbuild: remove AS variable") removed 'AS'. However,
      we are still interested in the version of the assembler acting behind.
      
      As usual, the --version option prints the version string.
      
        $ as --version | head -n 1
        GNU assembler (GNU Binutils for Ubuntu) 2.35.1
      
      But, we do not have $(AS). So, we can add the -Wa prefix so that
      $(CC) passes --version down to the backing assembler.
      
        $ gcc -Wa,--version | head -n 1
        gcc: fatal error: no input files
        compilation terminated.
      
      OK, we need to input something to satisfy gcc.
      
        $ gcc -Wa,--version -c -x assembler /dev/null -o /dev/null | head -n 1
        GNU assembler (GNU Binutils for Ubuntu) 2.35.1
      
      The combination of Clang and GNU assembler works in the same way:
      
        $ clang -no-integrated-as -Wa,--version -c -x assembler /dev/null -o /dev/null | head -n 1
        GNU assembler (GNU Binutils for Ubuntu) 2.35.1
      
      Clang with the integrated assembler fails like this:
      
        $ clang -integrated-as -Wa,--version -c -x assembler /dev/null -o /dev/null | head -n 1
        clang: error: unsupported argument '--version' to option 'Wa,'
      
      For the last case, checking the error message is fragile. If the
      proposal for -Wa,--version support [1] is accepted, this may not be
      even an error in the future.
      
      One easy way is to check if -integrated-as is present in the passed
      arguments. We did not pass -integrated-as to CLANG_FLAGS before, but
      we can make it explicit.
      
      Nathan pointed out -integrated-as is the default for all of the
      architectures/targets that the kernel cares about, but it goes
      along with "explicit is better than implicit" policy. [2]
      
      With all this in my mind, I implemented scripts/as-version.sh to
      check the assembler version in Kconfig time.
      
        $ scripts/as-version.sh gcc
        GNU 23501
        $ scripts/as-version.sh clang -no-integrated-as
        GNU 23501
        $ scripts/as-version.sh clang -integrated-as
        LLVM 0
      
      [1]: https://github.com/ClangBuiltLinux/linux/issues/1320
      [2]: https://lore.kernel.org/linux-kbuild/20210307044253.v3h47ucq6ng25iay@archlinux-ax161/Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      ba64beb1
    • M
      kbuild: collect minimum tool versions into scripts/min-tool-version.sh · e24b3ffc
      Masahiro Yamada 提交于
      The kernel build uses various tools, many of which are provided by the
      same software suite, for example, LLVM and Binutils.
      
      When you raise the minimum version of Clang/LLVM, you need to update
      clang_min_version in scripts/cc-version.sh and also lld_min_version in
      scripts/ld-version.sh.
      
      Kbuild can handle CC=clang and LD=ld.lld independently, but it does not
      make much sense to maintain their versions separately.
      
      Let's create a central place of minimum tool versions so you do not need
      to touch multiple files. scripts/min-tool-version.sh prints the minimum
      version of the given tool.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: NNathan Chancellor <nathan@kernel.org>
      Acked-by: NMiguel Ojeda <ojeda@kernel.org>
      Tested-by: NSedat Dilek <sedat.dilek@gmail.com>
      e24b3ffc
    • M
      kbuild: move $(strip ) to suffix-search definition · a34e6d1e
      Masahiro Yamada 提交于
      Move $(strip ...) to the callee from the callers of suffix-search. It
      shortens the code slightly. Adding a space after a comma will not be
      a matter. I also dropped parentheses from single character variables.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a34e6d1e
    • M
      kbuild: rename multi-used-* to multi-obj-* · a6601e01
      Masahiro Yamada 提交于
      I think multi-obj-* is clearer, and more consistent with real-obj-*.
      
      Rename as follows:
      
        multi-used-y  ->  multi-obj-y
        multi-used-m  ->  multi-obj-m
        multi-used    ->  multi-obj-ym
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      a6601e01
    • R
      kbuild: apply fixdep logic to link-vmlinux.sh · 0b956e20
      Rasmus Villemoes 提交于
      The patch adding CONFIG_VMLINUX_MAP revealed a small defect in the
      build system: link-vmlinux.sh takes decisions based on CONFIG_*
      options, but changing one of those does not always lead to vmlinux
      being linked again.
      
      For most of the CONFIG_* knobs referenced previously, this has
      probably been hidden by those knobs also affecting some object file,
      hence indirectly also vmlinux.
      
      But CONFIG_VMLINUX_MAP is only handled inside link-vmlinux.sh, and
      changing CONFIG_VMLINUX_MAP=n to CONFIG_VMLINUX_MAP=y does not cause
      the build system to re-link (and hence have vmlinux.map
      emitted). Since that map file is mostly a debugging aid, this is
      merely a nuisance which is easily worked around by just deleting
      vmlinux and building again.
      
      But one could imagine other (possibly future) CONFIG options that
      actually do affect the vmlinux binary but which are not captured
      through some object file dependency.
      
      To fix this, make link-vmlinux.sh emit a .vmlinux.d file in the same
      format as the dependency files generated by gcc, and apply the fixdep
      logic to that. I've tested that this correctly works with both in-tree
      and out-of-tree builds.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      0b956e20
    • R
      kbuild: add CONFIG_VMLINUX_MAP expert option · 5cc12472
      Rasmus Villemoes 提交于
      It can be quite useful to have ld emit a link map file, in order to
      debug or verify that special sections end up where they are supposed
      to, and to see what LD_DEAD_CODE_DATA_ELIMINATION manages to get rid
      of.
      
      The only reason I'm not just adding this unconditionally is that the
      .map file can be rather large (several MB), and that's a waste of
      space when one isn't interested in these things. Also make it depend
      on CONFIG_EXPERT.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5cc12472
    • M
      kbuild: split cc-option and friends to scripts/Makefile.compiler · 57fd251c
      Masahiro Yamada 提交于
      scripts/Kbuild.include is included everywhere, but macros such as
      cc-option are needed by build targets only.
      
      For example, when 'make clean' traverses the tree, it does not need
      to evaluate $(call cc-option,).
      
      Split cc-option, ld-option, etc. to scripts/Makefile.compiler, which
      is only included from the top Makefile and scripts/Makefile.build.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      57fd251c
  2. 15 3月, 2021 1 次提交
    • M
      kbuild: prefix $(srctree)/ to some included Makefiles · 3204a7fb
      Masahiro Yamada 提交于
      VPATH is used in Kbuild to make pattern rules search for prerequisites
      in both $(objtree) and $(srctree). Some of *.c, *.S files are not real
      sources, but generated by tools such as flex, bison, perl.
      
      In contrast, I doubt the benefit of --include-dir=$(abs_srctree) because
      it is always clear which Makefiles are real sources, and which are not.
      
      So, my hope is to add $(srctree)/ prefix to all check-in Makefiles,
      then remove --include-dir=$(abs_srctree) flag in the future.
      
      I am touching only some Kbuild core parts for now. Treewide fixes will
      be needed to achieve this goal.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      3204a7fb
  3. 13 3月, 2021 1 次提交
  4. 11 3月, 2021 5 次提交
  5. 10 3月, 2021 2 次提交
  6. 03 3月, 2021 1 次提交
  7. 02 3月, 2021 2 次提交
  8. 28 2月, 2021 2 次提交
  9. 27 2月, 2021 12 次提交
  10. 25 2月, 2021 4 次提交
  11. 24 2月, 2021 2 次提交