- 02 10月, 2022 2 次提交
-
-
由 Masahiro Yamada 提交于
Kbuild puts the objects listed in head-y at the head of vmlinux. Conventionally, we do this for head*.S, which contains the kernel entry point. A counter approach is to control the section order by the linker script. Actually, the code marked as __HEAD goes into the ".head.text" section, which is placed before the normal ".text" section. I do not know if both of them are needed. From the build system perspective, head-y is not mandatory. If you can achieve the proper code placement by the linker script only, it would be cleaner. I collected the current head-y objects into head-object-list.txt. It is a whitelist. My hope is it will be reduced in the long run. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
The objects placed at the head of vmlinux need special treatments: - arch/$(SRCARCH)/Makefile adds them to head-y in order to place them before other archives in the linker command line. - arch/$(SRCARCH)/kernel/Makefile adds them to extra-y instead of obj-y to avoid them going into built-in.a. This commit gets rid of the latter. Create vmlinux.a to collect all the objects that are unconditionally linked to vmlinux. The objects listed in head-y are moved to the head of vmlinux.a by using 'ar m'. With this, arch/$(SRCARCH)/kernel/Makefile can consistently use obj-y for builtin objects. There is no *.o that is directly linked to vmlinux. Drop unneeded code in scripts/clang-tools/gen_compile_commands.py. $(AR) mPi needs 'T' to workaround the llvm-ar bug. The fix was suggested by Nathan Chancellor [1]. [1]: https://lore.kernel.org/llvm/YyjjT5gQ2hGMH0ni@dev-arch.thelio-3990X/Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
- 29 9月, 2022 15 次提交
-
-
由 Masahiro Yamada 提交于
V=1 (verbose build) shows commands executed by Make, but it may cause misunderstanding. For example, the following command shows the outstanding error message. $ make V=1 INSTALL_PATH=/tmp install test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) unset sub_make_done; ./scripts/install.sh It is not an error. Make just showed the recipe lines it has executed, but people may think that 'make install' has failed. Likewise, the combination of V=1 and O= shows confusing "*** The source tree is not clean, please run 'make mrproper'". Suppress such misleading logs. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Reviewed-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
Currently, modpost is executed twice; first for vmlinux, second for modules. This commit merges them. Current build flow ================== 1) build obj-y and obj-m objects 2) link vmlinux.o 3) modpost for vmlinux 4) link vmlinux 5) modpost for modules 6) link modules (*.ko) The build steps 1) through 6) are serialized, that is, modules are built after vmlinux. You do not get benefits of parallel builds when scripts/link-vmlinux.sh is being run. New build flow ============== 1) build obj-y and obj-m objects 2) link vmlinux.o 3) modpost for vmlinux and modules 4a) link vmlinux 4b) link modules (*.ko) In the new build flow, modpost is invoked just once. vmlinux and modules are built in parallel. One exception is CONFIG_DEBUG_INFO_BTF_MODULES=y, where modules depend on vmlinux. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
Move the build rules of vmlinux.o out of scripts/link-vmlinux.sh to clearly separate 1) pre-modpost, 2) modpost, 3) post-modpost stages. This will make further refactoring possible. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
.vmlinux.objs is used by modpost, so scripts/Makefile.modpost is a better place to generate it. It is used only when CONFIG_MODVERSIONS=y. It should be guarded by "ifdef CONFIG_MODVERSIONS". Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
Use the ordinary obj-y syntax to list subdirectories. Note1: Previously, the link order of lib-y depended on CONFIG_MODULES; lib-y was linked before drivers-y when CONFIG_MODULES=y, otherwise after drivers-y. This was a bug of commit 7273ad2b ("kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y"), but it was not a big deal after all. Now, all objects listed in lib-y are linked last, irrespective of CONFIG_MODULES. Note2: Finally, the single target build in arch/*/lib/ works correctly. There was a bug report about this. [1] $ make ARCH=arm arch/arm/lib/findbit.o CALL scripts/checksyscalls.sh AS arch/arm/lib/findbit.o [1]: https://lore.kernel.org/linux-kbuild/YvUQOwL6lD4%2F5%2FU6@shell.armlinux.org.uk/Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Nick Desaulniers 提交于
cc-ifversion is GCC specific. Replace it with compiler specific variants. Update the users of cc-ifversion to use these new macros. Link: https://github.com/ClangBuiltLinux/linux/issues/350 Link: https://lore.kernel.org/llvm/CAGG=3QWSAUakO42kubrCap8fp-gm1ERJJAYXTnP1iHk_wrH=BQ@mail.gmail.com/Suggested-by: NBill Wendling <morbo@google.com> Reviewed-by: NNathan Chancellor <nathan@kernel.org> Signed-off-by: NNick Desaulniers <ndesaulniers@google.com> Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
The single target build has a subtle bug for the combination for an individual file and a subdirectory. [1] 'make kernel/fork.i' builds only kernel/fork.i $ make kernel/fork.i CALL scripts/checksyscalls.sh DESCEND objtool CPP kernel/fork.i [2] 'make kernel/' builds only under the kernel/ directory. $ make kernel/ CALL scripts/checksyscalls.sh DESCEND objtool CC kernel/fork.o CC kernel/exec_domain.o [snip] CC kernel/rseq.o AR kernel/built-in.a But, if you try to do [1] and [2] in a single command, you will get only [1] with a weird log: $ make kernel/fork.i kernel/ CALL scripts/checksyscalls.sh DESCEND objtool CPP kernel/fork.i make[2]: Nothing to be done for 'kernel/'. With 'make kernel/fork.i kernel/', you should get both [1] and [2]. Rewrite the single target build. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
Now that UTS_VERSION was separated out, this header can be generated much earlier, and probably the top Makefile is a better place to do it than init/Makefile. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
Unify the code between in-tree builds and external module builds. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
Remove the potentially invalid modules.order instead of using the temporary file. Also, KBUILD_MODULES is don't care for single builds. No need to cancel it. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
The dependency, "modules: modules_check" is specified twice. Commit 1a998be6 ("kbuild: check module name conflict for external modules as well") missed to clean it up. 'PHONY += modules' also appears twice. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
The AWK code was added to deduplicate modules.order in case $(obj-m) contains the same module multiple times, but it is actually unneeded since commit b2c88554 ("kbuild: update modules.order only when contained modules are updated"). The list is already deduplicated before being processed by AWK because $^ is the deduplicated list of prerequisites. (Please note the real-prereqs macro uses $^) Yet, modules.order will contain duplication if two different Makefiles build the same module: foo/Makefile: obj-m += bar/baz.o foo/bar/Makefile: obj-m += baz.o However, the parallel builds cannot properly handle this case in the first place. So, it is better to let it fail (as already done by scripts/modules-check.sh). Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
It is unneeded to check the sha1sum every time. Create the timestamp files to manage it. Add '.' to clean-dirs because 'make clean' must visit ./Kbuild to clean up the timestamp files. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Masahiro Yamada 提交于
My future plan is to list subdirectories in ./Kbuild. When it occurs, $(vmlinux-alldirs) will not contain all subdirectories. Let's hard-code the directory list until I get around to implementing a more sophisticated way for generating a source tarball. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NNick Desaulniers <ndesaulniers@google.com> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu>
-
由 Masahiro Yamada 提交于
missing-syscalls and old-atomics are meant to be phony targets. Adding them to always-y is odd. (always-y should generate something). Add a new phony target 'prepare', which depends on all the other. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
- 26 9月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 19 9月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 12 9月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 05 9月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 01 9月, 2022 1 次提交
-
-
由 Masahiro Yamada 提交于
Previously 'make ARCH=um headers' stopped because of missing arch/um/include/uapi/asm/Kbuild. The error is not shown since commit ed102bf2 ("um: Fix W=1 missing-include-dirs warnings") added arch/um/include/uapi/asm/Kbuild. Hard-code the unsupported architecture, so it works like before. Fixes: ed102bf2 ("um: Fix W=1 missing-include-dirs warnings") Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Acked-by: NRichard Weinberger <richard@nod.at>
-
- 29 8月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 22 8月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 21 8月, 2022 1 次提交
-
-
由 Masahiro Yamada 提交于
Commit b2c88554 ("kbuild: update modules.order only when contained modules are updated") accidentally changed the modules order. Prior to that commit, the modules order was determined based on vmlinux-dirs, which lists core-y/m, drivers-y/m, libs-y/m, in this order. Now, subdir-modorder lists them in a different order: core-y/m, libs-y/m, drivers-y/m. Presumably, there was no practical issue because the modules in drivers and libs are orthogonal, but there is no reason to have this distortion. Get back to the original order. Fixes: b2c88554 ("kbuild: update modules.order only when contained modules are updated") Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
- 15 8月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 11 8月, 2022 1 次提交
-
-
由 Nick Desaulniers 提交于
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form: ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker ld: warning: vmlinux has a LOAD segment with RWX permissions Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack. LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check. While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments. Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06f73@kernel.dk/ Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 Link: https://github.com/llvm/llvm-project/issues/57009Reported-and-tested-by: NJens Axboe <axboe@kernel.dk> Suggested-by: NFangrui Song <maskray@google.com> Signed-off-by: NNick Desaulniers <ndesaulniers@google.com> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 01 8月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 31 7月, 2022 1 次提交
-
-
由 Masahiro Yamada 提交于
Factor out the common prerequisites for DT compilation into the new target, dtbs_prepare. Add comments to explain why include/config/kernel.release is the prerequisite. Our policy is that installation targets must not rebuild anything in the tree. If 'make modules_install' is executed as root, include/config/kernel.release may be owned by root. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Reviewed-by: NNicolas Schier <nicolas@fjasle.eu> Reviewed-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org> Tested-by: NDmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
- 27 7月, 2022 3 次提交
-
-
由 Masahiro Yamada 提交于
If the directory path given to KBUILD_EXTMOD (or M=) contains % or :, the module fails to build. % is used in pattern rules, and : as the separator of dependencies. Bail out with a clearer error message. Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Reviewed-by: NNicolas Schier <n.schier@avm.de>
-
由 Nick Desaulniers 提交于
The difference in most compilers between `-O3` and `-O2` is mostly down to whether loops with statically determinable trip counts are fully unrolled vs unrolled to a multiple of SIMD width. This patch is effectively a revert of commit 15f5db60 ("kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC") without re-adding ARCH_CFLAGS Ever since commit cfdbc2e1 ("ARC: Build system: Makefiles, Kconfig, Linker script") ARC has been built with -O3, though the reason for doing so was not specified in inline comments or the commit message. This commit does not re-add -O3 to arch/arc/Makefile. Folks looking to experiment with `-O3` (or any compiler flag for that matter) may pass them along to the command line invocation of make: $ make KCFLAGS=-O3 Code that looks to re-add an explicit Kconfig option for `-O3` should provide: 1. A rigorous and reproducible performance profile of a reasonable userspace workload that demonstrates a hot loop in the kernel that would benefit from `-O3` over `-O2`. 2. Disassembly of said loop body before and after. 3. Provides stats on terms of increase in file size. Link: https://lore.kernel.org/linux-kbuild/CA+55aFz2sNBbZyg-_i8_Ldr2e8o9dfvdSfHHuRzVtP2VMAUWPg@mail.gmail.com/Signed-off-by: NNick Desaulniers <ndesaulniers@google.com> Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
-
由 Guillaume Tucker 提交于
Replace headers_install with headers as kselftest uses the header files from within the kernel tree rather than from a system-wide installation. We can still run this directly: $ make O=build kselftest-all and when building from the selftests directory: $ make O=build headers $ make O=build -C tools/testing/selftests all Signed-off-by: NGuillaume Tucker <guillaume.tucker@collabora.com> Reported-by: NMasahiro Yamada <masahiroy@kernel.org> Acked-by: NShuah Khan <skhan@linuxfoundation.org> Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
-
- 25 7月, 2022 2 次提交
-
-
由 Jens Axboe 提交于
In preparation for splitting io_uring up a bit, move it into its own top level directory. It didn't really belong in fs/ anyway, as it's not a file system only API. This adds io_uring/ and moves the core files in there, and updates the MAINTAINERS file for the new location. Signed-off-by: NJens Axboe <axboe@kernel.dk>
-
由 Linus Torvalds 提交于
-
- 18 7月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 12 7月, 2022 1 次提交
-
-
由 Guillaume Tucker 提交于
Add headers_install as a dependency to kselftest targets so that they can be run directly from the top of the tree. The kselftest Makefile used to try to call headers_install "backwards" but failed due to the relative path not being consistent. Now we can either run this directly: $ make O=build kselftest-all or this: $ make O=build headers_install $ make O=build -C tools/testing/selftest all The same commands work as well when building directly in the source tree (no O=) or any arbitrary path (relative or absolute). Signed-off-by: NGuillaume Tucker <guillaume.tucker@collabora.com> Tested-by: NAnders Roxell <anders.roxell@linaro.org> Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
-
- 11 7月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 04 7月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 27 6月, 2022 1 次提交
-
-
由 Linus Torvalds 提交于
-
- 26 6月, 2022 1 次提交
-
-
由 Masahiro Yamada 提交于
If CONFIG_TRIM_UNUSED_KSYMS is enabled and the kernel is built from a pristine state, the vmlinux is linked twice. Commit 3fdc7d3f ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS") explains why this happens, but it did not fix the issue at all. Now I realized I had applied a wrong patch. In v1 patch [1], the autoksyms_recursive target correctly recurses to "$(MAKE) -f $(srctree)/Makefile autoksyms_recursive". In v2 patch [2], I accidentally dropped the diff line, and it recurses to "$(MAKE) -f $(srctree)/Makefile vmlinux". Restore the code I intended in v1. [1]: https://lore.kernel.org/linux-kbuild/1521045861-22418-8-git-send-email-yamada.masahiro@socionext.com/ [2]: https://lore.kernel.org/linux-kbuild/1521166725-24157-8-git-send-email-yamada.masahiro@socionext.com/ Fixes: 3fdc7d3f ("kbuild: link vmlinux only once for CONFIG_TRIM_UNUSED_KSYMS") Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org> Tested-by: NSami Tolvanen <samitolvanen@google.com> Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
-