- Feb 24, 2021
-
-
Nathan Chancellor authored
When using AMD's Optimizing C/C++ Compiler (AOCC), the build fails due to a # character in the version string, which is interpreted as a comment: $ make CC=clang defconfig init/main.o include/config/auto.conf.cmd:1374: *** invalid syntax in conditional. Stop. $ sed -n 1374p include/config/auto.conf.cmd ifneq "$(CC_VERSION_TEXT)" "AMD clang version 11.0.0 (CLANG: AOCC_2.3.0-Build#85 2020_11_10) (based on LLVM Mirror.Version.11.0.0)" Remove all # characters in the version string so that the build does not fail unexpectedly. Link: https://github.com/ClangBuiltLinux/linux/issues/1298 Reported-by:
Michael Fuckner <michael@fuckner.net> Signed-off-by:
Nathan Chancellor <nathan@kernel.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Nick Desaulniers authored
I noticed we're invoking $(CC) via $(shell) more than once to check the version. Let's reuse the first string captured in $CC_VERSION_TEXT. Signed-off-by:
Nick Desaulniers <ndesaulniers@google.com> [masahiro.yamada: CC_VERSION_TEXT is assigned by = instead of :=, so this $(shell ) is evaluated multiple times anyway. The number of $(CC) invocations will be still the same. Replacing 'grep' with the built-in $(findstring ) will give real performance benefit.] Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Feb 16, 2021
-
-
Sasha Levin authored
Instead of storing the version in a single integer and having various kernel (and userspace) code how it's constructed, export individual (major, patchlevel, sublevel) components and simplify kernel code that uses it. This should also make it easier on userspace. Signed-off-by:
Sasha Levin <sashal@kernel.org> Acked-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Sasha Levin authored
Right now if SUBLEVEL becomes larger than 255 it will overflow into the territory of PATCHLEVEL, causing havoc in userspace that tests for specific kernel version. While userspace code tests for MAJOR and PATCHLEVEL, it doesn't test SUBLEVEL at any point as ABI changes don't happen in the context of stable tree. Thus, to avoid overflows, simply clamp SUBLEVEL to it's maximum value in the context of LINUX_VERSION_CODE. This does not affect "make kernelversion" and such. Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Nick Desaulniers authored
DWARF v5 is the latest standard of the DWARF debug info format. GCC 11 will change the implicit default DWARF version, if left unspecified, to DWARF v5. Allow users of Clang and older versions of GCC that have not changed the implicit default DWARF version to DWARF v5 to opt in. This can help testing consumers of DWARF debug info in preparation of v5 becoming more widespread, as well as result in significant binary size savings of the pre-stripped vmlinux image. DWARF5 wins significantly in terms of size when mixed with compression (CONFIG_DEBUG_INFO_COMPRESSED). 363M vmlinux.clang12.dwarf5.compressed 434M vmlinux.clang12.dwarf4.compressed 439M vmlinux.clang12.dwarf2.compressed 457M vmlinux.clang12.dwarf5 536M vmlinux.clang12.dwarf4 548M vmlinux.clang12.dwarf2 515M vmlinux.gcc10.2.dwarf5.compressed 599M vmlinux.gcc10.2.dwarf4.compressed 624M vmlinux.gcc10.2.dwarf2.compressed 630M vmlinux.gcc10.2.dwarf5 765M vmlinux.gcc10.2.dwarf4 809M vmlinux.gcc10.2.dwarf2 Though the quality of debug info is harder to quantify; size is not a proxy for quality. Jakub notes: One thing is GCC DWARF-5 support, that is whether the compiler will support -gdwarf-5 flag, and that support should be there from GCC 7 onwards. All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental option that enabled some small DWARF subset (initially only a few DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released after DWARF 5 has been finalized) started emitting DWARF5 section headers and got most of the DWARF5 changes in... Another separate thing is whether the assembler does support the -gdwarf-5 option (i.e. if you can compile assembler files with -Wa,-gdwarf-5) ... That option is about whether the assembler will emit DWARF5 or DWARF2 .debug_line. It is fine to compile C sources with -gdwarf-5 and use DWARF2 .debug_line for assembler files if as doesn't support it. Version check GCC so that we don't need to worry about the difference in command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to validate the DWARF Version in the assembler feature detection script. Most issues with clang produced assembler were fixed in binutils 2.35.1, but 2.35.2 fixed issues related to requiring the flag -Wa,-gdwarf-5 explicitly. The added shell script test checks for the latter, and is only required when using clang without its integrated assembler, though we use for clang regardless as we do not yet have a way to query the assembler from Kconfig. Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet recognize the new additions to the DWARF debug info. This only modifies the DWARF version emitted by the compiler, not the assembler. The DWARF version of a binary can be validated with: $ llvm-dwarfdump <object file> | head -n 4 | grep version or $ readelf --debug-dump=info <object file> 2>/dev/null | grep Version Parts of the tree don't reuse DEBUG_CFLAGS as they should; such cleanup is left as a follow up. Link: http://www.dwarfstd.org/doc/DWARF5.pdf Link: https://bugzilla.redhat.com/show_bug.cgi?id=1922707 Reported-by:
Sedat Dilek <sedat.dilek@gmail.com> Suggested-by:
Arvind Sankar <nivedita@alum.mit.edu> Suggested-by:
Caroline Tice <cmtice@google.com> Suggested-by:
Fangrui Song <maskray@google.com> Suggested-by:
Jakub Jelinek <jakub@redhat.com> Suggested-by:
Masahiro Yamada <masahiroy@kernel.org> Suggested-by:
Nathan Chancellor <natechancellor@gmail.com> Signed-off-by:
Nick Desaulniers <ndesaulniers@google.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v12.0.0-rc1 x86-64 Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Nick Desaulniers authored
Adds a default CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT which allows the implicit default version of DWARF emitted by the toolchain to progress over time. Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice, making it mutually exclusive with CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT. Users may want to select this if they are using a newer toolchain, but have consumers of the DWARF debug info that aren't yet ready for newer DWARF versions' debug info. Does so in a way that's forward compatible with existing configs, and makes adding future versions more straightforward. This patch does not change the current behavior or selection of DWARF version for users upgrading to kernels with this patch. GCC since ~4.8 has defaulted to DWARF v4 implicitly, and GCC 11 has bumped this to v5. Remove the Kconfig help text about DWARF v4 being larger. It's empirically false for the latest toolchains for x86_64 defconfig, has no point of reference (I suspect it was DWARF v2 but that's stil empirically false), and debug info size is not a qualatative measure. Suggested-by:
Arvind Sankar <nivedita@alum.mit.edu> Suggested-by:
Fangrui Song <maskray@google.com> Suggested-by:
Jakub Jelinek <jakub@redhat.com> Suggested-by:
Mark Wielaard <mark@klomp.org> Suggested-by:
Masahiro Yamada <masahiroy@kernel.org> Suggested-by:
Nathan Chancellor <nathan@kernel.org> Tested-by:
Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by:
Nick Desaulniers <ndesaulniers@google.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Masahiro Yamada authored
Revert commit 223c24a7 ("kbuild: Automatically remove stale <linux/version.h> file"). It was more than 6 years ago. I do not expect anybody to start git-bisect for such a big window. Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Feb 11, 2021
-
-
Tor Vic authored
By default, xz without parameters uses a dictionary size of 8 MB. However, most modules are much smaller than that. The xz manpage states that 'increasing dictionary size usually improves compression ratio, but a dictionary bigger than the uncompressed file is waste of memory'. Use a dictionary size of 2 MB for module compression, resulting in slightly higher compression speed while still maintaining a good compression ratio. Signed-off-by:
Tor Vic <torvic9@mailbox.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Feb 07, 2021
-
-
Linus Torvalds authored
-
- Feb 05, 2021
-
-
Masahiro Yamada authored
Sedat Dilek noticed duplicated flags in DEBUG_CFLAGS when building deb-pkg with CONFIG_DEBUG_INFO. For example, 'make CC=clang bindeb-pkg' reproduces the issue. Kbuild recurses to the top Makefile for some targets such as package builds. With commit 121c5d08 ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions") applied, DEBUG_CFLAGS is now reset only when CONFIG_CC_IS_GCC=y. Fix it to reset DEBUG_CFLAGS all the time. Fixes: 121c5d08 ("kbuild: Only add -fno-var-tracking-assignments for old GCC versions") Reported-by:
Sedat Dilek <sedat.dilek@gmail.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org> Tested-by:
Sedat Dilek <sedat.dilek@gmail.com> Reviewed-by:
Mark Wielaard <mark@klomp.org> Reviewed-by:
Nathan Chancellor <nathan@kernel.org>
-
- Feb 01, 2021
-
-
Masahiro Yamada authored
Python retired in 2020, and some distributions do not provide the 'python' command any more. As in commit 51839e29 ("scripts: switch explicitly to Python 3"), we need to use more specific 'python3' to invoke scripts even if they are written in a way compatible with both Python 2 and 3. This commit removes the variable 'PYTHON', and switches the existing users to 'PYTHON3'. BTW, PEP 394 (https://www.python.org/dev/peps/pep-0394/ ) is a helpful material. Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Jan 31, 2021
-
-
Linus Torvalds authored
-
- Jan 29, 2021
-
-
Josh Poimboeuf authored
With retpolines disabled, some configurations of GCC, and specifically the GCC versions 9 and 10 in Ubuntu will add Intel CET instrumentation to the kernel by default. That breaks certain tracing scenarios by adding a superfluous ENDBR64 instruction before the fentry call, for functions which can be called indirectly. CET instrumentation isn't currently necessary in the kernel, as CET is only supported in user space. Disable it unconditionally and move it into the x86's Makefile as CET/CFI... enablement should be a per-arch decision anyway. [ bp: Massage and extend commit message. ] Fixes: 29be86d7 ("kbuild: add -fcf-protection=none when using retpoline flags") Reported-by:
Nikolay Borisov <nborisov@suse.com> Signed-off-by:
Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by:
Borislav Petkov <bp@suse.de> Reviewed-by:
Nikolay Borisov <nborisov@suse.com> Tested-by:
Nikolay Borisov <nborisov@suse.com> Cc: <stable@vger.kernel.org> Cc: Seth Forshee <seth.forshee@canonical.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Link: https://lkml.kernel.org/r/20210128215219.6kct3h2eiustncws@treble
-
- Jan 25, 2021
-
-
Linus Torvalds authored
-
- Jan 18, 2021
-
-
Linus Torvalds authored
-
- Jan 10, 2021
-
-
Linus Torvalds authored
-
- Jan 03, 2021
-
-
Linus Torvalds authored
-
- Dec 27, 2020
-
-
Linus Torvalds authored
-
- Dec 21, 2020
-
-
Dominique Martinet authored
depmod is not guaranteed to be in /sbin, just let make look for it in the path like all the other invoked programs Signed-off-by:
Dominique Martinet <asmadeus@codewreck.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Dec 13, 2020
-
-
Linus Torvalds authored
-
- Dec 06, 2020
-
-
Linus Torvalds authored
-
- Dec 01, 2020
-
-
Nathan Chancellor authored
Currently, '--orphan-handling=warn' is spread out across four different architectures in their respective Makefiles, which makes it a little unruly to deal with in case it needs to be disabled for a specific linker version (in this case, ld.lld 10.0.1). To make it easier to control this, hoist this warning into Kconfig and the main Makefile so that disabling it is simpler, as the warning will only be enabled in a couple places (main Makefile and a couple of compressed boot folders that blow away LDFLAGS_vmlinx) and making it conditional is easier due to Kconfig syntax. One small additional benefit of this is saving a call to ld-option on incremental builds because we will have already evaluated it for CONFIG_LD_ORPHAN_WARN. To keep the list of supported architectures the same, introduce CONFIG_ARCH_WANT_LD_ORPHAN_WARN, which an architecture can select to gain this automatically after all of the sections are specified and size asserted. A special thanks to Kees Cook for the help text on this config. Link: https://github.com/ClangBuiltLinux/linux/issues/1187 Acked-by:
Kees Cook <keescook@chromium.org> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Reviewed-by:
Nick Desaulniers <ndesaulniers@google.com> Tested-by:
Nick Desaulniers <ndesaulniers@google.com> Signed-off-by:
Nathan Chancellor <natechancellor@gmail.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Nov 29, 2020
-
-
Linus Torvalds authored
-
- Nov 24, 2020
-
-
Nick Desaulniers authored
Clang's integrated assembler produces the warning for assembly files: warning: DWARF2 only supports one section per compilation unit If -Wa,-gdwarf-* is unspecified, then debug info is not emitted for assembly sources (it is still emitted for C sources). This will be re-enabled for newer DWARF versions in a follow up patch. Enables defconfig+CONFIG_DEBUG_INFO to build cleanly with LLVM=1 LLVM_IAS=1 for x86_64 and arm64. Cc: <stable@vger.kernel.org> Link: https://github.com/ClangBuiltLinux/linux/issues/716 Reported-by:
Dmitry Golovin <dima@golovin.in> Reported-by:
Nathan Chancellor <natechancellor@gmail.com> Suggested-by:
Dmitry Golovin <dima@golovin.in> Suggested-by:
Nathan Chancellor <natechancellor@gmail.com> Suggested-by:
Sedat Dilek <sedat.dilek@gmail.com> Reviewed-by:
Fangrui Song <maskray@google.com> Reviewed-by:
Nathan Chancellor <natechancellor@gmail.com> Signed-off-by:
Nick Desaulniers <ndesaulniers@google.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
Denys Zagorui authored
Follow-up to commit a73619a8 ("kbuild: use -fmacro-prefix-map to make __FILE__ a relative path"). Assembler sources also use __FILE__ macro so this flag should be also applied to those sources. Signed-off-by:
Denys Zagorui <dzagorui@cisco.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Nov 22, 2020
-
-
Linus Torvalds authored
-
- Nov 16, 2020
-
-
Linus Torvalds authored
-
- Nov 09, 2020
-
-
Linus Torvalds authored
-
- Nov 02, 2020
-
-
Vasily Gorbik authored
The "size" tool has been solely used by s390 to enforce .bss section usage restrictions in early startup code. Since commit 980d5f9a ("s390/boot: enable .bss section for compressed kernel") and commit 2e83e0eb ("s390: clean .bss before running uncompressed kernel") these restrictions have been lifted for the decompressor and uncompressed kernel and the size tool is now unused. Signed-off-by:
Vasily Gorbik <gor@linux.ibm.com> Reviewed-by:
Nathan Chancellor <natechancellor@gmail.com> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Nov 01, 2020
-
-
Linus Torvalds authored
-
- Oct 25, 2020
-
-
Linus Torvalds authored
-
- Oct 20, 2020
-
-
Mark Wielaard authored
Some old GCC versions between 4.5.0 and 4.9.1 might miscompile code with -fvar-tracking-assingments (which is enabled by default with -g -O2). Commit 2062afb4 ("Fix gcc-4.9.0 miscompilation of load_balance() in scheduler") added -fno-var-tracking-assignments unconditionally to work around this. But newer versions of GCC no longer have this bug, so only add it for versions of GCC before 5.0. This allows various tools such as a perf probe or gdb debuggers or systemtap to resolve variable locations using dwarf locations in more code. Signed-off-by:
Mark Wielaard <mark@klomp.org> Acked-by:
Ian Rogers <irogers@google.com> Reviewed-by:
Andi Kleen <andi@firstfloor.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Oct 14, 2020
-
-
Nick Desaulniers authored
This reverts commit 87e0d4f0. -fno-merge-all-constants has been the default since clang-6; the minimum supported version of clang in the kernel is clang-10 (10.0.1). Suggested-by:
Nathan Chancellor <natechancellor@gmail.com> Signed-off-by:
Nick Desaulniers <ndesaulniers@google.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Tested-by:
Sedat Dilek <sedat.dilek@gmail.com> Reviewed-by:
Fangrui Song <maskray@google.com> Reviewed-by:
Nathan Chancellor <natechancellor@gmail.com> Reviewed-by:
Sedat Dilek <sedat.dilek@gmail.com> Reviewed-by:
Kees Cook <keescook@chromium.org> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: Marco Elver <elver@google.com> Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lkml.kernel.org/r/20200902225911.209899-3-ndesaulniers@google.com Link: https://reviews.llvm.org/rL329300. Link: https://github.com/ClangBuiltLinux/linux/issues/9 Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Oct 12, 2020
-
-
Olaf Hering authored
Catch errors which at least gcc tolerates by default: warning: 'return' with no value, in function returning non-void [-Wreturn-type] Signed-off-by:
Olaf Hering <olaf@aepfle.de> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Oct 11, 2020
-
-
Linus Torvalds authored
-
Jacob Keller authored
namespace.pl is intended to help locate symbols which are defined but are not used externally. The goal is to avoid bloat of the namespace in the resulting kernel image. The script relies on object data, and only finds unused symbols for the configuration used to generate that object data. This results in a lot of false positive warnings such as symbols only used by a single architecture, or symbols which are used externally only under certain configurations. Running namespace.pl using allyesconfig, allmodconfig, and x86_64_defconfig yields the following results: * allmodconfig * 11122 unique symbol names with no external reference * 1194 symbols listed as multiply defined * 214 symbols it can't resolve * allyesconfig * 10997 unique symbol names with no external reference * 1194 symbols listed as multiply defined * 214 symbols it can't resolve * x86_64_defconfig * 5757 unique symbol names with no external reference * 528 symbols listed as multiply defined * 154 symbols it can't resolve The script also has no way to easily limit the scope of the checks to a given subset of the kernel, such as only checking for symbols defined within a module or subsystem. Discussion on public mailing lists seems to indicate that many view the tool output as suspect or not very useful (see discussions at [1] and [2] for further context). As described by Masahiro Yamada at [2], namespace.pl provides 3 types of checks: listing multiply defined symbols, resolving external symbols, and warnings about symbols with no reference. The first category of issues is easily caught by the linker as any set of multiply defined symbols should fail to link. The second category of issues is also caught by linking, as undefined symbols would cause issues. Even with modules, these types of issues where a module relies on an external symbol are caught by modpost. The remaining category of issues reported is the list of symbols with no external reference, and is the primary motivation of this script. However, it ought to be clear from the above examples that the output is difficult to sort through. Even allyesconfig has ~10000 entries. The current submit-checklist indicates that patches ought to go through namespacecheck and fix any new issues arising. But that itself presents problems. As described at [1], many cases of reports are due to configuration where a function is used externally by some configuration settings. Prominent maintainers appear to dislike changes modify code such that symbols become static based on CONFIG_* flags ([3], and [4]) One possible solution is to adjust the advice and indicate that we only care about the output of namespacecheck on allyesconfig or allmodconfig builds... However, given the discussion at [2], I suspect that few people are actively using this tool. It doesn't have a maintainer in the MAINTAINERS flie, and it produces so many warnings for unused symbols that it is difficult to use effectively. Thus, I propose we simply remove it. [1] https://lore.kernel.org/netdev/20200708164812.384ae8ea@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/ [2] https://lore.kernel.org/lkml/20190129204319.15238-1-jacob.e.keller@intel.com/ [3] https://lore.kernel.org/netdev/20190828.154744.2058157956381129672.davem@davemloft.net/ [4] https://lore.kernel.org/netdev/20190827210928.576c5fef@cakuba.netronome.com/ Signed-off-by:
Jacob Keller <jacob.e.keller@intel.com> Acked-by:
Randy Dunlap <rdunlap@infradead.org> Acked-by:
Jakub Kicinski <kuba@kernel.org> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Oct 09, 2020
-
-
Bill Wendling authored
ld's --build-id defaults to "sha1" style, while lld defaults to "fast". The build IDs are very different between the two, which may confuse programs that reference them. Signed-off-by:
Bill Wendling <morbo@google.com> Acked-by:
David S. Miller <davem@davemloft.net> Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org>
-
- Oct 04, 2020
-
-
Linus Torvalds authored
-
- Sep 27, 2020
-
-
Linus Torvalds authored
-
- Sep 24, 2020
-
-
Masahiro Yamada authored
The minimal compiler versions, GCC 4.9 and Clang 10 support this flag. Here is the godbolt: https://godbolt.org/z/xvjcMa Signed-off-by:
Masahiro Yamada <masahiroy@kernel.org> Reviewed-by:
Nathan Chancellor <natechancellor@gmail.com> Acked-by:
Will Deacon <will@kernel.org>
-