<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/scripts/Makefile.lib, branch v6.14.9</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.14.9</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.14.9'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2025-05-02T06:02:15Z</updated>
<entry>
<title>objtool: Silence more KCOV warnings, part 2</title>
<updated>2025-05-02T06:02:15Z</updated>
<author>
<name>Josh Poimboeuf</name>
<email>jpoimboe@kernel.org</email>
</author>
<published>2025-04-01T04:26:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c1d58ce7c1bd0f64afe45dd756041b8cf6f7a746'/>
<id>urn:sha1:c1d58ce7c1bd0f64afe45dd756041b8cf6f7a746</id>
<content type='text'>
commit 55c78035a1a8dfb05f1472018ce2a651701adb7d upstream.

Similar to GCOV, KCOV can leave behind dead code and undefined behavior.
Warnings related to those should be ignored.

The previous commit:

  6b023c784204 ("objtool: Silence more KCOV warnings")

... only did so for CONFIG_CGOV_KERNEL.  Also do it for CONFIG_KCOV, but
for real this time.

Fixes the following warning:

  vmlinux.o: warning: objtool: synaptics_report_mt_data: unexpected end of section .text.synaptics_report_mt_data

Fixes: 6b023c784204 ("objtool: Silence more KCOV warnings")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Josh Poimboeuf &lt;jpoimboe@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: https://lore.kernel.org/r/a44ba16e194bcbc52c1cef3d3cd9051a62622723.1743481539.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/oe-kbuild-all/202503282236.UhfRsF3B-lkp@intel.com/
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kbuild: fix misspelling in scripts/Makefile.lib</title>
<updated>2025-02-06T10:28:14Z</updated>
<author>
<name>Oleh Zadorozhnyi</name>
<email>lesorubshayan@gmail.com</email>
</author>
<published>2025-02-04T05:17:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ba958ac74800573f7f54dbe2a7a7b9a9a523ed52'/>
<id>urn:sha1:ba958ac74800573f7f54dbe2a7a7b9a9a523ed52</id>
<content type='text'>
Signed-off-by: Oleh Zadorozhnyi &lt;lesorubshayan@gmail.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: fix Clang LTO with CONFIG_OBJTOOL=n</title>
<updated>2025-01-31T19:28:05Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2025-01-31T14:04:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=695ed93bb30e03e9f826ee70abdd83f970741a37'/>
<id>urn:sha1:695ed93bb30e03e9f826ee70abdd83f970741a37</id>
<content type='text'>
Since commit bede169618c6 ("kbuild: enable objtool for *.mod.o and
additional kernel objects"), Clang LTO builds do not perform any
optimizations when CONFIG_OBJTOOL is disabled (e.g., for ARCH=arm64).
This is because every LLVM bitcode file is immediately converted to
ELF format before the object files are linked together.

This commit fixes the breakage.

Fixes: bede169618c6 ("kbuild: enable objtool for *.mod.o and additional kernel objects")
Reported-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Tested-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
</content>
</entry>
<entry>
<title>kbuild: Strip runtime const RELA sections correctly</title>
<updated>2025-01-31T19:28:05Z</updated>
<author>
<name>Ard Biesheuvel</name>
<email>ardb@kernel.org</email>
</author>
<published>2025-01-13T15:53:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=71d815bf5dfd4f63f7557e0abe7f257c202863a1'/>
<id>urn:sha1:71d815bf5dfd4f63f7557e0abe7f257c202863a1</id>
<content type='text'>
Due to the fact that runtime const ELF sections are named without a
leading period or double underscore, the RSTRIP logic that removes the
static RELA sections from vmlinux fails to identify them. This results
in a situation like below, where some sections that were supposed to get
removed are left behind.

  [Nr] Name                              Type            Address          Off     Size   ES Flg Lk Inf Al

  [58] runtime_shift_d_hash_shift        PROGBITS        ffffffff83500f50 2900f50 000014 00   A  0   0  1
  [59] .relaruntime_shift_d_hash_shift   RELA            0000000000000000 55b6f00 000078 18   I 70  58  8
  [60] runtime_ptr_dentry_hashtable      PROGBITS        ffffffff83500f68 2900f68 000014 00   A  0   0  1
  [61] .relaruntime_ptr_dentry_hashtable RELA            0000000000000000 55b6f78 000078 18   I 70  60  8
  [62] runtime_ptr_USER_PTR_MAX          PROGBITS        ffffffff83500f80 2900f80 000238 00   A  0   0  1
  [63] .relaruntime_ptr_USER_PTR_MAX     RELA            0000000000000000 55b6ff0 000d50 18   I 70  62  8

So tweak the match expression to strip all sections starting with .rel.
While at it, consolidate the logic used by RISC-V, s390 and x86 into a
single shared Makefile library command.

Link: https://lore.kernel.org/all/CAHk-=wjk3ynjomNvFN8jf9A1k=qSc=JFF591W00uXj-qqNUxPQ@mail.gmail.com/
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Reviewed-by: Charlie Jenkins &lt;charlie@rivosinc.com&gt;
Tested-by: Charlie Jenkins &lt;charlie@rivosinc.com&gt;
Tested-by: Alexander Gordeev &lt;agordeev@linux.ibm.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: switch from lz4c to lz4 for compression</title>
<updated>2024-11-27T23:11:56Z</updated>
<author>
<name>Parth Pancholi</name>
<email>parth.pancholi@toradex.com</email>
</author>
<published>2024-11-14T14:56:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e397a603e49cc7c7c113fad9f55a09637f290c34'/>
<id>urn:sha1:e397a603e49cc7c7c113fad9f55a09637f290c34</id>
<content type='text'>
Replace lz4c with lz4 for kernel image compression.
Although lz4 and lz4c are functionally similar, lz4c has been deprecated
upstream since 2018. Since as early as Ubuntu 16.04 and Fedora 25, lz4
and lz4c have been packaged together, making it safe to update the
requirement from lz4c to lz4.

Consequently, some distributions and build systems, such as OpenEmbedded,
have fully transitioned to using lz4. OpenEmbedded core adopted this
change in commit fe167e082cbd ("bitbake.conf: require lz4 instead of
lz4c"), causing compatibility issues when building the mainline kernel
in the latest OpenEmbedded environment, as seen in the errors below.

This change also updates the LZ4 compression commands to make it backward
compatible by replacing stdin and stdout with the '-' option, due to some
unclear reason, the stdout keyword does not work for lz4 and '-' works for
both. In addition, this modifies the legacy '-c1' with '-9' which is also
compatible with both. This fixes the mainline kernel build failures with
the latest master OpenEmbedded builds associated with the mentioned
compatibility issues.

LZ4     arch/arm/boot/compressed/piggy_data
/bin/sh: 1: lz4c: not found
...
...
ERROR: oe_runmake failed

Link: https://github.com/lz4/lz4/pull/553
Suggested-by: Francesco Dolcini &lt;francesco.dolcini@toradex.com&gt;
Signed-off-by: Parth Pancholi &lt;parth.pancholi@toradex.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: enable objtool for *.mod.o and additional kernel objects</title>
<updated>2024-11-27T23:11:55Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-13T23:45:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bede169618c68379e1be7ace14e8ac85b964a9ec'/>
<id>urn:sha1:bede169618c68379e1be7ace14e8ac85b964a9ec</id>
<content type='text'>
Currently, objtool is disabled in scripts/Makefile.{modfinal,vmlinux}.

This commit moves rule_cc_o_c and rule_as_o_S to scripts/Makefile.lib
and set objtool-enabled to y there.

With this change, *.mod.o, .module-common.o,  builtin-dtb.o, and
vmlinux.export.o will now be covered by objtool.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: move cmd_cc_o_c and cmd_as_o_S to scripts/Malefile.lib</title>
<updated>2024-11-27T23:11:55Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-13T23:45:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=000e22a80de0727839bb753159ac05c8ba20c3e3'/>
<id>urn:sha1:000e22a80de0727839bb753159ac05c8ba20c3e3</id>
<content type='text'>
The cmd_cc_o_c and cmd_as_o_S macros are duplicated in
scripts/Makefile.{build,modfinal,vmlinux}.

This commit factors them out to scripts/Makefile.lib.

No functional changes are intended.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: support building external modules in a separate build directory</title>
<updated>2024-11-27T23:11:55Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-10T01:34:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=11b3d5175e6bc3779159228e6077be202d2b0069'/>
<id>urn:sha1:11b3d5175e6bc3779159228e6077be202d2b0069</id>
<content type='text'>
There has been a long-standing request to support building external
modules in a separate build directory.

This commit introduces a new environment variable, KBUILD_EXTMOD_OUTPUT,
and its shorthand Make variable, MO.

A simple usage:

 $ make -C &lt;kernel-dir&gt; M=&lt;module-src-dir&gt; MO=&lt;module-build-dir&gt;

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nicolas Schier &lt;nicolas@fjasle.eu&gt;
</content>
</entry>
<entry>
<title>kbuild: Add Propeller configuration for kernel build</title>
<updated>2024-11-27T00:38:27Z</updated>
<author>
<name>Rong Xu</name>
<email>xur@google.com</email>
</author>
<published>2024-11-02T17:51:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d5dc95836147f2e25b134c0ca3a0bc1a5867ea29'/>
<id>urn:sha1:d5dc95836147f2e25b134c0ca3a0bc1a5867ea29</id>
<content type='text'>
Add the build support for using Clang's Propeller optimizer. Like
AutoFDO, Propeller uses hardware sampling to gather information
about the frequency of execution of different code paths within a
binary. This information is then used to guide the compiler's
optimization decisions, resulting in a more efficient binary.

The support requires a Clang compiler LLVM 19 or later, and the
create_llvm_prof tool
(https://github.com/google/autofdo/releases/tag/v0.30.1). This
commit is limited to x86 platforms that support PMU features
like LBR on Intel machines and AMD Zen3 BRS.

Here is an example workflow for building an AutoFDO+Propeller
optimized kernel:

1) Build the kernel on the host machine, with AutoFDO and Propeller
   build config
      CONFIG_AUTOFDO_CLANG=y
      CONFIG_PROPELLER_CLANG=y
   then
      $ make LLVM=1 CLANG_AUTOFDO_PROFILE=&lt;autofdo_profile&gt;

“&lt;autofdo_profile&gt;” is the profile collected when doing a non-Propeller
AutoFDO build. This step builds a kernel that has the same optimization
level as AutoFDO, plus a metadata section that records basic block
information. This kernel image runs as fast as an AutoFDO optimized
kernel.

2) Install the kernel on test/production machines.

3) Run the load tests. The '-c' option in perf specifies the sample
   event period. We suggest using a suitable prime number,
   like 500009, for this purpose.
   For Intel platforms:
      $ perf record -e BR_INST_RETIRED.NEAR_TAKEN:k -a -N -b -c &lt;count&gt; \
        -o &lt;perf_file&gt; -- &lt;loadtest&gt;
   For AMD platforms:
      The supported system are: Zen3 with BRS, or Zen4 with amd_lbr_v2
      # To see if Zen3 support LBR:
      $ cat proc/cpuinfo | grep " brs"
      # To see if Zen4 support LBR:
      $ cat proc/cpuinfo | grep amd_lbr_v2
      # If the result is yes, then collect the profile using:
      $ perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a \
        -N -b -c &lt;count&gt; -o &lt;perf_file&gt; -- &lt;loadtest&gt;

4) (Optional) Download the raw perf file to the host machine.

5) Generate Propeller profile:
   $ create_llvm_prof --binary=&lt;vmlinux&gt; --profile=&lt;perf_file&gt; \
     --format=propeller --propeller_output_module_name \
     --out=&lt;propeller_profile_prefix&gt;_cc_profile.txt \
     --propeller_symorder=&lt;propeller_profile_prefix&gt;_ld_profile.txt

   “create_llvm_prof” is the profile conversion tool, and a prebuilt
   binary for linux can be found on
   https://github.com/google/autofdo/releases/tag/v0.30.1 (can also build
   from source).

   "&lt;propeller_profile_prefix&gt;" can be something like
   "/home/user/dir/any_string".

   This command generates a pair of Propeller profiles:
   "&lt;propeller_profile_prefix&gt;_cc_profile.txt" and
   "&lt;propeller_profile_prefix&gt;_ld_profile.txt".

6) Rebuild the kernel using the AutoFDO and Propeller profile files.
      CONFIG_AUTOFDO_CLANG=y
      CONFIG_PROPELLER_CLANG=y
   and
      $ make LLVM=1 CLANG_AUTOFDO_PROFILE=&lt;autofdo_profile&gt; \
        CLANG_PROPELLER_PROFILE_PREFIX=&lt;propeller_profile_prefix&gt;

Co-developed-by: Han Shen &lt;shenhan@google.com&gt;
Signed-off-by: Han Shen &lt;shenhan@google.com&gt;
Signed-off-by: Rong Xu &lt;xur@google.com&gt;
Suggested-by: Sriraman Tallam &lt;tmsriram@google.com&gt;
Suggested-by: Krzysztof Pszeniczny &lt;kpszeniczny@google.com&gt;
Suggested-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Suggested-by: Stephane Eranian &lt;eranian@google.com&gt;
Tested-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Tested-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Reviewed-by: Kees Cook &lt;kees@kernel.org&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: Add AutoFDO support for Clang build</title>
<updated>2024-11-06T13:41:09Z</updated>
<author>
<name>Rong Xu</name>
<email>xur@google.com</email>
</author>
<published>2024-11-02T17:51:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=315ad8780a129e82e2c5c65ee6e970d91a577acb'/>
<id>urn:sha1:315ad8780a129e82e2c5c65ee6e970d91a577acb</id>
<content type='text'>
Add the build support for using Clang's AutoFDO. Building the kernel
with AutoFDO does not reduce the optimization level from the
compiler. AutoFDO uses hardware sampling to gather information about
the frequency of execution of different code paths within a binary.
This information is then used to guide the compiler's optimization
decisions, resulting in a more efficient binary. Experiments
showed that the kernel can improve up to 10% in latency.

The support requires a Clang compiler after LLVM 17. This submission
is limited to x86 platforms that support PMU features like LBR on
Intel machines and AMD Zen3 BRS. Support for SPE on ARM 1,
 and BRBE on ARM 1 is part of planned future work.

Here is an example workflow for AutoFDO kernel:

1) Build the kernel on the host machine with LLVM enabled, for example,
       $ make menuconfig LLVM=1
    Turn on AutoFDO build config:
      CONFIG_AUTOFDO_CLANG=y
    With a configuration that has LLVM enabled, use the following
    command:
       scripts/config -e AUTOFDO_CLANG
    After getting the config, build with
      $ make LLVM=1

2) Install the kernel on the test machine.

3) Run the load tests. The '-c' option in perf specifies the sample
   event period. We suggest     using a suitable prime number,
   like 500009, for this purpose.
   For Intel platforms:
      $ perf record -e BR_INST_RETIRED.NEAR_TAKEN:k -a -N -b -c &lt;count&gt; \
        -o &lt;perf_file&gt; -- &lt;loadtest&gt;
   For AMD platforms:
      The supported system are: Zen3 with BRS, or Zen4 with amd_lbr_v2
     For Zen3:
      $ cat proc/cpuinfo | grep " brs"
      For Zen4:
      $ cat proc/cpuinfo | grep amd_lbr_v2
      $ perf record --pfm-events RETIRED_TAKEN_BRANCH_INSTRUCTIONS:k -a \
        -N -b -c &lt;count&gt; -o &lt;perf_file&gt; -- &lt;loadtest&gt;

4) (Optional) Download the raw perf file to the host machine.

5) To generate an AutoFDO profile, two offline tools are available:
   create_llvm_prof and llvm_profgen. The create_llvm_prof tool is part
   of the AutoFDO project and can be found on GitHub
   (https://github.com/google/autofdo), version v0.30.1 or later. The
   llvm_profgen tool is included in the LLVM compiler itself. It's
   important to note that the version of llvm_profgen doesn't need to
   match the version of Clang. It needs to be the LLVM 19 release or
   later, or from the LLVM trunk.
      $ llvm-profgen --kernel --binary=&lt;vmlinux&gt; --perfdata=&lt;perf_file&gt; \
        -o &lt;profile_file&gt;
   or
      $ create_llvm_prof --binary=&lt;vmlinux&gt; --profile=&lt;perf_file&gt; \
        --format=extbinary --out=&lt;profile_file&gt;

   Note that multiple AutoFDO profile files can be merged into one via:
      $ llvm-profdata merge -o &lt;profile_file&gt;  &lt;profile_1&gt; ... &lt;profile_n&gt;

6) Rebuild the kernel using the AutoFDO profile file with the same config
   as step 1, (Note CONFIG_AUTOFDO_CLANG needs to be enabled):
      $ make LLVM=1 CLANG_AUTOFDO_PROFILE=&lt;profile_file&gt;

Co-developed-by: Han Shen &lt;shenhan@google.com&gt;
Signed-off-by: Han Shen &lt;shenhan@google.com&gt;
Signed-off-by: Rong Xu &lt;xur@google.com&gt;
Suggested-by: Sriraman Tallam &lt;tmsriram@google.com&gt;
Suggested-by: Krzysztof Pszeniczny &lt;kpszeniczny@google.com&gt;
Suggested-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Suggested-by: Stephane Eranian &lt;eranian@google.com&gt;
Tested-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Tested-by: Yabin Cui &lt;yabinc@google.com&gt;
Tested-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Reviewed-by: Kees Cook &lt;kees@kernel.org&gt;
Tested-by: Peter Jung &lt;ptr1337@cachyos.org&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
</feed>
