diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-19 14:26:08 +0300 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-03-25 20:01:27 +0300 |
commit | f98fe47ce51dee6d97dd91bbeccdde23f043c754 (patch) | |
tree | 9baebcbde886c154d22f51a01a1ca69bd2442660 /lib/zstd | |
parent | f5f336812c233976ad84995110c2266cd94c5cd0 (diff) | |
download | linux-f98fe47ce51dee6d97dd91bbeccdde23f043c754.tar.xz |
kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a
In Kbuild, Makefiles can add the same object to obj-y multiple
times. So,
obj-y += foo.o
obj-y += foo.o
is fine.
However, this is not true when the same object is added multiple
times via composite objects. For example,
obj-y += foo.o bar.o
foo-objs := foo-bar-common.o foo-only.o
bar-objs := foo-bar-common.o bar-only.o
causes build error because two instances of foo-bar-common.o are
linked into the vmlinux.
Makefiles tend to invent ugly work-around, for example
- lib/zstd/Makefile
- drivers/net/ethernet/cavium/liquidio/Makefile
The technique used in Kbuild to avoid the multiple definition error
is to use $(filter $(obj-y), $^). Here, $^ lists the names of all
the prerequisites with duplicated names removed.
By replacing it with $(filter $(real-obj-y), $^) we can do likewise
for composite objects. For built-in objects, we do not need to keep
the composite object structure. We can simply expand them, and link
$(real-obj-y) to built-in.a.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'lib/zstd')
0 files changed, 0 insertions, 0 deletions