05 Mar, 2020

1 commit

  • commit fcbb8461fd2376ba3782b5b8bd440c929b8e4980 upstream.

    There are both positive and negative options about this feature.
    At first, I thought it was a good idea, but actually Linus stated a
    negative opinion (https://lkml.org/lkml/2019/9/29/227). I admit it
    is ugly and annoying.

    The baseline I'd like to keep is the compile-test of uapi headers.
    (Otherwise, kernel developers have no way to ensure the correctness
    of the exported headers.)

    I will maintain a small build rule in usr/include/Makefile.
    Remove the other header test functionality.

    Signed-off-by: Masahiro Yamada
    [ added to 5.4.y due to start of build warnings from backported patches
    because of this feature - gregkh]
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     

01 Oct, 2019

1 commit


06 Sep, 2019

1 commit

  • KBUILD_ENABLE_EXTRA_GCC_CHECKS started as a switch to add extra warning
    options for GCC, but now it is a historical misnomer since we use it
    also for Clang, DTC, and even kernel-doc.

    Rename it to more sensible, shorter KBUILD_EXTRA_WARN.

    For the backward compatibility, KBUILD_ENABLE_EXTRA_GCC_CHECKS is still
    supported (but not advertised in the documentation).

    I also fixed up 'make help', and updated the documentation.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nathan Chancellor
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Sedat Dilek

    Masahiro Yamada
     

22 Aug, 2019

2 commits

  • Makefile.lib is included by Makefile.modfinal as well as Makefile.build.

    Move modkern_cflags to Makefile.lib in order to simplify cmd_cc_o_c
    in Makefile.modfinal. Move modkern_cflags as well for consistency.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Add CONFIG_ASM_MODVERSIONS. This allows to remove one if-conditional
    nesting in scripts/Makefile.build.

    scripts/Makefile.build is run every time Kbuild descends into a
    sub-directory. So, I want to avoid $(wildcard ...) evaluation
    where possible although computing $(wildcard ...) is so cheap that
    it may not make measurable performance difference.

    Signed-off-by: Masahiro Yamada
    Acked-by: Geert Uytterhoeven

    Masahiro Yamada
     

21 Aug, 2019

1 commit

  • Currently, the single target build directly descends into the directory
    of the target. For example,

    $ make foo/bar/baz.o

    ... directly descends into foo/bar/.

    On the other hand, the normal build usually descends one directory at
    a time, i.e. descends into foo/, and then foo/bar/.

    This difference causes some problems.

    [1] miss subdir-asflags-y, subdir-ccflags-y in upper Makefiles

    The options in subdir-{as,cc}flags-y take effect in the current
    and its sub-directories. In other words, they are inherited
    downward. In the example above, the single target will miss
    subdir-{as,cc}flags-y if they are defined in foo/Makefile.

    [2] could be built in a different directory

    As Documentation/kbuild/modules.rst section 4.3 says, Kbuild can
    handle files that are spread over several sub-directories.

    The build rule of foo/bar/baz.o may not necessarily be specified in
    foo/bar/Makefile. It might be specifies in foo/Makefile as follows:

    [foo/Makefile]
    obj-y := bar/baz.o

    This often happens when a module is so big that its source files
    are divided into sub-directories.

    In this case, there is no Makefile in the foo/bar/ directory, yet
    the single target descends into foo/bar/, then fails due to the
    missing Makefile. You can still do 'make foo/bar/' for partial
    building, but cannot do 'make foo/bar/baz.s'. I believe the single
    target '%.s' is a useful feature for inspecting the compiler output.

    Some modules work around this issue by putting an empty Makefile
    in every sub-directory.

    This commit fixes those problems by making the single target build
    descend in the same way as the normal build does.

    Another change is the single target build will observe the CONFIG
    options. Previously, it allowed users to build the foo.o even when
    the corresponding CONFIG_FOO is disabled:

    obj-$(CONFIG_FOO) += foo.o

    In the new behavior, the single target build will just fail and show
    "No rule to make target ..." (or "Nothing to be done for ..." if the
    stale object already exists, but cannot be updated).

    The disadvantage of this commit is the build speed. Now that the
    single target build visits every directory and parses lots of
    Makefiles, it is slower than before. (But, I hope it will not be
    too slow.)

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

15 Aug, 2019

2 commits


14 Aug, 2019

1 commit

  • $(basename ...) trims the last suffix. Using it is more intuitive in
    my opinion.

    This pattern rule makes %.asn1.c and %.asn1.h at the same time.
    Previously, the short log showed only either of them, depending on
    the target file in question.

    To clarify that two files are being generated by the single recipe,
    I changed the log as follows:

    Before:

    ASN.1 crypto/asymmetric_keys/x509.asn1.c

    After:

    ASN.1 crypto/asymmetric_keys/x509.asn1.[ch]

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

10 Aug, 2019

3 commits

  • Since commit ff9b45c55b26 ("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
    Cc: Tom Stonecypher
    Signed-off-by: Masahiro Yamada
    Tested-by: Jan Kiszka

    Masahiro Yamada
     
  • The modules.order files in directories visited by the chain of obj-y
    or obj-m are merged to the upper-level ones, and become parts of the
    top-level modules.order. On the other hand, there is no need to
    generate modules.order in directories visited by subdir-y or subdir-m
    since they would become orphan anyway.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The current implementation of need-builtin is false-positive,
    for example, in the following Makefile:

    obj-m := foo/
    obj-y := foo/bar/

    ..., where foo/built-in.a is not required.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

18 Jul, 2019

3 commits

  • Currently, *.mod is created as a side-effect of obj-m.

    Split out *.mod as a dedicated build rule, which allows to unify
    the %.c -> %.o rule, and remove the single-used-m rule.

    This also makes the incremental build of allmodconfig faster because
    it saves $(NM) invocation when there is no change in the module.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The current format of *.mod is like this:

    line 1: directory path to the .ko file
    line 2: a list of objects linked into this module
    line 3: unresolved symbols (only when CONFIG_TRIM_UNUSED_KSYMS=y)

    Now that *.mod and *.ko are created in the same directory, the line 1
    provides no valuable information. It can be derived by replacing the
    extension .mod with .ko. In fact, nobody uses the first line any more.

    Cut down the first line.

    Signed-off-by: Masahiro Yamada

    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 551559e13af1 ("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 3a48a91901c5 ("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: Masahiro Yamada
    Acked-by: Nicolas Pitre

    Masahiro Yamada
     

17 Jul, 2019

4 commits

  • Currently, only the top-level modules.order drops duplicated entries.

    The modules.order files in sub-directories potentially contain
    duplication. To list out the paths of all modules, I want to use
    modules.order instead of parsing *.mod files in $(MODVERDIR).

    To achieve this, I want to rip off duplication from modules.order
    of external modules too.

    Signed-off-by: Masahiro Yamada

    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: Masahiro Yamada

    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: Masahiro Yamada

    Masahiro Yamada
     
  • It will be useful to control the header-test by a tristate option.

    If CONFIG_FOO is a tristate option, you can write like this:

    header-test-$(CONFIG_FOO) += foo.h

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

10 Jul, 2019

1 commit

  • Commit 25b146c5b8ce ("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: Masahiro Yamada

    Masahiro Yamada
     

09 Jul, 2019

1 commit

  • 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 abb2ea7dfd82 ("compiler,
    clang: suppress warning for unused static inline functions"), but we
    should not rely on that.

    Signed-off-by: Masahiro Yamada
    Acked-by: Jani Nikula
    Tested-by: Jani Nikula

    Masahiro Yamada
     

15 Jun, 2019

1 commit

  • Sometimes it's useful to be able to explicitly ensure certain headers
    remain self-contained, i.e. that they are compilable as standalone
    units, by including and/or forward declaring everything they depend on.

    Add special target header-test-y where individual Makefiles can add
    headers to be tested if CONFIG_HEADER_TEST is enabled. This will
    generate a dummy C file per header that gets built as part of extra-y.

    Signed-off-by: Jani Nikula
    Reviewed-by: Sam Ravnborg
    Signed-off-by: Masahiro Yamada

    Jani Nikula
     

09 May, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - allow users to invoke 'make' out of the source tree

    - refactor scripts/mkmakefile

    - deprecate KBUILD_SRC, which was used to track the source tree
    location for O= build.

    - fix recordmcount.pl in case objdump output is localized

    - turn unresolved symbols in external modules to errors from warnings
    by default; pass KBUILD_MODPOST_WARN=1 to get them back to warnings

    - generate modules.builtin.modinfo to collect .modinfo data from
    built-in modules

    - misc Makefile cleanups

    * tag 'kbuild-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (21 commits)
    .gitignore: add more all*.config patterns
    moduleparam: Save information about built-in modules in separate file
    Remove MODULE_ALIAS() calls that take undefined macro
    .gitignore: add leading and trailing slashes to generated directories
    scripts/tags.sh: fix direct execution of scripts/tags.sh
    scripts: override locale from environment when running recordmcount.pl
    samples: kobject: allow CONFIG_SAMPLE_KOBJECT to become y
    samples: seccomp: turn CONFIG_SAMPLE_SECCOMP into a bool option
    kbuild: move Documentation to vmlinux-alldirs
    kbuild: move samples/ to KBUILD_VMLINUX_OBJS
    modpost: make KBUILD_MODPOST_WARN also configurable for external modules
    kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build
    kbuild: remove unneeded dependency for include/config/kernel.release
    memory: squash drivers/memory/Makefile.asm-offsets
    kbuild: use $(srctree) instead of KBUILD_SRC to check out-of-tree build
    kbuild: mkmakefile: generate a simple wrapper of top Makefile
    kbuild: mkmakefile: do not check the generated Makefile marker
    kbuild: allow Kbuild to start from any directory
    kbuild: pass $(MAKECMDGOALS) to sub-make as is
    kbuild: fix warning "overriding recipe for target 'Makefile'"
    ...

    Linus Torvalds
     

03 Apr, 2019

1 commit

  • It is important that UACCESS regions are as small as possible;
    furthermore the UACCESS state is not scheduled, so doing anything that
    might directly call into the scheduler will cause random code to be
    ran with UACCESS enabled.

    Teach objtool too track UACCESS state and warn about any CALL made
    while UACCESS is enabled. This very much includes the __fentry__()
    and __preempt_schedule() calls.

    Note that exceptions _do_ save/restore the UACCESS state, and therefore
    they can drive preemption. This also means that all exception handlers
    must have an otherwise redundant UACCESS disable instruction;
    therefore ignore this warning for !STT_FUNC code (exception handlers
    are not normal functions).

    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Josh Poimboeuf
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

02 Apr, 2019

1 commit

  • KBUILD_SRC was conventionally used for some different purposes:
    [1] To remember the source tree path
    [2] As a flag to check if sub-make is already done
    [3] As a flag to check if Kbuild runs out of tree

    For [1], we do not need to remember it because the top Makefile
    can compute it by $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

    [2] has been replaced with self-commenting 'sub_make_done'.

    For [3], we can distinguish in-tree/out-of-tree by comparing
    $(srctree) and '.'

    This commit converts [3] to prepare for the KBUILD_SRC removal.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Mar, 2019

1 commit

  • CC_FLAGS_FTRACE may contain trailing whitespace that interferes with
    findstring.

    For example, commit 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on
    GCC 4.9 and newer") introduced a change such that on my ppc64le box,
    CC_FLAGS_FTRACE="-pg -mprofile-kernel ". (Note the trailing space.)
    When cmd_record_mcount is now invoked, findstring fails as the ftrace
    flags were found at very end of _c_flags, without the trailing space.

    _c_flags=" ... -pg -mprofile-kernel"
    CC_FLAGS_FTRACE="-pg -mprofile-kernel "
    ^
    findstring is looking for this extra space

    Remove the redundant whitespaces from CC_FLAGS_FTRACE in
    cmd_record_mcount to avoid this problem.

    [masahiro.yamada: This issue only happens in the released versions
    of GNU Make. CC_FLAGS_FTRACE will not contain the trailing space if
    you use the latest GNU Make, which contains commit b90fabc8d6f3
    ("* NEWS: Do not insert a space during '+=' if the value is empty.") ]

    Suggested-by: Masahiro Yamada (refactoring)
    Fixes: 6977f95e63b9 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer").
    Signed-off-by: Joe Lawrence
    Acked-by: Steven Rostedt (VMware)
    Signed-off-by: Masahiro Yamada

    Joe Lawrence
     

14 Mar, 2019

1 commit


27 Feb, 2019

1 commit

  • The genksyms source was integrated into the kernel tree in 2003.

    I do not expect anybody still using the external /sbin/genksyms.
    Kbuild does not need to provide the ability to override GENKSYMS.

    Let's remove the GENKSYMS variable, and use the hardcoded path.

    Since it occurred in the pre-git era, I attached the commit message
    in case somebody is interested in the historical background.

    | Author: Kai Germaschewski
    | Date: Wed Feb 19 04:17:28 2003 -0600
    |
    | kbuild: [PATCH] put genksyms in scripts dir
    |
    | This puts genksyms into scripts/genksyms/.
    |
    | genksyms used to be maintained externally, though the only possible user
    | was the kernel build. Moving it into the kernel sources makes it easier to
    | keep it uptodate, like for example updating it to generate linker scripts
    | directly instead of postprocessing the generated header file fragments
    | with sed, as we do currently.
    |
    | Also, genksyms does not handle __typeof__, which needs to be fixed since
    | some of the exported symbol in the kernel are defined using __typeof__.
    |
    | (Rusty Russell/me)

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

20 Feb, 2019

2 commits

  • Do not generate pointless modules.order when the module support is
    disabled.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Modern gcc adds view assignments, reset assertion checking in .loc
    directives and a couple more additional debug markers, which clutters
    the asm output unnecessarily:

    For example:

    bsp_resume:
    .LFB3466:
    .loc 1 1868 1 is_stmt 1 view -0
    .cfi_startproc
    .loc 1 1869 2 view .LVU73
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    .loc 1 1869 14 is_stmt 0 view .LVU74
    movq this_cpu(%rip), %rax # this_cpu, this_cpu
    movq 64(%rax), %rax # this_cpu.94_1->c_bsp_resume, _2
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    .loc 1 1869 5 view .LVU75
    testq %rax, %rax # _2
    je .L8 #,
    .loc 1 1870 3 is_stmt 1 view .LVU76
    movq $boot_cpu_data, %rdi #,
    jmp __x86_indirect_thunk_rax

    or
    .loc 2 57 9 view .LVU478
    .loc 2 57 9 view .LVU479
    .loc 2 57 9 view .LVU480
    .loc 2 57 9 view .LVU481
    .LBB1385:
    .LBB1383:
    .LBB1379:
    .LBB1377:
    .LBB1375:
    .loc 2 57 9 view .LVU482
    .loc 2 57 9 view .LVU483
    movl %edi, %edx # cpu, cpu
    .LVL87:
    .loc 2 57 9 is_stmt 0 view .LVU484

    That MOV in there is drowned in debugging information and latter makes
    it hard to follow the asm. And that DWARF info is not really needed for
    asm output staring.

    Disable the debug information generation which clutters the asm output
    unnecessarily:

    bsp_resume:
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    movq this_cpu(%rip), %rax # this_cpu, this_cpu
    movq 64(%rax), %rax # this_cpu.94_1->c_bsp_resume, _2
    # arch/x86/kernel/cpu/common.c:1869: if (this_cpu->c_bsp_resume)
    testq %rax, %rax # _2
    je .L8 #,
    # arch/x86/kernel/cpu/common.c:1870: this_cpu->c_bsp_resume(&boot_cpu_data);
    movq $boot_cpu_data, %rdi #,
    jmp __x86_indirect_thunk_rax
    .L8:
    # arch/x86/kernel/cpu/common.c:1871: }
    rep ret
    .size bsp_resume, .-bsp_resume

    [ bp: write commit message. ]

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Borislav Petkov

    Masahiro Yamada
     

28 Jan, 2019

3 commits

  • The commands surrounded by ( ) are executed in a subshell, but in
    most cases, we do not need to spawn an extra subshell.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • In Kbuild, if_changed and friends must have FORCE as a prerequisite.

    Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common
    idiom to get the names of all the prerequisites except phony targets.

    Add real-prereqs as a shorthand.

    Note:
    We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may
    include auto-generated dependencies from the .*.cmd file when a single
    object module is changed into a multi object module. Refer to commit
    69ea912fda74 ("kbuild: remove unneeded link_multi_deps"). I added some
    comment to avoid accidental breakage.

    Signed-off-by: Masahiro Yamada
    Acked-by: Rob Herring

    Masahiro Yamada
     
  • The symbol table in the final archive is unneeded; the linker does not
    require the symbol table after the --whole-archive option. Every object
    file in the archive is included in the link anyway.

    Pass thin archives from subdirectories directly to the linker, and
    remove the final archiving step.

    Fix up the document and comments as well.

    Signed-off-by: Masahiro Yamada
    Acked-by: Nicholas Piggin

    Masahiro Yamada
     

30 Dec, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:
    "Kbuild core:
    - remove unneeded $(call cc-option,...) switches
    - consolidate Clang compiler flags into CLANG_FLAGS
    - announce the deprecation of SUBDIRS
    - fix single target build for external module
    - simplify the dependencies of 'prepare' stage targets
    - allow fixdep to directly write to .*.cmd files
    - simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS
    - change if_changed_rule to accept multi-line recipe
    - move .SECONDARY special target to scripts/Kbuild.include
    - remove redundant 'set -e'
    - improve parallel execution for CONFIG_HEADERS_CHECK
    - misc cleanups

    Treewide fixes and cleanups
    - set Clang flags correctly for PowerPC boot images
    - fix UML build error with CONFIG_GCC_PLUGINS
    - remove unneeded patterns from .gitignore files
    - refactor firmware/Makefile
    - remove unneeded rules for *offsets.s
    - avoid unneeded regeneration of intermediate .s files
    - clean up ./Kbuild

    Modpost:
    - remove unused -M, -K options
    - fix false positive warnings about section mismatch
    - use simple devtable lookup instead of linker magic
    - misc cleanups

    Coccinelle:
    - relax boolinit.cocci checks for overall consistency
    - fix warning messages of boolinit.cocci

    Other tools:
    - improve -dirty check of scripts/setlocalversion
    - add a tool to generate compile_commands.json from .*.cmd files"

    * tag 'kbuild-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (51 commits)
    kbuild: remove unused cmd_gentimeconst
    kbuild: remove $(obj)/ prefixes in ./Kbuild
    treewide: add intermediate .s files to targets
    treewide: remove explicit rules for *offsets.s
    firmware: refactor firmware/Makefile
    firmware: remove unnecessary patterns from .gitignore
    scripts: remove unnecessary ihex2fw and check-lc_ctypes from .gitignore
    um: remove unused filechk_gen_header in Makefile
    scripts: add a tool to produce a compile_commands.json file
    kbuild: add -Werror=implicit-int flag unconditionally
    kbuild: add -Werror=strict-prototypes flag unconditionally
    kbuild: add -fno-PIE flag unconditionally
    scripts: coccinelle: Correct warning message
    scripts: coccinelle: only suggest true/false in files that already use them
    kbuild: handle part-of-module correctly for *.ll and *.symtypes
    kbuild: refactor part-of-module
    kbuild: refactor quiet_modtag
    kbuild: remove redundant quiet_modtag for $(obj-m)
    kbuild: refactor Makefile.asm-generic
    user/Makefile: Fix typo and capitalization in comment section
    ...

    Linus Torvalds
     

16 Dec, 2018

4 commits


02 Dec, 2018

1 commit

  • In commit 54a702f70589 ("kbuild: mark $(targets) as .SECONDARY and
    remove .PRECIOUS markers"), I missed one important feature of the
    .SECONDARY target:

    .SECONDARY with no prerequisites causes all targets to be
    treated as secondary.

    ... which agrees with the policy of Kbuild.

    Let's move it to scripts/Kbuild.include, with no prerequisites.

    Note:
    If an intermediate file is generated by $(call if_changed,...), you
    still need to add it to "targets" so its .*.cmd file is included.

    The arm/arm64 crypto files are generated by $(call cmd,shipped),
    so they do not need to be added to "targets", but need to be added
    to "clean-files" so "make clean" can properly clean them away.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 Dec, 2018

1 commit