24 Feb, 2020

1 commit

  • [ Upstream commit 88fe89a47153facd8cb2d06d5c8727f7224c43c2 ]

    Bartosz Golaszewski reports that when "make {menu,n,g,x}config" fails
    due to missing packages, a temporary file is left over, which is not
    ignored by git.

    For example, if GTK+ is not installed:

    $ make gconfig
    *
    * Unable to find the GTK+ installation. Please make sure that
    * the GTK+ 2.0 development package is correctly installed.
    * You need gtk+-2.0 gmodule-2.0 libglade-2.0
    *
    scripts/kconfig/Makefile:208: recipe for target 'scripts/kconfig/gconf-cfg' failed
    make[1]: *** [scripts/kconfig/gconf-cfg] Error 1
    Makefile:567: recipe for target 'gconfig' failed
    make: *** [gconfig] Error 2
    $ git status
    HEAD detached at v5.4
    Untracked files:
    (use "git add ..." to include in what will be committed)

    scripts/kconfig/gconf-cfg.tmp

    nothing added to commit but untracked files present (use "git add" to track)

    This is because the check scripts are run with filechk, which misses
    to clean up the temporary file on failure.

    When the line

    { $(filechk_$(1)); } > $@.tmp;

    ... fails, it exits immediately due to the 'set -e'. Use trap to make
    sure to delete the temporary file on exit.

    For extra safety, I replaced $@.tmp with $(dot-target).tmp to make it
    a hidden file.

    Reported-by: Bartosz Golaszewski
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

01 Oct, 2019

1 commit


27 Jul, 2019

1 commit


17 Jul, 2019

1 commit


13 Jul, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - remove headers_{install,check}_all targets

    - remove unreasonable 'depends on !UML' from CONFIG_SAMPLES

    - re-implement 'make headers_install' more cleanly

    - add new header-test-y syntax to compile-test headers

    - compile-test exported headers to ensure they are compilable in
    user-space

    - compile-test headers under include/ to ensure they are self-contained

    - remove -Waggregate-return, -Wno-uninitialized, -Wno-unused-value
    flags

    - add -Werror=unknown-warning-option for Clang

    - add 128-bit built-in types support to genksyms

    - fix missed rebuild of modules.builtin

    - propagate 'No space left on device' error in fixdep to Make

    - allow Clang to use its integrated assembler

    - improve some coccinelle scripts

    - add a new flag KBUILD_ABS_SRCTREE to request Kbuild to use absolute
    path for $(srctree).

    - do not ignore errors when compression utility is missing

    - misc cleanups

    * tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (49 commits)
    kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix
    kbuild: Inform user to pass ARCH= for make mrproper
    kbuild: fix compression errors getting ignored
    kbuild: add a flag to force absolute path for srctree
    kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree
    kbuild: remove src and obj from the top Makefile
    scripts/tags.sh: remove unused environment variables from comments
    scripts/tags.sh: drop SUBARCH support for ARM
    kbuild: compile-test kernel headers to ensure they are self-contained
    kheaders: include only headers into kheaders_data.tar.xz
    kheaders: remove meaningless -R option of 'ls'
    kbuild: support header-test-pattern-y
    kbuild: do not create wrappers for header-test-y
    kbuild: compile-test exported headers to ensure they are self-contained
    init/Kconfig: add CONFIG_CC_CAN_LINK
    kallsyms: exclude kasan local symbols on s390
    kbuild: add more hints about SUBDIRS replacement
    coccinelle: api/stream_open: treat all wait_.*() calls as blocking
    coccinelle: put_device: Add a cast to an expression for an assignment
    coccinelle: put_device: Adjust a message construction
    ...

    Linus Torvalds
     

11 Jul, 2019

1 commit

  • arch/mips/Makefile passes prefixes that start with '-' to cc-cross-prefix
    when $(tool-archpref) evaluates to the empty string.

    They are filtered-out before the $(shell ...) invocation. Otherwise,
    'command -v' would be confused.

    $ command -v -linux-gcc
    bash: command: -l: invalid option
    command: usage: command [-pVv] command [arg ...]

    Since commit 913ab9780fc0 ("kbuild: use more portable 'command -v' for
    cc-cross-prefix"), cc-cross-prefix throws away the stderr output, so
    the console is not polluted in any way.

    This is not a big deal in practice, but I see a slightly better taste
    in adding '--' to teach it that '-linux-gcc' is an argument instead of
    a command option.

    This will cause extra forking of subshell, but it will not be noticeable
    performance regression.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 Jul, 2019

3 commits

  • The string returned by $(filter-out ...) does not contain any leading
    or trailing spaces.

    With the previous commit, 'any-prereq' no longer contains any
    excessive spaces.

    Nor does 'cmd-check' since it expands to a $(filter-out ...) call.

    So, only the space that matters is the one between 'any-prereq'
    and 'cmd-check'.

    By removing it from the code, we can save $(strip ...) evaluation.
    This refactoring is possible because $(any-prereq)$(cmd-check) is only
    passed to the first argument of $(if ...), so we are only interested
    in whether or not it is empty.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The string returned by $(filter-out ...) does not contain any leading
    or trailing spaces.

    So, only the space that matters is the one between

    $(filter-out $(PHONY),$?)

    and

    $(filter-out $(PHONY) $(wildcard $^),$^)

    By removing it from the code, we can save $(strip ...) evaluation.
    This refactoring is possible because $(any-prereq) is only passed to
    the first argument of $(if ...), so we are only interested in whether
    or not it is empty.

    This is also the prerequisite for the next commit.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • I prefer 'cmd-check' for consistency.

    We have 'echo-cmd', 'cmd', 'cmd_and_fixdep', etc. in this file.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

15 Jun, 2019

2 commits

  • Now that hdr-inst is used only in the top Makefile, move it there
    from scripts/Kbuild.include.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The kbuild documentation clearly shows that the documents
    there are written at different times: some use markdown,
    some use their own peculiar logic to split sections.

    Convert everything to ReST without affecting too much
    the author's style and avoiding adding uneeded markups.

    The conversion is actually:
    - add blank lines and identation in order to identify paragraphs;
    - fix tables markups;
    - add some lists markups;
    - mark literal blocks;
    - adjust title markups.

    At its new index.rst, let's add a :orphan: while this is not linked to
    the main index.rst file, in order to avoid build warnings.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

07 Jun, 2019

1 commit

  • To print the pathname that will be used by shell in the current
    environment, 'command -v' is a standardized way. [1]

    'which' is also often used in scripts, but it is less portable.

    When I worked on commit bd55f96fa9fc ("kbuild: refactor cc-cross-prefix
    implementation"), I was eager to use 'command -v' but it did not work.
    (The reason is explained below.)

    I kept 'which' as before but got rid of '> /dev/null 2>&1' as I
    thought it was no longer needed. Sorry, I was wrong.

    It works well on my Ubuntu machine, but Alexey Brodkin reports noisy
    warnings on CentOS7 when 'which' fails to find the given command in
    the PATH environment.

    $ which foo
    which: no foo in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

    Given that behavior of 'which' depends on system (and it may not be
    installed by default), I want to try 'command -v' once again.

    The specification [1] clearly describes the behavior of 'command -v'
    when the given command is not found:

    Otherwise, no output shall be written and the exit status shall reflect
    that the name was not found.

    However, we need a little magic to use 'command -v' from Make.

    $(shell ...) passes the argument to a subshell for execution, and
    returns the standard output of the command.

    Here is a trick. GNU Make may optimize this by executing the command
    directly instead of forking a subshell, if no shell special characters
    are found in the command and omitting the subshell will not change the
    behavior.

    In this case, no shell special character is used. So, Make will try
    to run it directly. However, 'command' is a shell-builtin command,
    then Make would fail to find it in the PATH environment:

    $ make ARCH=m68k defconfig
    make: command: Command not found
    make: command: Command not found
    make: command: Command not found

    In fact, Make has a table of shell-builtin commands because it must
    ask the shell to execute them.

    Until recently, 'command' was missing in the table.

    This issue was fixed by the following commit:

    | commit 1af314465e5dfe3e8baa839a32a72e83c04f26ef
    | Author: Paul Smith
    | Date: Sun Nov 12 18:10:28 2017 -0500
    |
    | * job.c: Add "command" as a known shell built-in.
    |
    | This is not a POSIX shell built-in but it's common in UNIX shells.
    | Reported by Nick Bowler .

    Because the latest release is GNU Make 4.2.1 in 2016, this commit is
    not included in any released versions. (But some distributions may
    have back-ported it.)

    We need to trick Make to spawn a subshell. There are various ways to
    do so:

    1) Use a shell special character '~' as dummy

    $(shell : ~; command -v $(c)gcc)

    2) Use a variable reference that always expands to the empty string
    (suggested by David Laight)

    $(shell command$${x:+} -v $(c)gcc)

    3) Use redirect

    $(shell command -v $(c)gcc 2>/dev/null)

    I chose 3) to not confuse people. The stderr would not be polluted
    anyway, but it will provide extra safety, and is easy to understand.

    Tested on Make 3.81, 3.82, 4.0, 4.1, 4.2, 4.2.1

    [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html

    Fixes: bd55f96fa9fc ("kbuild: refactor cc-cross-prefix implementation")
    Cc: linux-stable # 5.1
    Reported-by: Alexey Brodkin
    Signed-off-by: Masahiro Yamada
    Tested-by: Alexey Brodkin

    Masahiro Yamada
     

31 May, 2019

1 commit

  • Add SPDX license identifiers to all Make/Kconfig files which:

    - Have no license information of any form

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0

    Reported-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman
    Reviewed-by: Kate Stewart
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

20 May, 2019

1 commit

  • If you want to see if your linker supports a certain flag, then ask the
    linker directly with ld-option (not the compiler with cc-ldoption).
    Checking for linker flag support is an antipattern that complicates the
    usage of various linkers other than bfd via -fuse-ld={bfd|gold|lld}.

    Cc: clang-built-linux@googlegroups.com
    Suggested-by: Masahiro Yamada
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada

    Nick Desaulniers
     

18 May, 2019

1 commit

  • The 'addtree' and 'flags' in scripts/Kbuild.include are so compilecated
    and ugly.

    As I mentioned in [1], Kbuild should stop automatic prefixing of header
    search path options.

    I fixed up (almost) all Makefiles in the kernel. Now 'addtree' and
    'flags' have been removed.

    Kbuild still caters to add $(srctree)/$(src) and $(objtree)/$(obj)
    to the header search path for O= building, but never touches extra
    compiler options from ccflags-y etc.

    [1]: https://patchwork.kernel.org/patch/9632347/

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

04 Mar, 2019

1 commit

  • There is no more direct user of this macro; it is only used by
    cc-ifversion.

    Calling this macro is not efficient since it invokes the compiler to
    get the compiler version. CONFIG_GCC_VERSION is already calculated in
    the Kconfig stage, so Makefile can reuse it.

    Here is a note about the slight difference between cc-version and
    CONFIG_GCC_VERSION:

    When using Clang, cc-version is evaluated to '0402' because Clang
    defines __GNUC__ and __GNUC__MINOR__, and looks like GCC 4.2 in the
    version point of view. On the other hand, CONFIG_GCC_VERSION=0
    when $(CC) is clang.

    There are currently two users of cc-ifversion:
    arch/mips/loongson64/Platform
    arch/powerpc/Makefile

    They are not affected by this change.

    The format of cc-version is , while CONFIG_GCC_VERSION
    . I adjusted cc-ifversion for the difference of
    the number of digits.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 Feb, 2019

1 commit

  • - $(word 1, ) is equivalent to $(firstword )

    - hardcode "gcc" instead of $(CC)

    - minimize the shell script part

    A little more notes in case $(filter-out -%, ...) is not clear.

    arch/mips/Makefile passes prefixes depending on the configuration.

    CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- \
    $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)

    In the Kconfig stage (e.g. when you run 'make defconfig'), neither
    CONFIG_32BIT nor CONFIG_64BIT is defined. So, $(tool-archpref) is
    empty. As a result, "-linux -linux-gnu- -unknown-linux-gnu" is passed
    into cc-cross-prefix. The command 'which' assumes arguments starting
    with a hyphen as command options, then emits the following messages:

    Illegal option -l
    Illegal option -l
    Illegal option -u

    I think it is strange to define CROSS_COMPILE depending on the CONFIG
    options since you need to feed $(CC) to Kconfig, but it is how MIPS
    Makefile currently works. Anyway, it would not hurt to filter-out
    invalid strings beforehand.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Jan, 2019

1 commit

  • 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
     

14 Jan, 2019

1 commit


06 Jan, 2019

2 commits


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
     

19 Dec, 2018

1 commit

  • …k around asm() related GCC inlining bugs"

    This reverts commit 77b0bf55bc675233d22cd5df97605d516d64525e.

    See this commit for details about the revert:

    e769742d3584 ("Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"")

    Conflicts:
    arch/x86/Makefile

    Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Reviewed-by: Borislav Petkov <bp@alien8.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: Richard Biener <rguenther@suse.de>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Segher Boessenkool <segher@kernel.crashing.org>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Nadav Amit <namit@vmware.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

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

5 commits

  • '@set -e; $(echo-cmd) $(cmd_$(1)' can be replaced with '$(cmd)'.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • With the change of rule_cc_o_c / rule_as_o_S in the last commit, each
    command is executed in a separate subshell. Rip off unneeded semicolons.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • The 'define' ... 'endef' directive is useful to confine a series of
    shell commands into a single macro:

    define foo
    [action1]
    [action2]
    [action3]
    endif

    Each action is executed in a separate subshell.

    However, rule_cc_o_c and rule_as_o_S in scripts/Makefile.build are
    written as follows (with a trailing semicolon in each cmd_*):

    define rule_cc_o_c
    [action1] ; \
    [action2] ; \
    [action3] ;
    endef

    All shell commands are concatenated with '; \' so that it looks like
    a single command from the Makefile point of view. This does not
    exploit the benefits of 'define' ... 'endef' form because a single
    shell command can be more simply written, like this:

    rule_cc_o_c = \
    [action1] ; \
    [action2] ; \
    [action3] ;

    I guess the intention for the command concatenation was to let the
    '@set -e' in if_changed_rule cover all the commands.

    We can improve the readability by moving '@set -e' to the 'cmd' macro.
    The combo of $(call echo-cmd,*) $(cmd_*) in rule_cc_o_c and rule_as_o_S
    have been replaced with $(call cmd,*). The trailing back-slashes have
    been removed.

    Here is a note about the performance: the commands in rule_cc_o_c and
    rule_as_o_S were previously executed all together in a single subshell,
    but now each line in a separate subshell. This means Make will spawn
    extra subshells [1]. I measured the build performance for
    x86_64_defconfig + CONFIG_MODVERSIONS + CONFIG_TRIM_UNUSED_KSYMS
    and I saw slight performance regression, but I believe code readability
    and maintainability wins.

    [1] Precisely, GNU Make may optimize this by executing the command
    directly instead of forking a subshell, if no shell special
    characters are found in the command line and omitting the subshell
    will not change the behavior.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • My main motivation of this commit is to clean up scripts/Kbuild.include
    and scripts/Makefile.build.

    Currently, CONFIG_TRIM_UNUSED_KSYMS works with a tricky gimmick;
    possibly exported symbols are detected by letting $(CPP) replace
    EXPORT_SYMBOL* with a special string '=== __KSYM_*===', which is
    post-processed by sed, and passed to fixdep. The extra preprocessing
    is costly, and hacking cmd_and_fixdep is ugly.

    I came up with a new way to find exported symbols; insert a dummy
    symbol __ksym_marker_* to each potentially exported symbol. Those
    dummy symbols are picked up by $(NM), post-processed by sed, then
    appended to .*.cmd files. I collected the post-process part to a
    new shell script scripts/gen_ksymdeps.sh for readability. The dummy
    symbols are put into the .discard.* section so that the linker
    script rips them off the final vmlinux or modules.

    A nice side-effect is building with CONFIG_TRIM_UNUSED_KSYMS will
    be much faster.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nicolas Pitre

    Masahiro Yamada
     
  • Currently, fixdep writes dependencies to .*.tmp, which is renamed to
    .*.cmd after everything succeeds. This is a very safe way to avoid
    corrupted .*.cmd files. The if_changed_dep has carried this safety
    mechanism since it was added in 2002.

    If fixdep fails for some reasons or a user terminates the build while
    fixdep is running, the incomplete output from the fixdep could be
    troublesome.

    This is my insight about some bad scenarios:

    [1] If the compiler succeeds to generate *.o file, but fixdep fails
    to write necessary dependencies to .*.cmd file, Make will miss
    to rebuild the object when headers or CONFIG options are changed.
    In this case, fixdep should not generate .*.cmd file at all so
    that 'arg-check' will surely trigger the rebuild of the object.

    [2] A partially constructed .*.cmd file may not be a syntactically
    correct makefile. The next time Make runs, it would include it,
    then fail to parse it. Once this happens, 'make clean' is be the
    only way to fix it.

    In fact, [1] is no longer a problem since commit 9c2af1c7377a ("kbuild:
    add .DELETE_ON_ERROR special target"). Make deletes a target file on
    any failure in its recipe. Because fixdep is a part of the recipe of
    *.o target, if it fails, the *.o is deleted anyway. However, I am a
    bit worried about the slight possibility of [2].

    So, here is a solution. Let fixdep directly write to a .*.cmd file,
    but allow makefiles to include it only when its corresponding target
    exists.

    This effectively reverts commit 2982c953570b ("kbuild: remove redundant
    $(wildcard ...) for cmd_files calculation"), and commit 00d78ab2ba75
    ("kbuild: remove dead code in cmd_files calculation in top Makefile")
    because now we must check the presence of targets.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

02 Nov, 2018

1 commit

  • There is one more user of $(cc-name) in the top Makefile. It is supposed
    to detect Clang before invoking Kconfig, so it should still be there
    in the $(shell ...) form. All the other users of $(cc-name) have been
    replaced with $(CONFIG_CC_IS_CLANG). Hence, scripts/Kbuild.include does
    not need to define cc-name any more.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 Nov, 2018

1 commit


29 Oct, 2018

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - optimize kallsyms slightly

    - remove check for old CFLAGS usage

    - add some compiler flags unconditionally instead of evaluating
    $(call cc-option,...)

    - fix variable shadowing in host tools

    - refactor scripts/mkmakefile

    - refactor various makefiles

    * tag 'kbuild-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    modpost: Create macro to avoid variable shadowing
    ASN.1: Remove unnecessary shadowed local variable
    kbuild: use 'else ifeq' for checksrc to improve readability
    kbuild: remove unneeded link_multi_deps
    kbuild: add -Wno-unused-but-set-variable flag unconditionally
    kbuild: add -Wdeclaration-after-statement flag unconditionally
    kbuild: add -Wno-pointer-sign flag unconditionally
    modpost: remove leftover symbol prefix handling for module device table
    kbuild: simplify command line creation in scripts/mkmakefile
    kbuild: do not pass $(objtree) to scripts/mkmakefile
    kbuild: remove user ID check in scripts/mkmakefile
    kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile
    kbuild: add --include-dir flag only for out-of-tree build
    kbuild: remove dead code in cmd_files calculation in top Makefile
    kbuild: hide most of targets when running config or mixed targets
    kbuild: remove old check for CFLAGS use
    kbuild: prefix Makefile.dtbinst path with $(srctree) unconditionally
    kallsyms: remove left-over Blackfin code
    kallsyms: reduce size a little on 64-bit

    Linus Torvalds
     

04 Oct, 2018

1 commit

  • … asm() related GCC inlining bugs

    Using macros in inline assembly allows us to work around bugs
    in GCC's inlining decisions.

    Compile macros.S and use it to assemble all C files.
    Currently only x86 will use it.

    Background:

    The inlining pass of GCC doesn't include an assembler, so it's not aware
    of basic properties of the generated code, such as its size in bytes,
    or that there are such things as discontiuous blocks of code and data
    due to the newfangled linker feature called 'sections' ...

    Instead GCC uses a lazy and fragile heuristic: it does a linear count of
    certain syntactic and whitespace elements in inlined assembly block source
    code, such as a count of new-lines and semicolons (!), as a poor substitute
    for "code size and complexity".

    Unsurprisingly this heuristic falls over and breaks its neck whith certain
    common types of kernel code that use inline assembly, such as the frequent
    practice of putting useful information into alternative sections.

    As a result of this fresh, 20+ years old GCC bug, GCC's inlining decisions
    are effectively disabled for inlined functions that make use of such asm()
    blocks, because GCC thinks those sections of code are "large" - when in
    reality they are often result in just a very low number of machine
    instructions.

    This absolute lack of inlining provess when GCC comes across such asm()
    blocks both increases generated kernel code size and causes performance
    overhead, which is particularly noticeable on paravirt kernels, which make
    frequent use of these inlining facilities in attempt to stay out of the
    way when running on baremetal hardware.

    Instead of fixing the compiler we use a workaround: we set an assembly macro
    and call it from the inlined assembly block. As a result GCC considers the
    inline assembly block as a single instruction. (Which it often isn't but I digress.)

    This uglifies and bloats the source code - for example just the refcount
    related changes have this impact:

    Makefile | 9 +++++++--
    arch/x86/Makefile | 7 +++++++
    arch/x86/kernel/macros.S | 7 +++++++
    scripts/Kbuild.include | 4 +++-
    scripts/mod/Makefile | 2 ++
    5 files changed, 26 insertions(+), 3 deletions(-)

    Yay readability and maintainability, it's not like assembly code is hard to read
    and maintain ...

    We also hope that GCC will eventually get fixed, but we are not holding
    our breath for that. Yet we are optimistic, it might still happen, any decade now.

    [ mingo: Wrote new changelog describing the background. ]

    Tested-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Nadav Amit <namit@vmware.com>
    Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Michal Marek <michal.lkml@markovi.net>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: linux-kbuild@vger.kernel.org
    Link: http://lkml.kernel.org/r/20181003213100.189959-3-namit@vmware.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Nadav Amit
     

12 Sep, 2018

1 commit


30 Aug, 2018

1 commit

  • Commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6")
    bumped the minimum GCC version to 4.6 for all architectures.

    Remove the workaround code.

    It was the only user of cc-if-fullversion. Remove the macro as well.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Michal Marek
    Cc: linux-kbuild@vger.kernel.org
    Link: https://lkml.kernel.org/r/1535348714-25457-1-git-send-email-yamada.masahiro@socionext.com

    Masahiro Yamada
     

24 Aug, 2018

1 commit

  • Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add
    additional options to CC") renamed CFLAGS to KBUILD_CFLAGS.

    Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add
    additional options to AS") renamed AFLAGS to KBUILD_AFLAGS.

    Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add
    additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS.

    For some reason, LDFLAGS was not renamed.

    Using a well-known variable like LDFLAGS may result in accidental
    override of the variable.

    Kbuild generally uses KBUILD_ prefixed variables for the internally
    appended options, so here is one more conversion to sanitize the
    naming convention.

    I did not touch Makefiles under tools/ since the tools build system
    is a different world.

    Signed-off-by: Masahiro Yamada
    Acked-by: Kirill A. Shutemov
    Reviewed-by: Palmer Dabbelt

    Masahiro Yamada
     

16 Aug, 2018

2 commits

  • Pull Kconfig updates from Masahiro Yamada:

    - show clearer error messages where pkg-config is needed, but not
    installed

    - rename SYMBOL_AUTO to SYMBOL_NO_WRITE to reflect its semantics

    - create all necessary directories by Kconfig tool itself instead of
    Makefile

    - update the .config unconditionally when syncconfig is invoked

    - use 'include' directive instead of '-include' where
    include/config/{auto,tristate}.conf is mandatory

    - do not try to update the .config when running install targets

    - add .DELETE_ON_ERROR to delete partially updated files

    - misc cleanups and fixes

    * tag 'kconfig-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: remove P_ENV property type
    kconfig: remove unused sym_get_env_prop() function
    kconfig: fix the rule of mainmenu_stmt symbol
    init/Kconfig: Use short unix-style option instead of --longname
    Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory
    kbuild: remove auto.conf from prerequisite of phony targets
    kbuild: do not update config for 'make kernelrelease'
    kbuild: do not update config when running install targets
    kbuild: add .DELETE_ON_ERROR special target
    kbuild: use 'include' directive to load auto.conf from top Makefile
    kconfig: allow all config targets to write auto.conf if missing
    kconfig: make syncconfig update .config regardless of sym_change_count
    kconfig: create directories needed for syncconfig by itself
    kconfig: remove unneeded directory generation from local*config
    kconfig: split out useful helpers in confdata.c
    kconfig: rename file_write_dep and move it to confdata.c
    kconfig: fix typos in description of "choice" in kconfig-language.txt
    kconfig: handle format string before calling conf_message_callback()
    kconfig: rename SYMBOL_AUTO to SYMBOL_NO_WRITE
    kconfig: check for pkg-config on make {menu,n,g,x}config

    Linus Torvalds
     
  • Pull Kbuild updates from Masahiro Yamada:

    - verify depmod is installed before modules_install

    - support build salt in case build ids must be unique between builds

    - allow users to specify additional host compiler flags via HOST*FLAGS,
    and rename internal variables to KBUILD_HOST*FLAGS

    - update buildtar script to drop vax support, add arm64 support

    - update builddeb script for better debarch support

    - document the pit-fall of if_changed usage

    - fix parallel build of UML with O= option

    - make 'samples' target depend on headers_install to fix build errors

    - remove deprecated host-progs variable

    - add a new coccinelle script for refcount_t vs atomic_t check

    - improve double-test coccinelle script

    - misc cleanups and fixes

    * tag 'kbuild-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits)
    coccicheck: return proper error code on fail
    Coccinelle: doubletest: reduce side effect false positives
    kbuild: remove deprecated host-progs variable
    kbuild: make samples really depend on headers_install
    um: clean up archheaders recipe
    kbuild: add %asm-generic to no-dot-config-targets
    um: fix parallel building with O= option
    scripts: Add Python 3 support to tracing/draw_functrace.py
    builddeb: Add automatic support for sh{3,4}{,eb} architectures
    builddeb: Add automatic support for riscv* architectures
    builddeb: Add automatic support for m68k architecture
    builddeb: Add automatic support for or1k architecture
    builddeb: Add automatic support for sparc64 architecture
    builddeb: Add automatic support for mips{,64}r6{,el} architectures
    builddeb: Add automatic support for mips64el architecture
    builddeb: Add automatic support for ppc64 and powerpcspe architectures
    builddeb: Introduce functions to simplify kconfig tests in set_debarch
    builddeb: Drop check for 32-bit s390
    builddeb: Change architecture detection fallback to use dpkg-architecture
    builddeb: Skip architecture detection when KBUILD_DEBARCH is set
    ...

    Linus Torvalds
     

15 Aug, 2018

1 commit

  • Pull arm64 updates from Will Deacon:
    "A bunch of good stuff in here. Worth noting is that we've pulled in
    the x86/mm branch from -tip so that we can make use of the core
    ioremap changes which allow us to put down huge mappings in the
    vmalloc area without screwing up the TLB. Much of the positive
    diffstat is because of the rseq selftest for arm64.

    Summary:

    - Wire up support for qspinlock, replacing our trusty ticket lock
    code

    - Add an IPI to flush_icache_range() to ensure that stale
    instructions fetched into the pipeline are discarded along with the
    I-cache lines

    - Support for the GCC "stackleak" plugin

    - Support for restartable sequences, plus an arm64 port for the
    selftest

    - Kexec/kdump support on systems booting with ACPI

    - Rewrite of our syscall entry code in C, which allows us to zero the
    GPRs on entry from userspace

    - Support for chained PMU counters, allowing 64-bit event counters to
    be constructed on current CPUs

    - Ensure scheduler topology information is kept up-to-date with CPU
    hotplug events

    - Re-enable support for huge vmalloc/IO mappings now that the core
    code has the correct hooks to use break-before-make sequences

    - Miscellaneous, non-critical fixes and cleanups"

    * tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (90 commits)
    arm64: alternative: Use true and false for boolean values
    arm64: kexec: Add comment to explain use of __flush_icache_range()
    arm64: sdei: Mark sdei stack helper functions as static
    arm64, kaslr: export offset in VMCOREINFO ELF notes
    arm64: perf: Add cap_user_time aarch64
    efi/libstub: Only disable stackleak plugin for arm64
    arm64: drop unused kernel_neon_begin_partial() macro
    arm64: kexec: machine_kexec should call __flush_icache_range
    arm64: svc: Ensure hardirq tracing is updated before return
    arm64: mm: Export __sync_icache_dcache() for xen-privcmd
    drivers/perf: arm-ccn: Use devm_ioremap_resource() to map memory
    arm64: Add support for STACKLEAK gcc plugin
    arm64: Add stack information to on_accessible_stack
    drivers/perf: hisi: update the sccl_id/ccl_id when MT is supported
    arm64: fix ACPI dependencies
    rseq/selftests: Add support for arm64
    arm64: acpi: fix alignment fault in accessing ACPI
    efi/arm: map UEFI memory map even w/o runtime services enabled
    efi/arm: preserve early mapping of UEFI memory map longer for BGRT
    drivers: acpi: add dependency of EFI for arm64
    ...

    Linus Torvalds
     

28 Jul, 2018

1 commit