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
     

12 Oct, 2019

1 commit

  • Pull module fixes from Jessica Yu:
    "Code cleanups and kbuild/namespace related fixups from Masahiro.

    Most importantly, it fixes a namespace-related modpost issue for
    external module builds

    - Fix broken external module builds due to a modpost bug in
    read_dump(), where the namespace was not being strdup'd and
    sym->namespace would be set to bogus data.

    - Various namespace-related kbuild fixes and cleanups thanks to
    Masahiro Yamada"

    * tag 'modules-for-v5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    doc: move namespaces.rst from kbuild/ to core-api/
    nsdeps: make generated patches independent of locale
    nsdeps: fix hashbang of scripts/nsdeps
    kbuild: fix build error of 'make nsdeps' in clean tree
    module: rename __kstrtab_ns_* to __kstrtabns_* to avoid symbol conflict
    modpost: fix broken sym->namespace for external module builds
    module: swap the order of symbol.namespace
    scripts: add_namespace: Fix coccicheck failed

    Linus Torvalds
     

08 Oct, 2019

1 commit


05 Oct, 2019

2 commits

  • In commit 43d8ce9d65a5 ("Provide in-kernel headers to make
    extending kernel easier") a new mechanism was introduced, for kernels
    >=5.2, which embeds the kernel headers in the kernel image or a module
    and exposes them in procfs for use by userland tools.

    The archive containing the header files has nondeterminism caused by
    header files metadata. This patch normalizes the metadata and utilizes
    KBUILD_BUILD_TIMESTAMP if provided and otherwise falls back to the
    default behaviour.

    In commit f7b101d33046 ("kheaders: Move from proc to sysfs") it was
    modified to use sysfs and the script for generation of the archive was
    renamed to what is being patched.

    Signed-off-by: Dmitry Goldin
    Reviewed-by: Greg Kroah-Hartman
    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Masahiro Yamada

    Dmitry Goldin
     
  • Capitalize the first word in the sentence.

    Use obj-m instead of obj-y. obj-y still works, but we have no built-in
    objects in external module builds. So, obj-m is better IMHO.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

01 Oct, 2019

2 commits


23 Sep, 2019

1 commit

  • Pull modules updates from Jessica Yu:
    "The main bulk of this pull request introduces a new exported symbol
    namespaces feature. The number of exported symbols is increasingly
    growing with each release (we're at about 31k exports as of 5.3-rc7)
    and we currently have no way of visualizing how these symbols are
    "clustered" or making sense of this huge export surface.

    Namespacing exported symbols allows kernel developers to more
    explicitly partition and categorize exported symbols, as well as more
    easily limiting the availability of namespaced symbols to other parts
    of the kernel. For starters, we have introduced the USB_STORAGE
    namespace to demonstrate the API's usage. I have briefly summarized
    the feature and its main motivations in the tag below.

    Summary:

    - Introduce exported symbol namespaces.

    This new feature allows subsystem maintainers to partition and
    categorize their exported symbols into explicit namespaces. Module
    authors are now required to import the namespaces they need.

    Some of the main motivations of this feature include: allowing
    kernel developers to better manage the export surface, allow
    subsystem maintainers to explicitly state that usage of some
    exported symbols should only be limited to certain users (think:
    inter-module or inter-driver symbols, debugging symbols, etc), as
    well as more easily limiting the availability of namespaced symbols
    to other parts of the kernel.

    With the module import requirement, it is also easier to spot the
    misuse of exported symbols during patch review.

    Two new macros are introduced: EXPORT_SYMBOL_NS() and
    EXPORT_SYMBOL_NS_GPL(). The API is thoroughly documented in
    Documentation/kbuild/namespaces.rst.

    - Some small code and kbuild cleanups here and there"

    * tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux:
    module: Remove leftover '#undef' from export header
    module: remove unneeded casts in cmp_name()
    module: move CONFIG_UNUSED_SYMBOLS to the sub-menu of MODULES
    module: remove redundant 'depends on MODULES'
    module: Fix link failure due to invalid relocation on namespace offset
    usb-storage: export symbols in USB_STORAGE namespace
    usb-storage: remove single-use define for debugging
    docs: Add documentation for Symbol Namespaces
    scripts: Coccinelle script for namespace dependencies.
    modpost: add support for generating namespace dependencies
    export: allow definition default namespaces in Makefiles or sources
    module: add config option MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
    modpost: add support for symbol namespaces
    module: add support for symbol namespaces.
    export: explicitly align struct kernel_symbol
    module: support reading multiple values per modinfo tag

    Linus Torvalds
     

20 Sep, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - add modpost warn exported symbols marked as 'static' because 'static'
    and EXPORT_SYMBOL is an odd combination

    - break the build early if gold linker is used

    - optimize the Bison rule to produce .c and .h files by a single
    pattern rule

    - handle PREEMPT_RT in the module vermagic and UTS_VERSION

    - warn CONFIG options leaked to the user-space except existing ones

    - make single targets work properly

    - rebuild modules when module linker scripts are updated

    - split the module final link stage into scripts/Makefile.modfinal

    - fix the missed error code in merge_config.sh

    - improve the error message displayed on the attempt of the O= build in
    unclean source tree

    - remove 'clean-dirs' syntax

    - disable -Wimplicit-fallthrough warning for Clang

    - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC

    - remove ARCH_{CPP,A,C}FLAGS variables

    - add $(BASH) to run bash scripts

    - change *CFLAGS_.o to take the relative path to $(obj)
    instead of the basename

    - stop suppressing Clang's -Wunused-function warnings when W=1

    - fix linux/export.h to avoid genksyms calculating CRC of trimmed
    exported symbols

    - misc cleanups

    * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits)
    genksyms: convert to SPDX License Identifier for lex.l and parse.y
    modpost: use __section in the output to *.mod.c
    modpost: use MODULE_INFO() for __module_depends
    export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols
    export.h: remove defined(__KERNEL__), which is no longer needed
    kbuild: allow Clang to find unused static inline functions for W=1 build
    kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN
    kbuild: refactor scripts/Makefile.extrawarn
    merge_config.sh: ignore unwanted grep errors
    kbuild: change *FLAGS_.o to take the path relative to $(obj)
    modpost: add NOFAIL to strndup
    modpost: add guid_t type definition
    kbuild: add $(BASH) to run scripts with bash-extension
    kbuild: remove ARCH_{CPP,A,C}FLAGS
    kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC
    kbuild: Do not enable -Wimplicit-fallthrough for clang for now
    kbuild: clean up subdir-ymn calculation in Makefile.clean
    kbuild: remove unneeded '+' marker from cmd_clean
    kbuild: remove clean-dirs syntax
    kbuild: check clean srctree even earlier
    ...

    Linus Torvalds
     

15 Sep, 2019

1 commit

  • In the Distribution Kernels track at Linux Plumbers Conference there
    was some discussion around the difficulty of making kernel builds
    reproducible.

    This is a solved problem, but the solutions don't appear to be
    documented in one place. This document lists the issues I know about
    and the settings needed to ensure reproducibility.

    Signed-off-by: Ben Hutchings
    Acked-by: Masahiro Yamada
    Signed-off-by: Jonathan Corbet

    Ben Hutchings
     

10 Sep, 2019

2 commits

  • Describe using Symbol Namespaces from a perspective of a user. I.e.
    module authors or subsystem maintainers.

    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Matthias Maennich
    Signed-off-by: Jessica Yu

    Matthias Maennich
     
  • Add support for symbols that are exported into namespaces. For that,
    extract any namespace suffix from the symbol name. In addition, emit a
    warning whenever a module refers to an exported symbol without
    explicitly importing the namespace that it is defined in. This patch
    consistently adds the namespace suffix to symbol names exported into
    Module.symvers.

    Example warning emitted by modpost in case of the above violation:

    WARNING: module ums-usbat uses symbol usb_stor_resume from namespace
    USB_STORAGE, but does not import it.

    Co-developed-by: Martijn Coenen
    Signed-off-by: Martijn Coenen
    Reviewed-by: Joel Fernandes (Google)
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Matthias Maennich
    Signed-off-by: Jessica Yu

    Matthias Maennich
     

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
     

04 Sep, 2019

1 commit

  • These flags were added by commit 61754c18752f ("kbuild: Allow arch
    Makefiles to override {cpp,ld,c}flags") to allow ARC to override -O2.

    We did not see any other usage after all. Now that ARC switched to
    CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3, there is no more user of
    these variables.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

29 Aug, 2019

3 commits

  • The only the difference between clean-files and clean-dirs is the -r
    option passed to the 'rm' command.

    You can always pass -r, and then remove the clean-dirs syntax.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Commit 055efab3120b ("kbuild: drop support for cc-ldoption") correctly
    removed the cc-ldoption from Documentation/kbuild/makefiles.txt, but
    commit cd238effefa2 ("docs: kbuild: convert docs to ReST and rename
    to *.rst") revived it. I guess it was a rebase mistake.

    Remove it again.

    Fixes: cd238effefa2 ("docs: kbuild: convert docs to ReST and rename to *.rst")
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • I see the following warnings when I open this document with a ReST
    viewer, retext:

    /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1142: (WARNING/2) Inline emphasis start-string without end-string.
    /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1152: (WARNING/2) Inline emphasis start-string without end-string.
    /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1154: (WARNING/2) Inline emphasis start-string without end-string.

    These hunks were added by commit e846f0dc57f4 ("kbuild: add support
    for ensuring headers are self-contained") and commit 1e21cbfada87
    ("kbuild: support header-test-pattern-y"), respectively. They were
    written not for ReST but for the plain text, and merged via the
    kbuild tree.

    In the same development cycle, this document was converted to ReST
    by commit cd238effefa2 ("docs: kbuild: convert docs to ReST and rename
    to *.rst"), and merged via the doc sub-system.

    Merging them together into Linus' tree resulted in the current situation.

    To fix the syntax, surround the asterisks with back-quotes, and
    use :: for the code sample.

    Fixes: 39ceda5ce1b0 ("Merge tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild")
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

21 Aug, 2019

3 commits


21 Jul, 2019

1 commit

  • Pull more Kbuild updates from Masahiro Yamada:

    - match the directory structure of the linux-libc-dev package to that
    of Debian-based distributions

    - fix incorrect include/config/auto.conf generation when Kconfig
    creates it along with the .config file

    - remove misleading $(AS) from documents

    - clean up precious tag files by distclean instead of mrproper

    - add a new coccinelle patch for devm_platform_ioremap_resource
    migration

    - refactor module-related scripts to read modules.order instead of
    $(MODVERDIR)/*.mod files to get the list of created modules

    - remove MODVERDIR

    - update list of header compile-test

    - add -fcf-protection=none flag to avoid conflict with the retpoline
    flags when CONFIG_RETPOLINE=y

    - misc cleanups

    * tag 'kbuild-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits)
    kbuild: add -fcf-protection=none when using retpoline flags
    kbuild: update compile-test header list for v5.3-rc1
    kbuild: split out *.mod out of {single,multi}-used-m rules
    kbuild: remove 'prepare1' target
    kbuild: remove the first line of *.mod files
    kbuild: create *.mod with full directory path and remove MODVERDIR
    kbuild: export_report: read modules.order instead of .tmp_versions/*.mod
    kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod
    kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod
    kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod
    scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver
    kbuild: remove duplication from modules.order in sub-directories
    kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin}
    kbuild: do not create empty modules.order in the prepare stage
    coccinelle: api: add devm_platform_ioremap_resource script
    kbuild: compile-test headers listed in header-test-m as well
    kbuild: remove unused hostcc-option
    kbuild: remove tag files by distclean instead of mrproper
    kbuild: add --hash-style= and --build-id unconditionally
    kbuild: get rid of misleading $(AS) from documents
    ...

    Linus Torvalds
     

17 Jul, 2019

1 commit

  • The assembler files in the kernel are *.S instead of *.s, so they must
    be preprocessed. Since 'as' of GNU binutils is not able to preprocess,
    we always use $(CC) as an assembler driver.

    $(AS) is almost unused in Kbuild. As of v5.2, there is just one place
    that directly invokes $(AS).

    $ git grep -e '$(AS)' -e '${AS}' -e '$AS' -e '$(AS:' -e '${AS:' -- :^Documentation
    drivers/net/wan/Makefile: AS68K = $(AS)

    The documentation about *_AFLAGS* sounds like the flags were passed
    to $(AS). This is somewhat misleading.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Nathan Chancellor

    Masahiro Yamada
     

15 Jul, 2019

2 commits

  • The tag ".. include" should be replaced by ".. literalinclude" at
    issues.rst, otherwise it causes TeX to crash due to excessive usage
    of stack with Sphinx 2.0.

    While here, solve a few minor issues at the kbuild book output by
    adding extra blank lines.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • The contents of those directories were orphaned at the documentation
    body.

    While those directories could likely be moved to be inside some guide,
    I'm opting to just adding their indexes to the main one, removing the
    :orphan: and adding the SPDX header.

    For the drivers, the rationale is that the documentation contains
    a mix of Kernelspace, uAPI and admin-guide. So, better to keep them on
    separate directories, as we've be doing with similar subsystem-specific
    docs that were not split yet.

    For the others, well... I'm too lazy to do the move. Also, it
    seems to make sense to keep at least some of those at the main
    dir (like kbuild, for example). In any case, a latter patch
    could do the move.

    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Bartlomiej Zolnierkiewicz

    Mauro Carvalho Chehab
     

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
     

10 Jul, 2019

1 commit

  • In old days, Kbuild always used an absolute path for $(srctree).

    Since commit 890676c65d69 ("kbuild: Use relative path when building in
    the source tree"), $(srctree) is '.' when O= was not passed from the
    command line.

    Yet, using absolute paths is useful in some cases even without O=, for
    instance, to create a cscope file with absolute path tags.

    'O=.' was known to work as a workaround to force Kbuild to use absolute
    paths even when you are building in the source tree.

    Since commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any
    directory"), Kbuild is too clever to be tricked. Even if you pass 'O=.'
    Kbuild notices you are building in the source tree, then use '.' for
    $(srctree).

    So, 'make O=. cscope' is no help to create absolute path tags.

    We cannot force one or the other according to commit e93bc1a0cab3
    ("Revert "kbuild: specify absolute paths for cscope""). Both of
    relative path and absolute path have pros and cons.

    This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to
    choose the absolute path for $(srctree).

    'make KBUILD_ABS_SRCTREE=1 cscope' will work as a replacement of
    'make O=. cscope'.

    Reported-by: Pawan Gupta
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

09 Jul, 2019

2 commits

  • In my view, most of headers can be self-contained. So, it would be
    tedious to add every header to header-test-y explicitly. We usually
    end up with "all headers with some exceptions".

    There are two types in exceptions:

    [1] headers that are never compiled as standalone units

    For examples, include/linux/compiler-gcc.h is not intended for
    direct inclusion. We should always exclude such ones.

    [2] headers that are conditionally compiled as standalone units

    Some headers can be compiled only for particular architectures.
    For example, include/linux/arm-cci.h can be compiled only for
    arm/arm64 because it requires to exist.
    Clang can compile include/soc/nps/mtm.h only for arc because
    it contains an arch-specific register in inline assembler.

    So, you can write Makefile like this:

    header-test- += linux/compiler-gcc.h
    header-test-$(CONFIG_ARM) += linux/arm-cci.h
    header-test-$(CONFIG_ARM64) += linux/arm-cci.h
    header-test-$(CONFIG_ARC) += soc/nps/mtm.h

    The new syntax header-test-pattern-y will be useful to specify
    "the rest".

    The typical usage is like this:

    header-test-pattern-y += */*.h

    This will add all the headers in sub-directories to the test coverage,
    excluding $(header-test-). In this regards, header-test-pattern-y
    behaves like a weaker variant of header-test-y.

    Caveat:
    The patterns in header-test-pattern-y are prefixed with $(srctree)/$(src)/
    but not $(objtree)/$(obj)/. Stale generated headers are often left over
    when you traverse the git history without cleaning. Wildcard patterns for
    $(objtree) may match to stale headers, which could fail to compile.
    One pitfall is $(srctree)/$(src)/ and $(objtree)/$(obj)/ point to the
    same directory for in-tree building. So, header-test-pattern-y should
    be used with care since it can potentially match to stale headers.

    Caveat2:
    You could use wildcard for header-test-. For example,

    header-test- += asm-generic/%

    ... will exclude headers in asm-generic directory. Unfortunately, the
    wildcard character is '%' instead of '*' here because this is evaluated
    by $(filter-out ...) whereas header-test-pattern-y is evaluated by
    $(wildcard ...). This is a kludge, but seems useful in some places...

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

    Masahiro Yamada
     
  • header-test-y does not work with headers in sub-directories.

    For example, you may want to write a Makefile, like this:

    include/linux/Kbuild:

    header-test-y += mtd/nand.h

    This entry will create a wrapper include/linux/mtd/nand.hdrtest.c
    with the following content:

    #include "mtd/nand.h"

    To make this work, we need to add $(srctree)/include/linux to the
    header search path. It would be tedious to add ccflags-y.

    Instead, we could change the *.hdrtest.c rule to wrap:

    #include "nand.h"

    This works for in-tree build since #include "..." searches in the
    relative path from the header with this directive. For O=... build,
    we need to add $(srctree)/include/linux/mtd to the header search path,
    which will be even more tedious.

    After all, I thought it would be handier to compile headers directly
    without creating wrappers.

    I added a new build rule to compile %.h into %.h.s

    The target is %.h.s instead of %.h.o because it is slightly faster.
    Also, as for GCC, an empty assembly is smaller than an empty object.

    I wrote the build rule:

    $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<

    instead of:

    $(CC) $(c_flags) -S -o $@ -x c $<

    Both work fine with GCC, but the latter is bad for Clang.

    This comes down to the difference in the -Wunused-function policy.
    GCC does not warn about unused 'static inline' functions at all.
    Clang does not warn about the ones in included headers, but does
    about the ones in the source. So, we should handle headers as
    headers, not as source files.

    In fact, this has been hidden since commit 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

3 commits

  • 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
     
  • headers_install_all does not make much sense any more because different
    architectures export different set of uapi/linux/ headers. As you see
    in include/uapi/linux/Kbuild, the installation of a.out.h, kvm.h, and
    kvm_para.h is arch-dependent. So, headers_install_all repeats the
    installation/removal of them.

    If somebody really thinks it is useful to do headers_install for all
    architectures, it would be possible by small shell-scripting, but
    the top Makefile does not have to provide entry targets just for that
    purpose.

    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    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
     

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
     

07 May, 2019

1 commit

  • Problem:

    When a kernel module is compiled as a separate module, some important
    information about the kernel module is available via .modinfo section of
    the module. In contrast, when the kernel module is compiled into the
    kernel, that information is not available.

    Information about built-in modules is necessary in the following cases:

    1. When it is necessary to find out what additional parameters can be
    passed to the kernel at boot time.

    2. When you need to know which module names and their aliases are in
    the kernel. This is very useful for creating an initrd image.

    Proposal:

    The proposed patch does not remove .modinfo section with module
    information from the vmlinux at the build time and saves it into a
    separate file after kernel linking. So, the kernel does not increase in
    size and no additional information remains in it. Information is stored
    in the same format as in the separate modules (null-terminated string
    array). Because the .modinfo section is already exported with a separate
    modules, we are not creating a new API.

    It can be easily read in the userspace:

    $ tr '\0' '\n' < modules.builtin.modinfo
    ext4.softdep=pre: crc32c
    ext4.license=GPL
    ext4.description=Fourth Extended Filesystem
    ext4.author=Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
    ext4.alias=fs-ext4
    ext4.alias=ext3
    ext4.alias=fs-ext3
    ext4.alias=ext2
    ext4.alias=fs-ext2
    md_mod.alias=block-major-9-*
    md_mod.alias=md
    md_mod.description=MD RAID framework
    md_mod.license=GPL
    md_mod.parmtype=create_on_open:bool
    md_mod.parmtype=start_dirty_degraded:int
    ...

    Co-Developed-by: Gleb Fotengauer-Malinovskiy
    Signed-off-by: Gleb Fotengauer-Malinovskiy
    Signed-off-by: Alexey Gladkov
    Acked-by: Jessica Yu
    Signed-off-by: Masahiro Yamada

    Alexey Gladkov
     

17 Mar, 2019

1 commit

  • Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
    the common Kbuild.asm file. Factor out the duplicated include directives
    to scripts/Makefile.asm-generic so that no architecture would opt out
    of the mandatory-y mechanism.

    um is not forced to include mandatory-y since it is a very exceptional
    case which does not support UAPI.

    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
     

20 Feb, 2019

1 commit

  • Commit 06300b21f4c7 ("kbuild: support building individual files for
    external modules") introduced the '/' target. It works only for
    external modules to build all .o files, but skip the modpost stage.

    However, 'make /' looks a bit weird to me. 'make ./' is more sensible
    if you want to build all objects under the current directory, and it
    works as expected.

    Let's change '/' into a phony target that is an alias of './', but
    I may feel like deprecating it in the future.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Jan, 2019

2 commits

  • The top Makefile does not need to export KBUILD_VMLINUX_INIT and
    KBUILD_VMLINUX_MAIN separately.

    Put every built-in.a into KBUILD_VMLINUX_OBJS. The order of
    $(head-y), $(init-y), $(core-y), ... is still retained.

    Signed-off-by: Masahiro Yamada

    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
     

06 Jan, 2019

1 commit

  • Some time ago, Sam pointed out a certain degree of overwrap between
    generic-y and mandatory-y. (https://lkml.org/lkml/2017/7/10/121)

    I tweaked the meaning of mandatory-y a little bit; now it defines the
    minimum set of ASM headers that all architectures must have.

    If arch does not have specific implementation of a mandatory header,
    Kbuild will let it fallback to the asm-generic one by automatically
    generating a wrapper. This will allow to drop lots of redundant
    generic-y defines.

    Previously, "mandatory" was used in the context of UAPI, but I guess
    this can be extended to kernel space ASM headers.

    Suggested-by: Sam Ravnborg
    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    Masahiro Yamada
     

01 Dec, 2018

1 commit

  • SUBDIRS has been kept as a backward compatibility since
    commit ("[PATCH] kbuild: external module support") in 2002.

    We do not need multiple ways to do the same thing, so I will remove
    SUBDIRS after the Linux 5.3 release. I cleaned up in-tree code, and
    updated the document so that nobody would try to use it.

    Meanwhile, display the following warning if SUBDIRS is used.

    Makefile:189: ================= WARNING ================
    Makefile:190: 'SUBDIRS' will be removed after Linux 5.3
    Makefile:191: Please use 'M=' or 'KBUILD_EXTMOD' instead
    Makefile:192: ==========================================

    Signed-off-by: Masahiro Yamada
    Acked-by: Boris Brezillon # for scx200_docflash.c
    Acked-by: Guenter Roeck # for scx200_wdt.c

    Masahiro Yamada