26 Sep, 2018

1 commit

  • [ Upstream commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0 ]

    If Make gets a fatal signal while a shell is executing, it may delete
    the target file that the recipe was supposed to update. This is needed
    to make sure that it is remade from scratch when Make is next run; if
    Make is interrupted after the recipe has begun to write the target file,
    it results in an incomplete file whose time stamp is newer than that
    of the prerequisites files. Make automatically deletes the incomplete
    file on interrupt unless the target is marked .PRECIOUS.

    The situation is just the same as when the shell fails for some reasons.
    Usually when a recipe line fails, if it has changed the target file at
    all, the file is corrupted, or at least it is not completely updated.
    Yet the file’s time stamp says that it is now up to date, so the next
    time Make runs, it will not try to update that file.

    However, Make does not cater to delete the incomplete target file in
    this case. We need to add .DELETE_ON_ERROR somewhere in the Makefile
    to request it.

    scripts/Kbuild.include seems a suitable place to add it because it is
    included from almost all sub-makes.

    Please note .DELETE_ON_ERROR is not effective for phony targets.

    The external module building should never ever touch the kernel tree.
    The following recipe fails if include/generated/autoconf.h is missing.
    However, include/config/auto.conf is not deleted since it is a phony
    target.

    PHONY += include/config/auto.conf

    include/config/auto.conf:
    $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
    echo >&2; \
    echo >&2 " ERROR: Kernel configuration is invalid."; \
    echo >&2 " include/generated/autoconf.h or $@ are missing.";\
    echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
    echo >&2 ; \
    /bin/false)

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     

11 Jul, 2018

1 commit

  • commit 9564a8cf422d7b58f6e857e3546d346fa970191e upstream.

    I tried building using a freshly built Make (4.2.1-69-g8a731d1), but
    already the objtool build broke with

    orc_dump.c: In function ‘orc_dump’:
    orc_dump.c:106:2: error: ‘elf_getshnum’ is deprecated [-Werror=deprecated-declarations]
    if (elf_getshdrnum(elf, &nr_sections)) {

    Turns out that with that new Make, the backslash was not removed, so cpp
    didn't see a #include directive, grep found nothing, and
    -DLIBELF_USE_DEPRECATED was wrongly put in CFLAGS.

    Now, that new Make behaviour is documented in their NEWS file:

    * WARNING: Backward-incompatibility!
    Number signs (#) appearing inside a macro reference or function invocation
    no longer introduce comments and should not be escaped with backslashes:
    thus a call such as:
    foo := $(shell echo '#')
    is legal. Previously the number sign needed to be escaped, for example:
    foo := $(shell echo '\#')
    Now this latter will resolve to "\#". If you want to write makefiles
    portable to both versions, assign the number sign to a variable:
    C := \#
    foo := $(shell echo '$C')
    This was claimed to be fixed in 3.81, but wasn't, for some reason.
    To detect this change search for 'nocomment' in the .FEATURES variable.

    This also fixes up the two make-cmd instances to replace # with $(pound)
    rather than with \#. There might very well be other places that need
    similar fixup in preparation for whatever future Make release contains
    the above change, but at least this builds an x86_64 defconfig with the
    new make.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
    Cc: Randy Dunlap
    Signed-off-by: Rasmus Villemoes
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Kroah-Hartman

    Rasmus Villemoes
     

24 Mar, 2018

1 commit

  • commit 86a9df597cdd564d2d29c65897bcad42519e3678 upstream.

    I was not seeing my linker flags getting added when using ld-option when
    cross compiling with Clang. Upon investigation, this seems to be due to
    a difference in how GCC vs Clang handle cross compilation.

    GCC is configured at build time to support one backend, that is implicit
    when compiling. Clang is explicit via the use of `-target ` and
    ships with all supported backends by default.

    GNU Make feature test macros that compile then link will always fail
    when cross compiling with Clang unless Clang's triple is passed along to
    the compiler. For example:

    $ clang -x c /dev/null -c -o temp.o
    $ aarch64-linux-android/bin/ld -E temp.o
    aarch64-linux-android/bin/ld:
    unknown architecture of input file `temp.o' is incompatible with
    aarch64 output
    aarch64-linux-android/bin/ld:
    warning: cannot find entry symbol _start; defaulting to
    0000000000400078
    $ echo $?
    1

    $ clang -target aarch64-linux-android- -x c /dev/null -c -o temp.o
    $ aarch64-linux-android/bin/ld -E temp.o
    aarch64-linux-android/bin/ld:
    warning: cannot find entry symbol _start; defaulting to 00000000004002e4
    $ echo $?
    0

    This causes conditional checks that invoke $(CC) without the target
    triple, then $(LD) on the result, to always fail.

    Suggested-by: Masahiro Yamada
    Signed-off-by: Nick Desaulniers
    Reviewed-by: Matthias Kaehlcke
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Greg Hackmann
    Signed-off-by: Greg Kroah-Hartman

    Nick Desaulniers
     

09 Aug, 2017

1 commit


25 Jun, 2017

2 commits

  • cc-option uses KBUILD_CFLAGS and KBUILD_CPPFLAGS when it determines
    whether an option is supported or not. This is fine for options used to
    build the kernel itself, however some components like the x86 boot code
    use a different set of flags.

    Add the new macro __cc-option which is a more generic version of
    cc-option with additional parameters. One parameter is the compiler
    with which the check should be performed, the other the compiler options
    to be used instead KBUILD_C*FLAGS.

    Refactor cc-option and hostcc-option to use __cc-option and move
    hostcc-option to scripts/Kbuild.include.

    Suggested-by: Arnd Bergmann
    Suggested-by: Masahiro Yamada
    Signed-off-by: Matthias Kaehlcke
    Acked-by: Arnd Bergmann
    Acked-by: Michal Marek
    Signed-off-by: Masahiro Yamada

    Matthias Kaehlcke
     
  • Documentation/kbuild/makefiles.txt says the change for align options
    occurred at GCC 3.0, and Documentation/process/changes.rst says the
    minimal supported GCC version is 3.2, so it should be safe to hard-code
    -falign* options.

    Fix the only user arch/x86/Makefile_32.cpu and remove cc-option-align.

    Signed-off-by: Masahiro Yamada
    Acked-by: Ingo Molnar

    Masahiro Yamada
     

11 May, 2017

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - improve Clang support

    - clean up various Makefiles

    - improve build log visibility (objtool, alpha, ia64)

    - improve compiler flag evaluation for better build performance

    - fix GCC version-dependent warning

    - fix genksyms

    * tag 'kbuild-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (23 commits)
    kbuild: dtbinst: remove unnecessary __dtbs_install_prep target
    ia64: beatify build log for gate.so and gate-syms.o
    alpha: make short build log available for division routines
    alpha: merge build rules of division routines
    alpha: add $(src)/ rather than $(obj)/ to make source file path
    Makefile: evaluate LDFLAGS_BUILD_ID only once
    objtool: make it visible in make V=1 output
    kbuild: clang: add -no-integrated-as to KBUILD_[AC]FLAGS
    kbuild: Add support to generate LLVM assembly files
    kbuild: Add better clang cross build support
    kbuild: drop -Wno-unknown-warning-option from clang options
    kbuild: fix asm-offset generation to work with clang
    kbuild: consolidate redundant sed script ASM offset generation
    frv: Use OFFSET macro in DEF_*REG()
    kbuild: avoid conflict between -ffunction-sections and -pg on gcc-4.7
    kbuild: Consolidate header generation from ASM offset information
    kbuild: use -Oz instead of -Os when using clang
    kbuild, LLVMLinux: Add -Werror to cc-option to support clang
    Kbuild: make designated_init attribute fatal
    kbuild: drop unneeded patterns '.*.orig' and '.*.rej' from distclean
    ...

    Linus Torvalds
     

12 Apr, 2017

1 commit

  • Clang will warn about unknown warnings but will not return false
    unless -Werror is set. GCC will return false if an unknown
    warning is passed.

    Adding -Werror make both compiler behave the same.

    [arnd: it turns out we need the same patch for testing whether -ffunction-sections
    works right with gcc. I've build tested extensively with this patch
    applied, so let's just merge this one now.]

    Signed-off-by: Mark Charlebois
    Signed-off-by: Behan Webster
    Reviewed-by: Jan-Simon Möller
    Signed-off-by: Arnd Bergmann
    Acked-by: Kees Cook
    Signed-off-by: Masahiro Yamada

    Mark Charlebois
     

30 Mar, 2017

1 commit

  • The GCC '-maccumulate-outgoing-args' flag is enabled for most configs,
    mostly because of issues which are no longer relevant. For most
    configs, and with most recent versions of GCC, it's no longer needed.

    Clarify which cases need it, and only enable it for those cases. Also
    produce a compile-time error for the ftrace graph + mcount + '-Os' case,
    which will otherwise cause runtime failures.

    The main benefit of '-maccumulate-outgoing-args' is that it prevents an
    ugly prologue for functions which have aligned stacks. But removing the
    option also has some benefits: more readable argument saves, smaller
    text size, and (presumably) slightly improved performance.

    Here are the object size savings for 32-bit and 64-bit defconfig
    kernels:

    text data bss dec hex filename
    10006710 3543328 1773568 15323606 e9d1d6 vmlinux.x86-32.before
    9706358 3547424 1773568 15027350 e54c96 vmlinux.x86-32.after

    text data bss dec hex filename
    10652105 4537576 843776 16033457 f4a6b1 vmlinux.x86-64.before
    10639629 4537576 843776 16020981 f475f5 vmlinux.x86-64.after

    That comes out to a 3% text size improvement on x86-32 and a 0.1% text
    size improvement on x86-64.

    Signed-off-by: Josh Poimboeuf
    Cc: Andrew Lutomirski
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: Linus Torvalds
    Cc: Pavel Machek
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20170316193133.zrj6gug53766m6nn@treble
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

14 Feb, 2017

1 commit

  • Add a new command cpp_its_S introduced in commit cf2a5e0bb4c6 ("MIPS:
    Support generating Flattened Image Trees (.itb)") to ksym_dep_filter
    handler - otherwise a warning is produced during the build of MIPS
    platforms (when vmlinux.*.itb target is chosen).

    Signed-off-by: Marcin Nowakowski
    Cc: Michal Marek
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/15278/
    Signed-off-by: James Hogan

    Marcin Nowakowski
     

09 Aug, 2016

1 commit

  • The gcc-plugins arguments should not be included when performing
    cc-option tests.

    Steps to reproduce:
    1) make mrproper
    2) make defconfig
    3) enable GCC_PLUGINS, GCC_PLUGIN_CYC_COMPLEXITY
    4) enable FUNCTION_TRACER (it will select other options as well)
    5) make && make modules

    Build errors:
    MODPOST 18 modules
    ERROR: "__fentry__" [net/netfilter/xt_nat.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/xt_mark.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/xt_addrtype.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/xt_LOG.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/nf_nat_sip.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/nf_nat_irc.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/nf_nat_ftp.ko] undefined!
    ERROR: "__fentry__" [net/netfilter/nf_nat.ko] undefined!

    Reported-by: Laura Abbott
    Signed-off-by: Emese Revfy
    [kees: renamed variable, clarified commit message]
    Signed-off-by: Kees Cook

    Emese Revfy
     

19 Jul, 2016

2 commits

  • When building with separate object directories and driver specific
    Makefiles that add additional header include paths, Kbuild adjusts
    the gcc flags so that we include both the directory in the source
    tree and in the object tree.

    However, due to another bug I fixed earlier, this did not actually
    include the correct directory in the object tree, so we know that
    we only really need the source tree here. Also, including the
    object tree sometimes causes warnings about nonexisting directories
    when the include path only exists in the source.

    This changes the logic to only emit the -I argument for the srctree,
    not for objects. We still need both $(srctree)/$(src) and $(obj)
    though, so I'm adding them manually.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Michal Marek

    Arnd Bergmann
     
  • When we build with O=objdir and objdir is directly below the source tree,
    $(srctree) becomes '..'.

    When a Makefile adds a CFLAGS option like -Ipath/to/headers and
    we are building with a separate object directory, Kbuild tries to
    add two -I options, one for the source tree and one for the object
    tree. An absolute path is treated as a special case, and don't add
    this one twice. This also normally catches -I$(srctree)/$(src)
    as $(srctree) usually is an absolute directory like /home/arnd/linux/.

    The combination of the two behaviors however results in an invalid
    path name to be included: we get both ../$(src) and ../../$(src),
    the latter one pointing outside of the source tree, usually to a
    nonexisting directory. Building with 'make W=1' makes this obvious:

    cc1: error: ../../arch/arm/mach-s3c24xx/include: No such file or directory [-Werror=missing-include-dirs]

    This adds another special case, treating path names starting with ../
    like those starting with / so we don't try to prefix that with
    $(srctree).

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Michal Marek

    Arnd Bergmann
     

11 May, 2016

1 commit

  • Currently, arg-check is implemented as follows:

    arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
    $(filter-out $(cmd_$@), $(cmd_$(1))) )

    This does not care about the order of arguments that appear in
    $(cmd_$(1)) and $(cmd_$@). So, if_changed and friends never rebuild
    the target if only the argument order is changed. This is a problem
    when the link order is changed.

    Apparently,

    obj-y += foo.o
    obj-y += bar.o

    and

    obj-y += bar.o
    obj-y += foo.o

    should be distinguished because the link order determines the probe
    order of drivers. So, built-in.o should be rebuilt when the order
    of objects is changed.

    This commit fixes arg-check to compare the old/current commands
    including the argument order.

    Of course, this change has a side effect; Kbuild will react to the
    change of compile option order. For example, "-DFOO -DBAR" and
    "-DBAR -DFOO" should give no difference to the build result, but
    false positive should be better than false negative.

    I am moving space_escape to the top of Kbuild.include just for a
    matter of preference. In practical terms, space_escape can be
    defined after arg-check because arg-check uses "=" flavor, not ":=".
    Having said that, collecting convenient variables in one place makes
    sense from the point of readability.

    Chaining "%%%SPACE%%%" to "_-_SPACE_-_" is also a matter of taste
    at this point. Actually, it can be arbitrary as long as it is an
    unlikely used string. The only problem I see in "%%%SPACE%%%" is
    that "%" is a special character in "$(patsubst ...)" context. This
    commit just uses "$(subst ...)" for arg-check, but I am fixing it now
    in case we might want to use it in $(patsubst ...) context in the
    future.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

10 May, 2016

1 commit

  • In kernel/cgroup.c there is:

    #define SUBSYS(_x) \
    DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key); \
    DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key); \
    EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key); \
    EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key);

    The expansion of this macro causes multiple EXPORT_SYMBOL_GPL() instances
    to appear on the same preprocessor line output, confusing the sed script
    expecting only one of them per line. Unfortunately this can't be fixed
    nicely in the sed script as sed's regexp can't do non greedy matching.

    Fix this by turning any semicolon into a line break before filtering.

    Reported-by: Arnd Bergmann
    Signed-off-by: Nicolas Pitre
    Signed-off-by: Michal Marek

    Nicolas Pitre
     

27 Apr, 2016

1 commit


30 Mar, 2016

2 commits

  • Like with kconfig options, we now have the ability to compile in and
    out individual EXPORT_SYMBOL() declarations based on the content of
    include/generated/autoksyms.h. However we don't want the entire
    world to be rebuilt whenever that file is touched.

    Let's apply the same build dependency trick used for CONFIG_* symbols
    where the time stamp of empty files whose paths matching those symbols
    is used to trigger fine grained rebuilds. In our case the key is the
    symbol name passed to EXPORT_SYMBOL().

    However, unlike config options, we cannot just use fixdep to parse
    the source code for EXPORT_SYMBOL(ksym) because several variants exist
    and parsing them all in a separate tool, and keeping it in synch, is
    not trivially maintainable. Furthermore, there are variants such as

    EXPORT_SYMBOL_GPL(pci_user_read_config_##size);

    that are instanciated via a macro for which we can't easily determine
    the actual exported symbol name(s) short of actually running the
    preprocessor on them.

    Storing the symbol name string in a special ELF section doesn't work
    for targets that output assembly or preprocessed source.

    So the best way is really to leverage the preprocessor by having it
    output actual symbol names anchored by a special sequence that can be
    easily filtered out. Then the list of symbols is simply fed to fixdep
    to be merged with the other dependencies.

    That implies the preprocessor is executed twice for each source file.
    A previous attempt relied on a warning pragma for each EXPORT_SYMBOL()
    instance that was filtered apart from stderr by the build system with
    a sed script during the actual compilation pass. Unfortunately the
    preprocessor/compiler diagnostic output isn't stable between versions
    and this solution, although more efficient, was deemed too fragile.

    Because of the lowercasing performed by fixdep, there might be name
    collisions triggering spurious rebuilds for similar symbols. But this
    shouldn't be a big issue in practice. (This is the case for CONFIG_*
    symbols and I didn't want to be different here, whatever the original
    reason for doing so.)

    To avoid needless build overhead, the exported symbol name gathering is
    performed only when CONFIG_TRIM_UNUSED_KSYMS is selected.

    Signed-off-by: Nicolas Pitre
    Acked-by: Rusty Russell

    Nicolas Pitre
     
  • The generation and postprocessing of automatic dependency rules is
    duplicated in rule_cc_o_c, rule_as_o_S and if_changed_dep. Since
    this is not a trivial one-liner action, it is now abstracted under
    cmd_and_fixdep to simplify things and make future changes in this area
    easier.

    In the rule_cc_o_c and rule_as_o_S cases that means the order of some
    commands has been altered, namely fixdep and related file manipulations
    are executed earlier, but they didn't depend on those commands that now
    execute later.

    Signed-off-by: Nicolas Pitre

    Nicolas Pitre
     

05 Mar, 2016

1 commit

  • Under certain conditions, Kbuild shows "... is up to date" where
    if_changed or friends are used.

    For example, the incremental build of ARM64 Linux shows this message
    when the kernel image has not been updated.

    $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
    CHK include/config/kernel.release
    CHK include/generated/uapi/linux/version.h
    CHK include/generated/utsrelease.h
    CHK include/generated/bounds.h
    CHK include/generated/timeconst.h
    CHK include/generated/asm-offsets.h
    CALL scripts/checksyscalls.sh
    CHK include/generated/compile.h
    CHK kernel/config_data.h
    make[1]: `arch/arm64/boot/Image.gz' is up to date.
    Building modules, stage 2.
    MODPOST 0 modules

    The following is the build rule in arch/arm64/boot/Makefile:

    $(obj)/Image.gz: $(obj)/Image FORCE
    $(call if_changed,gzip)

    If the Image.gz is newer than the Image and the command line has not
    changed (i.e., $(any-prereq) and $(arg-check) are both empty), the
    build rule $(call if_changed,gzip) is evaluated to be empty, then
    GNU Make reports the target is up to date. In order to make GNU Make
    quiet, we need to give it something to do, for example, "@:". This
    should be fixed in the Kbuild core part rather than in each Makefile.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

09 Sep, 2015

1 commit

  • Pull core kbuild updates from Michal Marek:
    - modpost portability fix
    - linker script fix
    - genksyms segfault fix
    - fixdep cleanup
    - fix for clang detection

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: Fix clang detection
    kbuild: fixdep: drop meaningless hash table initialization
    kbuild: fixdep: optimize code slightly
    genksyms: Regenerate parser
    genksyms: Duplicate function pointer type definitions segfault
    kbuild: Fix .text.unlikely placement
    Avoid conflict with host definitions when cross-compiling

    Linus Torvalds
     

04 Sep, 2015

1 commit

  • We cannot detect clang before including the arch Makefile, because that
    can set the default cross compiler. We also cannot detect clang after
    including the arch Makefile, because powerpc wants to know about clang.
    Solve this by using an deferred variable. This costs us a few shell
    invocations, but this is only a constant number.

    Reported-by: Behan Webster
    Reported-by: Anton Blanchard
    Signed-off-by: Michal Marek

    Michal Marek
     

14 Aug, 2015

1 commit

  • Since commit 1329e8cc69 ("modsign: Extract signing cert from
    CONFIG_MODULE_SIG_KEY if needed"), the build system has carefully coped
    with the signing key being specified as a relative path in either the
    source or or the build trees.

    However, the actual signing of modules has not worked if the filename
    is relative to the source tree.

    Fix that by moving the config_filename helper into scripts/Kbuild.include
    so that it can be used from elsewhere, and then using it in the top-level
    Makefile to find the signing key file.

    Kill the intermediate $(MODPUBKEY) and $(MODSECKEY) variables too, while
    we're at it. There's no need for them.

    Signed-off-by: David Woodhouse
    Signed-off-by: David Howells

    David Woodhouse
     

10 Jan, 2015

3 commits


21 Dec, 2014

1 commit

  • Pull kbuild updates from Michal Marek:
    "Here are the kbuild changes for v3.19-rc1:

    - Cleanups and deduplication in the main Makefile and
    scripts/Makefile.*
    - Sort the output of *config targets in make help
    - Old is always removed to avoid a surprise during
    bisecting
    - Warning fix in kconfig"

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: remove redundant -rR flag of hdr-inst
    kbuild: Fix make help- on powerpc
    kbuild: Automatically remove stale file
    kconfig: Fix warning "‘jump’ may be used uninitialized"
    Makefile: sort list of defconfig targets in make help output
    kbuild: Remove duplicate $(cmd) definition in Makefile.clean
    kbuild: collect shorthands into scripts/Kbuild.include

    Linus Torvalds
     

03 Dec, 2014

1 commit


26 Nov, 2014

1 commit

  • The shorthand "clean" is defined in both the top Makefile and
    scripts/Makefile.clean. Likewise, the "hdr-inst" is defined in
    both the top Makefile and scripts/Makefile.headersinst.

    To reduce code duplication, this commit collects them into
    scripts/Kbuild.include like the "build" and "modbuiltin" shorthands.
    It requires scripts/Makefile.clean to include scripts/Kbuild.include,
    but its impact on the performance of "make clean" should be
    negligible.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

22 Oct, 2014

1 commit


02 Oct, 2014

1 commit

  • $(if $(KBUILD_SRC),$(srctree)/) was a useful strategy
    to omit a long absolute path for in-source-tree build
    prior to commit 890676c65d699db3ad82e7dddd0cf8fb449031af
    (kbuild: Use relative path when building in the source tree).

    Now $(srctree) is "." when building in the source tree.
    It would not be annoying to add "$(srctree)/" all the time.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

08 Aug, 2014

1 commit

  • Commit c353acba ("kbuild: make: fix if_changed when command contains
    backslashes") attempted to handle backslashes in *.cmd files, but it
    only handled double backslashes for some reason. Changing make-cmd to also
    handle single backslashes fixes rebuilds with dash, but it breaks bash
    again. The reason is that the two shells disagree about the
    interpretation of backslash sequences in the echo builtin. The way out
    of this is to print the command with printf '%s\n'. While at it,
    document what the individual parts of make-cmd do and why.

    Reported-and-tested-by: Konstantin Khlebnikov
    Reviewed-by: Sam Ravnborg
    Signed-off-by: Michal Marek

    Michal Marek
     

08 Apr, 2014

1 commit

  • Pull kbuild changes from Michal Marek:
    - cleanups in the main Makefiles and Documentation/DocBook/Makefile
    - make O=... directory is automatically created if needed
    - mrproper/distclean removes the old include/linux/version.h to make
    life easier when bisecting across the commit that moved the version.h
    file

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: docbook: fix the include error when executing "make help"
    kbuild: create a build directory automatically for out-of-tree build
    kbuild: remove redundant '.*.cmd' pattern from make distclean
    kbuild: move "quote" to Kbuild.include to be consistent
    kbuild: docbook: use $(obj) and $(src) rather than specific path
    kbuild: unconditionally clobber include/linux/version.h on distclean
    kbuild: docbook: specify KERNELDOC dependency correctly
    kbuild: docbook: include cmd files more simply
    kbuild: specify build_docproc as a phony target

    Linus Torvalds
     

30 Mar, 2014

1 commit


14 Feb, 2014

1 commit


08 Apr, 2013

1 commit

  • The kbuild's ld-option function is broken because
    the command
    $(CC) /dev/null -c -o "$$TMPO"
    does not create object file!

    I have used a relatively old mips gcc 3.4.6 cross-compiler
    and a relatively new gcc 4.7.2 to check this fact
    but the results are the same.

    EXAMPLE:
    $ rm /tmp/1.o
    $ mips-linux-gcc /dev/null -c -o /tmp/1.o
    mips-linux-gcc: /dev/null: linker input file unused because linking not done
    $ ls -la /tmp/1.o
    ls: cannot access /tmp/1.o: No such file or directory

    We can easily fix the problem by adding
    the '-x c' compiler option.

    EXAMPLE:
    $ rm /tmp/1.o
    $ mips-linux-gcc -x c /dev/null -c -o /tmp/1.o
    $ ls -la /tmp/1.o
    -rw-r--r-- 1 antony antony 778 Apr 2 20:40 /tmp/1.o

    Also fix wrong ld-option example.

    Signed-off-by: Antony Pavlov
    Signed-off-by: Michal Marek

    Antony Pavlov
     

08 Oct, 2012

1 commit

  • Pull kbuild fixes from Michal Marek:
    "Here are two fixes I intended to send after v3.6-rc7, but failed to do
    so. So please pull them for v3.7-rc1 and they will be picked up by
    stable.

    The first one fixes gcc -x syntax in various build-time
    tests, which icecream and possible other gcc wrappers did not
    understand (and yes, icecream is going to be fixed as well).

    The second one fixes make tar-pkg so that unpacking the tarball does
    not replace the /lib -> /usr/lib symlink on recent Fedora releases."

    * 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    kbuild: Fix gcc -x syntax
    kbuild: Do not package /boot and /lib in make tar-pkg

    Linus Torvalds
     

06 Oct, 2012

1 commit

  • The call if_changed mechanism does not work when the command contains
    backslashes. This basically is an issue with lzo and bzip2 compressed
    kernels. The compressed binaries do not contain the uncompressed image
    size, so these use size_append to append the size. This results in
    backslashes in the executed command. With this if_changed always
    detects a change in the command and rebuilds the compressed image even
    if nothing has changed.

    Fix this by escaping backslashes in make-cmd

    Signed-off-by: Sascha Hauer
    Signed-off-by: Jan Luebbe
    Cc: Sam Ravnborg
    Cc: Bernhard Walle
    Cc: Michal Marek
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sascha Hauer
     

03 Oct, 2012

1 commit

  • The correct syntax for gcc -x is "gcc -x assembler", not
    "gcc -xassembler". Even though the latter happens to work, the former
    is what is documented in the manual page and thus what gcc wrappers
    such as icecream do expect.

    This isn't a cosmetic change. The missing space prevents icecream from
    recognizing compilation tasks it can't handle, leading to silent kernel
    miscompilations.

    Besides me, credits go to Michael Matz and Dirk Mueller for
    investigating the miscompilation issue and tracking it down to this
    incorrect -x parameter syntax.

    Signed-off-by: Jean Delvare
    Acked-by: Ingo Molnar
    Cc: stable@vger.kernel.org
    Cc: Bernhard Walle
    Cc: Michal Marek
    Cc: Ralf Baechle
    Signed-off-by: Michal Marek

    Jean Delvare
     

25 Mar, 2012

1 commit

  • "echo -e" is a GNU extension. When cross-compiling the kernel on a
    BSD-like operating system (Mac OS X in my case), this doesn't work.

    One could install a GNU version of echo, put that in the $PATH before
    the system echo and use "/usr/bin/env echo", but the solution with
    printf is simpler.

    Since it is no disadvantage on Linux, I hope that gets accepted even if
    cross-compiling the Linux kernel on another Unix operating system is
    quite a rare use case.

    Signed-off-by: Bernhard Walle
    Andreas Bießmann
    Signed-off-by: Michal Marek

    Bernhard Walle
     

10 Jun, 2011

1 commit