<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/scripts/Makefile.build, branch v5.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-06-03T04:22:17Z</updated>
<entry>
<title>kbuild: update modules.order only when contained modules are updated</title>
<updated>2020-06-03T04:22:17Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-06-01T05:57:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b2c88554912267483baf8b4f5ae0a1bff529f6a3'/>
<id>urn:sha1:b2c88554912267483baf8b4f5ae0a1bff529f6a3</id>
<content type='text'>
Make modules.order depend on $(obj-m), and use if_changed to build it.
This will avoid unneeded update of modules.order, which will be useful
to optimize the modpost stage.

Currently, the second pass of modpost is always invoked. By checking the
timestamp of modules.order, we can avoid the unneeded modpost.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: refactor tagets caluculation for KBUILD_{BUILTIN,KBUILD_MODULES}</title>
<updated>2020-06-01T12:50:46Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-06-01T05:56:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f3908ab3ffd92c77af1bad7f699b8a1c14f462bf'/>
<id>urn:sha1:f3908ab3ffd92c77af1bad7f699b8a1c14f462bf</id>
<content type='text'>
Remove lib-target, builtin-target, modorder-target, and modtargets.

Instead, add targets-for-builtin and targets-for-modules.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: make modules.order rule consistent with built-in.a</title>
<updated>2020-05-25T15:03:16Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-05-22T02:00:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=454753d9f67ae40b6a2142ddb6b4dbdcc9654aa9'/>
<id>urn:sha1:454753d9f67ae40b6a2142ddb6b4dbdcc9654aa9</id>
<content type='text'>
built-in.a contains the built-in object paths from the current and sub
directories.

module.order collects the module paths from the current and sub
directories.

Make their build rules look more symmetrical.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: rename subdir-obj-y to subdir-builtin</title>
<updated>2020-05-25T15:03:16Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-05-22T02:00:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=aaa385ba9afe7aca25a1545a609963ee59b6c76b'/>
<id>urn:sha1:aaa385ba9afe7aca25a1545a609963ee59b6c76b</id>
<content type='text'>
I think subdir-builtin is clearer.

While I was here, I made its build rule explicit.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: move subdir-obj-y to scripts/Makefile.build</title>
<updated>2020-05-25T15:03:16Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-05-22T02:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6ba3bcb01393777d38c8b466249e4a3e6ffc8adb'/>
<id>urn:sha1:6ba3bcb01393777d38c8b466249e4a3e6ffc8adb</id>
<content type='text'>
Save $(addprefix ...) for subdir-obj-y.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: clear KBUILD_MODULES in top Makefile if CONFIG_MODULES=n</title>
<updated>2020-05-25T15:03:16Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-05-22T01:59:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b480fec988b051df792633e99bf622fc63a305f6'/>
<id>urn:sha1:b480fec988b051df792633e99bf622fc63a305f6</id>
<content type='text'>
Do not try to build any module-related artifacts when CONFIG_MODULES
is disabled.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: remove ifdef builtin-target / lib-target</title>
<updated>2020-05-25T15:03:16Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-05-22T01:59:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e578edc72276280b8fae57f6bf79cb443ceee7a2'/>
<id>urn:sha1:e578edc72276280b8fae57f6bf79cb443ceee7a2</id>
<content type='text'>
I do not see a good reason to add ifdef here.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
</entry>
<entry>
<title>kbuild: add infrastructure to build userspace programs</title>
<updated>2020-05-17T09:52:01Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-04-29T03:45:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7f3a59db274c3e3d884c785e363a054110f1c266'/>
<id>urn:sha1:7f3a59db274c3e3d884c785e363a054110f1c266</id>
<content type='text'>
Kbuild supports the infrastructure to build host programs, but there
was no support to build userspace programs for the target architecture
(i.e. the same architecture as the kernel).

Sam Ravnborg worked on this in 2014 (https://lkml.org/lkml/2014/7/13/154),
but it was not merged. One problem at that time was, there was no good way
to know whether $(CC) can link standalone programs. In fact, pre-built
kernel.org toolchains [1] are often used for building the kernel, but they
do not provide libc.

Now, we can handle this cleanly because the compiler capability is
evaluated at the Kconfig time. If $(CC) cannot link standalone programs,
the relevant options are hidden by 'depends on CC_CAN_LINK'.

The implementation just mimics scripts/Makefile.host

The userspace programs are compiled with the same flags as the host
programs. In addition, it uses -m32 or -m64 if it is found in
$(KBUILD_CFLAGS).

This new syntax has two usecases.

- Sample programs

  Several userspace programs under samples/ include UAPI headers
  installed in usr/include. Most of them were previously built for
  the host architecture just to use the 'hostprogs' syntax.

  However, 'make headers' always works for the target architecture.
  This caused the arch mismatch in cross-compiling. To fix this
  distortion, sample code should be built for the target architecture.

- Bpfilter

  net/bpfilter/Makefile compiles bpfilter_umh as the user mode helper,
  and embeds it into the kernel. Currently, it overrides HOSTCC with
  CC to use the 'hostprogs' syntax. This hack should go away.

[1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Sam Ravnborg &lt;sam@ravnborg.org&gt;
</content>
</entry>
<entry>
<title>kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y</title>
<updated>2020-04-08T15:13:45Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-03-11T22:37:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7273ad2b08f8ac9563579d16a3cf528857b26f49'/>
<id>urn:sha1:7273ad2b08f8ac9563579d16a3cf528857b26f49</id>
<content type='text'>
Kbuild supports not only obj-y but also lib-y to list objects linked to
vmlinux.

The difference between them is that all the objects from obj-y are
forcibly linked to vmlinux, whereas the objects from lib-y are linked
as needed; if there is no user of a lib-y object, it is not linked.

lib-y is intended to list utility functions that may be called from all
over the place (and may be unused at all), but it is a problem for
EXPORT_SYMBOL(). Even if there is no call-site in the vmlinux, we need
to keep exported symbols for the use from loadable modules.

Commit 7f2084fa55e6 ("[kbuild] handle exports in lib-y objects reliably")
worked around it by linking a dummy object, lib-ksyms.o, which contains
references to all the symbols exported from lib.a in that directory.
It uses the linker script command, EXTERN. Unfortunately, the meaning of
EXTERN of ld.lld is different from that of ld.bfd. Therefore, this does
not work with LD=ld.lld (CBL issue #515).

Anyway, the build rule of lib-ksyms.o is somewhat tricky. So, I want to
get rid of it.

At first, I was thinking of accumulating lib-y objects into obj-y
(or even replacing lib-y with obj-y entirely), but the lib-y syntax
is used beyond the ordinary use in lib/ and arch/*/lib/.

Examples:

 - drivers/firmware/efi/libstub/Makefile builds lib.a, which is linked
   into vmlinux in the own way (arm64), or linked to the decompressor
   (arm, x86).

 - arch/alpha/lib/Makefile builds lib.a which is linked not only to
   vmlinux, but also to bootloaders in arch/alpha/boot/Makefile.

 - arch/xtensa/boot/lib/Makefile builds lib.a for use from
   arch/xtensa/boot/boot-redboot/Makefile.

One more thing, adding everything to obj-y would increase the vmlinux
size of allnoconfig (or tinyconfig).

For less impact, I tweaked the destination of lib.a at the top Makefile;
when CONFIG_MODULES=y, lib.a goes to KBUILD_VMLINUX_OBJS, which is
forcibly linked to vmlinux, otherwise lib.a goes to KBUILD_VMLINUX_LIBS
as before.

The size impact for normal usecases is quite small since at lease one
symbol in every lib-y object is eventually called by someone. In case
you are intrested, here are the figures.

x86_64_defconfig:

   text	   data	    bss	    dec	    hex	filename
19566602 5422072 1589328 26578002 1958c52 vmlinux.before
19566932 5422104 1589328 26578364 1958dbc vmlinux.after

The case with the biggest impact is allnoconfig + CONFIG_MODULES=y.

ARCH=x86 allnoconfig + CONFIG_MODULES=y:

   text	   data	    bss	    dec	    hex	filename
1175162	 254740	1220608	2650510	 28718e	vmlinux.before
1177974	 254836	1220608	2653418	 287cea	vmlinux.after

Hopefully this is still not a big deal. The per-file trimming with the
static library is not so effective after all.

If fine-grained optimization is desired, some architectures support
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, which trims dead code per-symbol
basis. When LTO is supported in mainline, even better optimization will
be possible.

Link: https://github.com/ClangBuiltLinux/linux/issues/515
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reported-by: kbuild test robot &lt;lkp@intel.com&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
</content>
</entry>
<entry>
<title>gcc-plugins: drop support for GCC &lt;= 4.7</title>
<updated>2020-04-08T15:13:45Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-03-29T11:08:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=77342a02ff6e14645916d85c8550dd1011c4f7d7'/>
<id>urn:sha1:77342a02ff6e14645916d85c8550dd1011c4f7d7</id>
<content type='text'>
Nobody was opposed to raising minimum GCC version to 4.8 [1]
So, we will drop GCC &lt;= 4.7 support sooner or later.

We always use C++ compiler for building plugins for GCC &gt;= 4.8.

This commit drops the plugin support for GCC &lt;= 4.7 a bit earlier,
which allows us to dump lots of code.

[1] https://lkml.org/lkml/2020/1/23/545

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
</feed>
