13 Jan, 2019

1 commit

  • When building to record the mcount locations the kernel uses
    KBUILD_CFLAGS but not KBUILD_CPPFLAGS. This means it lacks
    -Qunused-arguments when building with clang, resulting in a lot of
    noisy warnings.

    Signed-off-by: Joel Stanley
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Masahiro Yamada
    [nc: Fix conflicts due to lack of 87a32e624037 and d503ac531a52]
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     

06 Dec, 2018

1 commit

  • commit 4cd24de3a0980bf3100c9dcb08ef65ca7c31af48 upstream

    Since retpoline capable compilers are widely available, make
    CONFIG_RETPOLINE hard depend on the compiler capability.

    Break the build when CONFIG_RETPOLINE is enabled and the compiler does not
    support it. Emit an error message in that case:

    "arch/x86/Makefile:226: *** You are building kernel with non-retpoline
    compiler, please update your compiler.. Stop."

    [dwmw: Fail the build with non-retpoline compiler]

    Suggested-by: Peter Zijlstra
    Signed-off-by: Zhenzhong Duan
    Signed-off-by: Thomas Gleixner
    Cc: David Woodhouse
    Cc: Borislav Petkov
    Cc: Daniel Borkmann
    Cc: H. Peter Anvin
    Cc: Konrad Rzeszutek Wilk
    Cc: Andy Lutomirski
    Cc: Masahiro Yamada
    Cc: Michal Marek
    Cc:
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/cca0cb20-f9e2-4094-840b-fb0f8810cd34@default
    Signed-off-by: Greg Kroah-Hartman

    Zhenzhong Duan
     

15 Mar, 2018

3 commits

  • commit d5028ba8ee5a18c9d0bb926d883c28b370f89009 upstream.

    Disable retpoline validation in objtool if your compiler sucks, and otherwise
    select the validation stuff for CONFIG_RETPOLINE=y (most builds would already
    have it set due to ORC).

    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Thomas Gleixner
    Cc: Andy Lutomirski
    Cc: Arjan van de Ven
    Cc: Borislav Petkov
    Cc: Dan Williams
    Cc: Dave Hansen
    Cc: David Woodhouse
    Cc: Greg Kroah-Hartman
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     
  • commit ca41b97ed9124fd62323a162de5852f6e28f94b8 upstream.

    David allowed retpolines in .init.text, except for modules, which will
    trip up objtool retpoline validation, fix that.

    Requested-by: David Woodhouse
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Thomas Gleixner
    Acked-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Arjan van de Ven
    Cc: Borislav Petkov
    Cc: Dan Williams
    Cc: Dave Hansen
    Cc: David Woodhouse
    Cc: Greg Kroah-Hartman
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     
  • commit b5bc2231b8ad4387c9641f235ca0ad8cd300b6df upstream.

    David requested a objtool validation pass for CONFIG_RETPOLINE=y enabled
    builds, where it validates no unannotated indirect jumps or calls are
    left.

    Add an additional .discard.retpoline_safe section to allow annotating
    the few indirect sites that are required and safe.

    Requested-by: David Woodhouse
    Signed-off-by: Peter Zijlstra (Intel)
    Reviewed-by: David Woodhouse
    Acked-by: Thomas Gleixner
    Acked-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Arjan van de Ven
    Cc: Borislav Petkov
    Cc: Dan Williams
    Cc: Dave Hansen
    Cc: Greg Kroah-Hartman
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Peter Zijlstra
     

24 Jan, 2018

1 commit

  • commit 2a0098d70640dda192a79966c14d449e7a34d675 upstream.

    Objtool segfaults when the gold linker is used with
    CONFIG_MODVERSIONS=y and CONFIG_UNWINDER_ORC=y.

    With CONFIG_MODVERSIONS=y, the .o file gets passed to the linker before
    being passed to objtool. The gold linker seems to strip unused ELF
    symbols by default, which confuses objtool and causes the seg fault when
    it's trying to generate ORC metadata.

    Objtool should really be running immediately after GCC anyway, without a
    linker call in between. Change the makefile ordering so that objtool is
    called before the linker.

    Reported-and-tested-by: Markus
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: ee9f8fce9964 ("x86/unwind: Add the ORC unwinder")
    Link: http://lkml.kernel.org/r/355f04da33581f4a3bf82e5b512973624a1e23a2.1516025651.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar
    Cc: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Josh Poimboeuf
     

25 Dec, 2017

1 commit

  • commit 11af847446ed0d131cf24d16a7ef3d5ea7a49554 upstream.

    Rename the unwinder config options from:

    CONFIG_ORC_UNWINDER
    CONFIG_FRAME_POINTER_UNWINDER
    CONFIG_GUESS_UNWINDER

    to:

    CONFIG_UNWINDER_ORC
    CONFIG_UNWINDER_FRAME_POINTER
    CONFIG_UNWINDER_GUESS

    ... in order to give them a more logical config namespace.

    Suggested-by: Ingo Molnar
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/73972fc7e2762e91912c6b9584582703d6f1b8cc.1507924831.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Josh Poimboeuf
     

03 Nov, 2017

1 commit

  • For some odd historical reason, we preprocessed the linker scripts with
    "-C", which keeps comments around. That makes no sense, since the
    comments are not meaningful for the build anyway.

    And it actually breaks things, since linker scripts can't have C++ style
    "//" comments in them, so keeping comments after preprocessing now
    limits us in odd and surprising ways in our header files for no good
    reason.

    The -C option goes back to pre-git and pre-bitkeeper times, but seems to
    have been historically used (along with "-traditional") for some
    odd-ball architectures (ia64, MIPS and SH). It probably didn't matter
    back then either, but might possibly have been used to minimize the
    difference between the original file and the pre-processed result.

    The reason for this may be lost in time, but let's not perpetuate it
    only because we can't remember why we did this crazy thing.

    This was triggered by the recent addition of SPDX lines to the source
    tree, where people apparently were confused about why header files
    couldn't use the C++ comment format.

    Cc: Thomas Gleixner
    Cc: Greg KH
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

28 Sep, 2017

1 commit

  • The kbuild bot occasionally reports warnings like:

    drivers/scsi/pcmcia/aha152x_core.o: warning: objtool: seldo_run()+0x130: unreachable instruction

    These warnings are always with GCC 4.4. That version of GCC sometimes
    places unreachable instructions after calls to noreturn functions.

    The unreachable warnings aren't very important anyway. Just ignore them
    for old versions of GCC.

    Reported-by: kbuild test robot
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/bc89b807d965b98ec18a0bb94f96a594bd58f2f2.1506551639.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

05 Sep, 2017

1 commit

  • Pull x86 asm updates from Ingo Molnar:

    - Introduce the ORC unwinder, which can be enabled via
    CONFIG_ORC_UNWINDER=y.

    The ORC unwinder is a lightweight, Linux kernel specific debuginfo
    implementation, which aims to be DWARF done right for unwinding.
    Objtool is used to generate the ORC unwinder tables during build, so
    the data format is flexible and kernel internal: there's no
    dependency on debuginfo created by an external toolchain.

    The ORC unwinder is almost two orders of magnitude faster than the
    (out of tree) DWARF unwinder - which is important for perf call graph
    profiling. It is also significantly simpler and is coded defensively:
    there has not been a single ORC related kernel crash so far, even
    with early versions. (knock on wood!)

    But the main advantage is that enabling the ORC unwinder allows
    CONFIG_FRAME_POINTERS to be turned off - which speeds up the kernel
    measurably:

    With frame pointers disabled, GCC does not have to add frame pointer
    instrumentation code to every function in the kernel. The kernel's
    .text size decreases by about 3.2%, resulting in better cache
    utilization and fewer instructions executed, resulting in a broad
    kernel-wide speedup. Average speedup of system calls should be
    roughly in the 1-3% range - measurements by Mel Gorman [1] have shown
    a speedup of 5-10% for some function execution intense workloads.

    The main cost of the unwinder is that the unwinder data has to be
    stored in RAM: the memory cost is 2-4MB of RAM, depending on kernel
    config - which is a modest cost on modern x86 systems.

    Given how young the ORC unwinder code is it's not enabled by default
    - but given the performance advantages the plan is to eventually make
    it the default unwinder on x86.

    See Documentation/x86/orc-unwinder.txt for more details.

    - Remove lguest support: its intended role was that of a temporary
    proof of concept for virtualization, plus its removal will enable the
    reduction (removal) of the paravirt API as well, so Rusty agreed to
    its removal. (Juergen Gross)

    - Clean up and fix FSGS related functionality (Andy Lutomirski)

    - Clean up IO access APIs (Andy Shevchenko)

    - Enhance the symbol namespace (Jiri Slaby)

    * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (47 commits)
    objtool: Handle GCC stack pointer adjustment bug
    x86/entry/64: Use ENTRY() instead of ALIGN+GLOBAL for stub32_clone()
    x86/fpu/math-emu: Add ENDPROC to functions
    x86/boot/64: Extract efi_pe_entry() from startup_64()
    x86/boot/32: Extract efi_pe_entry() from startup_32()
    x86/lguest: Remove lguest support
    x86/paravirt/xen: Remove xen_patch()
    objtool: Fix objtool fallthrough detection with function padding
    x86/xen/64: Fix the reported SS and CS in SYSCALL
    objtool: Track DRAP separately from callee-saved registers
    objtool: Fix validate_branch() return codes
    x86: Clarify/fix no-op barriers for text_poke_bp()
    x86/switch_to/64: Rewrite FS/GS switching yet again to fix AMD CPUs
    selftests/x86/fsgsbase: Test selectors 1, 2, and 3
    x86/fsgsbase/64: Report FSBASE and GSBASE correctly in core dumps
    x86/fsgsbase/64: Fully initialize FS and GS state in start_thread_common
    x86/asm: Fix UNWIND_HINT_REGS macro for older binutils
    x86/asm/32: Fix regs_get_register() on segment registers
    x86/xen/64: Rearrange the SYSCALL entries
    x86/asm/32: Remove a bunch of '& 0xffff' from pt_regs segment reads
    ...

    Linus Torvalds
     

09 Aug, 2017

1 commit


26 Jul, 2017

1 commit

  • Add the new ORC unwinder which is enabled by CONFIG_ORC_UNWINDER=y.
    It plugs into the existing x86 unwinder framework.

    It relies on objtool to generate the needed .orc_unwind and
    .orc_unwind_ip sections.

    For more details on why ORC is used instead of DWARF, see
    Documentation/x86/orc-unwinder.txt - but the short version is
    that it's a simplified, fundamentally more robust debugninfo
    data structure, which also allows up to two orders of magnitude
    faster lookups than the DWARF unwinder - which matters to
    profiling workloads like perf.

    Thanks to Andy Lutomirski for the performance improvement ideas:
    splitting the ORC unwind table into two parallel arrays and creating a
    fast lookup table to search a subset of the unwind table.

    Signed-off-by: Josh Poimboeuf
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Jiri Slaby
    Cc: Linus Torvalds
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/0a6cbfb40f8da99b7a45a1a8302dc6aef16ec812.1500938583.git.jpoimboe@redhat.com
    [ Extended the changelog. ]
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

25 Jul, 2017

1 commit

  • Objtool tries to silence 'unreachable instruction' warnings when it
    detects gcov is enabled, because gcov produces a lot of unreachable
    instructions and they don't really matter.

    However, the 0-day bot is still reporting some unreachable instruction
    warnings with CONFIG_GCOV_KERNEL=y on GCC 4.6.4.

    As it turns out, objtool's gcov detection doesn't work with older
    versions of GCC because they don't create a bunch of symbols with the
    'gcov.' prefix like newer versions of GCC do.

    Move the gcov check out of objtool and instead just create a new
    '--no-unreachable' flag which can be passed in by the kernel Makefile
    when CONFIG_GCOV_KERNEL is defined.

    Also rename the 'nofp' variable to 'no_fp' for consistency with the new
    'no_unreachable' variable.

    Reported-by: kbuild test robot
    Signed-off-by: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 9cfffb116887 ("objtool: Skip all "unreachable instruction" warnings for gcov kernels")
    Link: http://lkml.kernel.org/r/c243dc78eb2ffdabb6e927844dea39b6033cd395.1500939244.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

30 Jun, 2017

1 commit

  • The P option makes ar do full path name matching and can prevent ar
    from discarding files with duplicate names in some cases of creating
    thin archives from thin archives. The sh architecture in particular
    loses some object files from its kernel/cpu/sh*/ directories without
    this option.

    This could be a bug in binutils ar, but the P option should not cause
    any negative effects so it is safe to use to work around this with.

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

    Nicholas Piggin
     

03 May, 2017

1 commit

  • It is currently impossible to see what is going on with objtool when
    building, so call echo-cmd to see the actions:
    gcc -Wp,-MD,arch/x86/entry/.entry_64.o.d -nostdinc -isystem ...
    ./tools/objtool/objtool check "arch/x86/entry/entry_64.o";

    Signed-off-by: Jiri Slaby
    Cc: Michal Marek
    Cc: linux-kbuild@vger.kernel.org
    Cc: Josh Poimboeuf
    Signed-off-by: Masahiro Yamada

    Jiri Slaby
     

25 Apr, 2017

1 commit


04 Feb, 2017

1 commit

  • This add the kbuild infrastructure that will allow architectures to emit
    vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
    where the actual value is stored. This works around problems with CRCs
    being mistaken for relocatable symbols on kernels that self relocate at
    runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)

    For the kbuild side of things, this comes down to the following:

    - introducing a Kconfig symbol MODULE_REL_CRCS

    - adding a -R switch to genksyms to instruct it to emit the CRC symbols
    as references into the .rodata section

    - making modpost distinguish such references from absolute CRC symbols
    by the section index (SHN_ABS)

    - making kallsyms disregard non-absolute symbols with a __crc_ prefix

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Linus Torvalds

    Ard Biesheuvel
     

18 Dec, 2016

1 commit

  • Pull kbuild updates from Michal Marek:

    - prototypes for x86 asm-exported symbols (Adam Borowski) and a warning
    about missing CRCs (Nick Piggin)

    - asm-exports fix for LTO (Nicolas Pitre)

    - thin archives improvements (Nick Piggin)

    - linker script fix for CONFIG_LD_DEAD_CODE_DATA_ELIMINATION (Nick
    Piggin)

    - genksyms support for __builtin_va_list keyword

    - misc minor fixes

    * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
    x86/kbuild: enable modversions for symbols exported from asm
    kbuild: fix scripts/adjust_autoksyms.sh* for the no modules case
    scripts/kallsyms: remove last remnants of --page-offset option
    make use of make variable CURDIR instead of calling pwd
    kbuild: cmd_export_list: tighten the sed script
    kbuild: minor improvement for thin archives build
    kbuild: modpost warn if export version crc is missing
    kbuild: keep data tables through dead code elimination
    kbuild: improve linker compatibility with lib-ksyms.o build
    genksyms: Regenerate parser
    kbuild/genksyms: handle va_list type
    kbuild: thin archives for multi-y targets
    kbuild: kallsyms allow 3-pass generation if symbols size has changed

    Linus Torvalds
     

11 Dec, 2016

1 commit

  • When LTO is used, some ___ksymtab_string sections are seen by this sed
    script, creating lines containing a single ) such as:

    EXPORT(foo)
    )
    )
    EXPORT(bar)

    Let's make it so the + character is also required for any line to be
    printed.

    Signed-off-by: Nicolas Pitre
    Signed-off-by: Michal Marek

    Nicolas Pitre
     

29 Nov, 2016

2 commits

  • lib-ksyms.o is created by linking an empty input file with a linker
    script containing the interesting bits. Currently the empty input file
    is an archive containing nothing, however this causes the gold linker
    to segfault.

    I have opened a bug against gold

    https://sourceware.org/bugzilla/show_bug.cgi?id=20767

    However this can be worked around by assembling an empty file to link
    with instead. The resulting lib-ksyms.o is slightly larger (seemingly
    due to empty .text, .data, .bss setions added), but final linked
    output should not be changed.

    Reported-by: Anton Blanchard
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     
  • THIN_ARCHIVES builds archives for built-in.o targets, have it build
    multi-y targets as archives as well.

    This saves another ~15% of the size of intermediate artifacts in the
    build tree. After this patch, the linker is only used in final link,
    and special cases like vdsos.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

10 Nov, 2016

1 commit

  • The CRC code for asm exports grabs the preprocessed asm, finds the
    ___EXPORT_SYMBOL and turns those into EXPORT_SYMBOL in a C program
    that can be preprocessed and parsed to create the CRC signatures from
    the type.

    The existing regex matching and replacement is too strict, and doesn't
    deal well with whitespace among other things. The line
    " EXPORT_SYMBOL(sym)" in a .S file would not match due to initial
    whitespace, for example, which resulted in x86's ___preempt_schedule
    failing to get CRCs.

    Reported-by: Philip Müller
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

01 Nov, 2016

1 commit


23 Oct, 2016

1 commit


09 Sep, 2016

1 commit

  • ld -r is an incremental link used to create built-in.o files in build
    subdirectories. It produces relocatable object files containing all
    its input files, and these are are then pulled together and relocated
    in the final link. Aside from the bloat, this constrains the final
    link relocations, which has bitten large powerpc builds with
    unresolvable relocations in the final link.

    Alan Modra has recommended the kernel use thin archives for linking.
    This is an alternative and means that the linker has more information
    available to it when it links the kernel.

    This patch enables a config option architectures can select, which
    causes all built-in.o files to be built as thin archives. built-in.o
    files in subdirectories do not get symbol table or index attached,
    which improves speed and size. The final link pass creates a
    built-in.o archive in the root output directory which includes the
    symbol table and index. The linker then uses takes this file to link.

    The --whole-archive linker option is required, because the linker now
    has visibility to every individual object file, and it will otherwise
    just completely avoid including those without external references
    (consider a file with EXPORT_SYMBOL or initcall or hardware exceptions
    as its only entry points). The traditional built works "by luck" as
    built-in.o files are large enough that they're going to get external
    references. However this optimisation is unpredictable for the kernel
    (due to above external references), ineffective at culling unused, and
    costly because the .o files have to be searched for references.
    Superior alternatives for link-time culling should be used instead.

    Build characteristics for inclink vs thinarc, on a small powerpc64le
    pseries VM with a modest .config:

    inclink thinarc
    sizes
    vmlinux 15 618 680 15 625 028
    sum of all built-in.o 56 091 808 1 054 334
    sum excluding root built-in.o 151 430

    find -name built-in.o | xargs rm ; time make vmlinux
    real 22.772s 21.143s
    user 13.280s 13.430s
    sys 4.310s 2.750s

    - Final kernel pulled in only about 6K more, which shows how
    ineffective the object file culling is.
    - Build performance looks improved due to less pagecache activity.
    On IO constrained systems it could be a bigger win.
    - Build size saving is significant.

    Side note, the toochain understands archives, so there's some tricks,
    $ ar t built-in.o # list all files you linked with
    $ size built-in.o # and their sizes
    $ objdump -d built-in.o # disassembly (unrelocated) with filenames

    Implementation by sfr, minor tweaks by npiggin.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Stephen Rothwell
     

08 Aug, 2016

1 commit

  • Collect the symbols exported by anything that goes into lib.a and
    add an empty object (lib-exports.o) with explicit undefs for each
    of those to obj-y.

    That allows to relax the rules regarding the use of exports in
    lib-* objects - right now an object with export can be in lib-*
    only if we are guaranteed that there always will be users in
    built-in parts of the tree, otherwise it needs to be in obj-*.
    As the result, we have an unholy mix of lib- and obj- in lib/Makefile
    and (especially) in arch/*/lib/Makefile. Moreover, a change in
    generic part of the kernel can lead to mysteriously missing exports
    on some configs. With this change we don't have to worry about
    that anymore.

    One side effect is that built-in.o now pulls everything with exports
    from the corresponding lib.a (if such exists). That's exactly what
    we want for linking vmlinux and fortunately it's almost the only thing
    built-in.o is used in. arch/ia64/hp/sim/boot/bootloader is the only
    exception and it's easy to get rid of now - just turn everything in
    arch/ia64/lib into lib-* and don't bother with arch/ia64/lib/built-in.o
    anymore.

    [AV: stylistic fix from Michal folded in]

    Acked-by: Michal Marek
    Signed-off-by: Al Viro

    Al Viro
     

08 Jun, 2016

1 commit

  • Infrastructure for building independent shared library targets.

    Based on work created by the PaX Team.

    Signed-off-by: Emese Revfy
    Acked-by: Kees Cook
    Signed-off-by: Michal Marek

    Emese Revfy
     

20 Apr, 2016

2 commits


30 Mar, 2016

2 commits

  • 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
     
  • Kernel modules are partially linked object files with some undefined
    symbols that are expected to be matched with EXPORT_SYMBOL() entries
    from elsewhere.

    Each .tmp_versions/*.mod file currently contains two line of text
    separated by a newline character. The first line has the actual module
    file name while the second line has a list of object files constituting
    that module. Those files are parsed by modpost (scripts/mod/sumversion.c),
    scripts/Makefile.modpost, scripts/Makefile.modsign, etc. Only the
    modpost utility cares about the second line while the others retrieve
    only the first line.

    Therefore we can add a third line to record the list of undefined symbols
    aka required EXPORT_SYMBOL() entries for each module into that file
    without breaking anything. Like for the second line, symbols are separated
    by a blank and the list is terminated with a newline character.

    To avoid needless build overhead, the undefined symbols extraction is
    performed only when CONFIG_TRIM_UNUSED_KSYMS is selected.

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

    Nicolas Pitre
     

05 Mar, 2016

1 commit

  • With CONFIG_STACK_VALIDATION enabled, if the host system doesn't have
    a development version of libelf installed, the build fails with errors
    like:

    elf.h:22:18: fatal error: gelf.h: No such file or directory compilation terminated.

    Instead of failing to build, instead just print a warning and disable
    stack validation.

    Signed-off-by: Josh Poimboeuf
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Stephen Rothwell
    Cc: Sudip Mukherjee
    Cc: Thomas Gleixner
    Cc: linux-next@vger.kernel.org
    Cc: linux@roeck-us.net
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/8c27fe00face60f42e888ddb3142c97e45223165.1457026550.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

29 Feb, 2016

1 commit

  • Add a CONFIG_STACK_VALIDATION option which will run "objtool check" for
    each .o file to ensure the validity of its stack metadata.

    Signed-off-by: Josh Poimboeuf
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Arnaldo Carvalho de Melo
    Cc: Bernd Petrovitsch
    Cc: Borislav Petkov
    Cc: Chris J Arges
    Cc: Jiri Slaby
    Cc: Linus Torvalds
    Cc: Michal Marek
    Cc: Namhyung Kim
    Cc: Pedro Alves
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/92baab69a6bf9bc7043af0bfca9fb964a1d45546.1456719558.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar

    Josh Poimboeuf
     

25 Nov, 2015

1 commit

  • This allows to write

    drm-$(CONFIG_AGP) += drm_agpsupport.o

    without having to handle CONFIG_AGP=y vs. CONFIG_AGP=m. Only support
    this syntax for modules, since built-in code depending on something
    modular cannot work and init/Makefile actually relies on the current
    semantics. There are a few drivers which adapted to the current
    semantics out of necessity; these are fixed to also work when the
    respective subsystem is modular.

    Acked-by: Peter Chen [chipidea]
    Signed-off-by: Michal Marek

    Michal Marek
     

29 Jan, 2015

1 commit

  • If the kernel is compiled with function tracer support the -pg compile option
    is passed to gcc to generate extra code into the prologue of each function.

    This patch replaces the "open-coded" -pg compile flag with a CC_FLAGS_FTRACE
    makefile variable which architectures can override if a different option
    should be used for code generation.

    Acked-by: Steven Rostedt
    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

02 Oct, 2014

1 commit

  • Kconfig never defines CONFIG_* as 'n'.
    Now obj-n is only used in firmware/Makefile and it can be
    replaced with obj-. No makefile uses lib-n.

    Let's rip off obj-n and lib-n.

    Signed-off-by: Masahiro Yamada
    Acked-by: Peter Foley
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

19 Aug, 2014

1 commit

  • The comment in scripts/Makefile.build says as follows:

    We would rather have a list of rules like
    foo.o: $(foo-objs)
    but that's not so easy, so we rather make all composite objects depend
    on the set of all their parts

    This commit makes it possible!

    For example, assume a Makefile like this

    obj-m = foo.o bar.o
    foo-objs := foo1.o foo2.o
    bar-objs := bar1.o bar2.o

    Without this patch, foo.o depends on all of
    foo1.o foo2.o bar1.o bar2.o.
    It looks funny that foo.o is regenerated when bar1.c is updated.

    Now we can handle the dependency of foo.o and bar.o separately.

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

    Masahiro Yamada
     

30 Apr, 2014

1 commit


17 Apr, 2014

1 commit

  • W=... provides extra gcc checks.

    Having such code in scripts/Makefile.build results in the same flags
    being added to KBUILD_CFLAGS multiple times becuase
    scripts/Makefile.build is invoked every time Kbuild descends into
    the subdirectories.

    Since the top Makefile is already too cluttered, this commit moves
    all of extra gcc check stuff to a new file scripts/Makefile.extrawarn,
    which is included from the top Makefile.

    Signed-off-by: Masahiro Yamada
    CC: Sam Ravnborg
    Signed-off-by: Michal Marek

    Masahiro Yamada