* [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m
@ 2018-03-19 11:26 Masahiro Yamada
2018-03-19 11:26 ` [PATCH 2/7] kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a Masahiro Yamada
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
When I was refactoring Makefiles, I stupidly mistook 'real-obj-y' for
'real-objs-y' over and over again. Finally, I decide to rename it to
'real-obj-y'. This is consistent with 'obj-y', 'subdir-obj-y'.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/Makefile.build | 24 ++++++++++++------------
scripts/Makefile.lib | 8 ++++----
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 93d05e3..8c1287f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -119,17 +119,17 @@ modkern_cflags = \
$(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL))
quiet_modtag := $(empty) $(empty)
-$(real-objs-m) : part-of-module := y
-$(real-objs-m:.o=.i) : part-of-module := y
-$(real-objs-m:.o=.s) : part-of-module := y
-$(real-objs-m:.o=.lst): part-of-module := y
+$(real-obj-m) : part-of-module := y
+$(real-obj-m:.o=.i) : part-of-module := y
+$(real-obj-m:.o=.s) : part-of-module := y
+$(real-obj-m:.o=.lst): part-of-module := y
-$(real-objs-m) : quiet_modtag := [M]
-$(real-objs-m:.o=.i) : quiet_modtag := [M]
-$(real-objs-m:.o=.s) : quiet_modtag := [M]
-$(real-objs-m:.o=.lst): quiet_modtag := [M]
+$(real-obj-m) : quiet_modtag := [M]
+$(real-obj-m:.o=.i) : quiet_modtag := [M]
+$(real-obj-m:.o=.s) : quiet_modtag := [M]
+$(real-obj-m:.o=.lst): quiet_modtag := [M]
-$(obj-m) : quiet_modtag := [M]
+$(obj-m) : quiet_modtag := [M]
quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
@@ -333,8 +333,8 @@ $(obj)/%.lst: $(src)/%.c FORCE
modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL)
-$(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
-$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
+$(real-obj-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
+$(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
# .S file exports must have their C prototypes defined in asm/asm-prototypes.h
# or a file that it includes, in order to get versioned symbols. We build a
@@ -412,7 +412,7 @@ endif
$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
$(call if_changed_rule,as_o_S)
-targets += $(real-objs-y) $(real-objs-m) $(lib-y)
+targets += $(real-obj-y) $(real-obj-m) $(lib-y)
targets += $(extra-y) $(MAKECMDGOALS) $(always)
# Linker scripts preprocessor (.lds.S -> .lds)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 33af8d4..6dd68cb 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -52,8 +52,8 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
subdir-obj-y := $(filter %/built-in.a, $(obj-y))
# Replace multi-part objects by their individual parts, look at local dir only
-real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
-real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
+real-obj-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
+real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
# DTB
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -70,8 +70,8 @@ obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
lib-y := $(addprefix $(obj)/,$(lib-y))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
-real-objs-y := $(addprefix $(obj)/,$(real-objs-y))
-real-objs-m := $(addprefix $(obj)/,$(real-objs-m))
+real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
+real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
single-used-m := $(addprefix $(obj)/,$(single-used-m))
multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7] kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling Masahiro Yamada
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
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>
---
scripts/Makefile.build | 21 +++++++--------------
scripts/Makefile.lib | 7 +++----
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 8c1287f..316cb95 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -73,10 +73,10 @@ endif
ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)
lib-target := $(obj)/lib.a
-obj-y += $(obj)/lib-ksyms.o
+real-obj-y += $(obj)/lib-ksyms.o
endif
-ifneq ($(strip $(obj-y) $(need-builtin)),)
+ifneq ($(strip $(real-obj-y) $(need-builtin)),)
builtin-target := $(obj)/built-in.a
endif
@@ -412,7 +412,7 @@ endif
$(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
$(call if_changed_rule,as_o_S)
-targets += $(real-obj-y) $(real-obj-m) $(lib-y)
+targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y)
targets += $(extra-y) $(MAKECMDGOALS) $(always)
# Linker scripts preprocessor (.lds.S -> .lds)
@@ -455,12 +455,12 @@ cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
quiet_cmd_link_o_target = AR $@
# If the list of objects to link is empty, just create an empty built-in.a
-cmd_link_o_target = $(if $(strip $(obj-y)),\
- $(cmd_make_builtin) $@ $(filter $(obj-y), $^) \
+cmd_link_o_target = $(if $(strip $(real-obj-y)),\
+ $(cmd_make_builtin) $@ $(filter $(real-obj-y), $^) \
$(cmd_secanalysis),\
$(cmd_make_empty_builtin) $@)
-$(builtin-target): $(obj-y) FORCE
+$(builtin-target): $(real-obj-y) FORCE
$(call if_changed,link_o_target)
targets += $(builtin-target)
@@ -534,23 +534,16 @@ $($(subst $(obj)/,,$(@:.o=-m)))), $^)
cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
-quiet_cmd_link_multi-y = AR $@
-cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
-
quiet_cmd_link_multi-m = LD [M] $@
cmd_link_multi-m = $(cmd_link_multi-link)
-$(multi-used-y): FORCE
- $(call if_changed,link_multi-y)
-$(call multi_depend, $(multi-used-y), .o, -objs -y)
-
$(multi-used-m): FORCE
$(call if_changed,link_multi-m)
@{ echo $(@:.o=.ko); echo $(link_multi_deps); \
$(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod)
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
-targets += $(multi-used-y) $(multi-used-m)
+targets += $(multi-used-m)
targets := $(filter-out $(PHONY), $(targets))
# Descending
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 6dd68cb..99cd592 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -51,8 +51,9 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
# tell kbuild to descend
subdir-obj-y := $(filter %/built-in.a, $(obj-y))
-# Replace multi-part objects by their individual parts, look at local dir only
-real-obj-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
+# Replace multi-part objects by their individual parts,
+# including built-in.a from subdirectories
+real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
# DTB
@@ -66,14 +67,12 @@ extra-y := $(addprefix $(obj)/,$(extra-y))
always := $(addprefix $(obj)/,$(always))
targets := $(addprefix $(obj)/,$(targets))
modorder := $(addprefix $(obj)/,$(modorder))
-obj-y := $(addprefix $(obj)/,$(obj-y))
obj-m := $(addprefix $(obj)/,$(obj-m))
lib-y := $(addprefix $(obj)/,$(lib-y))
subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y))
real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
single-used-m := $(addprefix $(obj)/,$(single-used-m))
-multi-used-y := $(addprefix $(obj)/,$(multi-used-y))
multi-used-m := $(addprefix $(obj)/,$(multi-used-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
2018-03-19 11:26 ` [PATCH 2/7] kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
2018-03-19 11:32 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 4/7] net: liquidio: " Masahiro Yamada
` (3 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
Now, Kbuild nicely handles composite objects to avoid multiple
definition.
Makefiles can simply add the same objects multiple times across
composite objects.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
The is clean-up from build system point of view.
I will apply this for the Kbuild tree.
lib/zstd/Makefile | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/lib/zstd/Makefile b/lib/zstd/Makefile
index dd0a359..a1a64cf 100644
--- a/lib/zstd/Makefile
+++ b/lib/zstd/Makefile
@@ -4,15 +4,7 @@ obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
ccflags-y += -O3
# Object files unique to zstd_compress and zstd_decompress
-zstd_compress-y := fse_compress.o huf_compress.o compress.o
-zstd_decompress-y := huf_decompress.o decompress.o
-
-# These object files are shared between the modules.
-# Always add them to zstd_compress.
-# Unless both zstd_compress and zstd_decompress are built in
-# then also add them to zstd_decompress.
-zstd_compress-y += entropy_common.o fse_decompress.o zstd_common.o
-
-ifneq ($(CONFIG_ZSTD_COMPRESS)$(CONFIG_ZSTD_DECOMPRESS),yy)
- zstd_decompress-y += entropy_common.o fse_decompress.o zstd_common.o
-endif
+zstd_compress-y := fse_compress.o huf_compress.o compress.o \
+ entropy_common.o fse_decompress.o zstd_common.o
+zstd_decompress-y := huf_decompress.o decompress.o \
+ entropy_common.o fse_decompress.o zstd_common.o
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/7] net: liquidio: clean up Makefile for simpler composite object handling
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
2018-03-19 11:26 ` [PATCH 2/7] kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a Masahiro Yamada
2018-03-19 11:26 ` [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 5/7] kbuild: remove partial section mismatch detection for built-in.a Masahiro Yamada
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
Now, Kbuild nicely handles composite objects to avoid multiple
definition.
Makefiles can simply add the same objects multiple times across
composite objects.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
The is clean-up from build system point of view.
I will apply this for the Kbuild tree.
drivers/net/ethernet/cavium/liquidio/Makefile | 51 +++++++++------------------
1 file changed, 16 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/Makefile b/drivers/net/ethernet/cavium/liquidio/Makefile
index e3fc464..bc99375 100644
--- a/drivers/net/ethernet/cavium/liquidio/Makefile
+++ b/drivers/net/ethernet/cavium/liquidio/Makefile
@@ -2,42 +2,23 @@
#
# Cavium Liquidio ethernet device driver
#
-obj-$(CONFIG_LIQUIDIO) += liquidio.o
-liquidio-$(CONFIG_LIQUIDIO) += lio_ethtool.o \
- lio_core.o \
- request_manager.o \
- response_manager.o \
- octeon_device.o \
- cn66xx_device.o \
- cn68xx_device.o \
- cn23xx_pf_device.o \
- cn23xx_vf_device.o \
- octeon_mailbox.o \
- octeon_mem_ops.o \
- octeon_droq.o \
- octeon_nic.o
+common-objs := lio_ethtool.o \
+ lio_core.o \
+ request_manager.o \
+ response_manager.o \
+ octeon_device.o \
+ cn66xx_device.o \
+ cn68xx_device.o \
+ cn23xx_pf_device.o \
+ cn23xx_vf_device.o \
+ octeon_mailbox.o \
+ octeon_mem_ops.o \
+ octeon_droq.o \
+ octeon_nic.o
-liquidio-objs := lio_main.o octeon_console.o lio_vf_rep.o $(liquidio-y)
+obj-$(CONFIG_LIQUIDIO) += liquidio.o
+liquidio-y := lio_main.o octeon_console.o lio_vf_rep.o $(common-objs)
obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o
-
-ifeq ($(CONFIG_LIQUIDIO)$(CONFIG_LIQUIDIO_VF), yy)
- liquidio_vf-objs := lio_vf_main.o
-else
-liquidio_vf-$(CONFIG_LIQUIDIO_VF) += lio_ethtool.o \
- lio_core.o \
- request_manager.o \
- response_manager.o \
- octeon_device.o \
- cn66xx_device.o \
- cn68xx_device.o \
- cn23xx_pf_device.o \
- cn23xx_vf_device.o \
- octeon_mailbox.o \
- octeon_mem_ops.o \
- octeon_droq.o \
- octeon_nic.o
-
-liquidio_vf-objs := lio_vf_main.o $(liquidio_vf-y)
-endif
+liquidio_vf-y := lio_vf_main.o $(common-objs)
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7] kbuild: remove partial section mismatch detection for built-in.a
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
` (2 preceding siblings ...)
2018-03-19 11:26 ` [PATCH 4/7] net: liquidio: " Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 6/7] kbuild: clean up built-in.a archive rule Masahiro Yamada
2018-03-19 11:26 ` [PATCH 7/7] kbuild: clean up multi-used module link rule Masahiro Yamada
5 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
When built-in.o was incrementally linked with 'ld -r', the section
mismatch analysis for the individual built-in.o was possible when
CONFIG_DEBUG_SECTION_MISMATCH was enabled.
With the migration to the thin archive, built-in.a (former, built-in.o)
is no longer an ELF file. So, the modpost does nothing useful.
scripts/mod/modpost.c just checks the header to bail out, as follows:
/* Is this a valid ELF file? */
if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
(hdr->e_ident[EI_MAG1] != ELFMAG1) ||
(hdr->e_ident[EI_MAG2] != ELFMAG2) ||
(hdr->e_ident[EI_MAG3] != ELFMAG3)) {
/* Not an ELF file - silently ignore it */
return 0;
}
We have the full analysis in the final link stage anyway, so we would
not miss the section mismatching.
I do not see a good reason to require extra linking only for the
purpose of the per-directory analysis. Just get rid of this part.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/Makefile.build | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 316cb95..66461e9 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -456,8 +456,7 @@ quiet_cmd_link_o_target = AR $@
# If the list of objects to link is empty, just create an empty built-in.a
cmd_link_o_target = $(if $(strip $(real-obj-y)),\
- $(cmd_make_builtin) $@ $(filter $(real-obj-y), $^) \
- $(cmd_secanalysis),\
+ $(cmd_make_builtin) $@ $(filter $(real-obj-y), $^), \
$(cmd_make_empty_builtin) $@)
$(builtin-target): $(real-obj-y) FORCE
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/7] kbuild: clean up built-in.a archive rule
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
` (3 preceding siblings ...)
2018-03-19 11:26 ` [PATCH 5/7] kbuild: remove partial section mismatch detection for built-in.a Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 7/7] kbuild: clean up multi-used module link rule Masahiro Yamada
5 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
With the incremental linking entirely dropped, we can simplify
the Makefile.
While I am here, I renamed cmd_link_o_target to cmd_ar_builtin.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/Makefile.build | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 66461e9..e5c1aa3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -450,17 +450,12 @@ ifdef builtin-target
# makes them small and fast, but unable to be used by the linker.
# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
# table and index.
-cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-quiet_cmd_link_o_target = AR $@
-
-# If the list of objects to link is empty, just create an empty built-in.a
-cmd_link_o_target = $(if $(strip $(real-obj-y)),\
- $(cmd_make_builtin) $@ $(filter $(real-obj-y), $^), \
- $(cmd_make_empty_builtin) $@)
+quiet_cmd_ar_builtin = AR $@
+ cmd_ar_builtin = rm -f $@; \
+ $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(filter $(real-obj-y), $^)
$(builtin-target): $(real-obj-y) FORCE
- $(call if_changed,link_o_target)
+ $(call if_changed,ar_builtin)
targets += $(builtin-target)
endif # builtin-target
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/7] kbuild: clean up multi-used module link rule
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
` (4 preceding siblings ...)
2018-03-19 11:26 ` [PATCH 6/7] kbuild: clean up built-in.a archive rule Masahiro Yamada
@ 2018-03-19 11:26 ` Masahiro Yamada
5 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:26 UTC (permalink / raw)
To: linux-kbuild
Cc: Sam Ravnborg, Michal Marek, linux-kernel, Nicholas Piggin,
Masahiro Yamada
cmd_link_multi-link is used only for cmd_link_multi-m.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
scripts/Makefile.build | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e5c1aa3..77cce68 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -526,10 +526,8 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
$($(subst $(obj)/,,$(@:.o=-y))) \
$($(subst $(obj)/,,$(@:.o=-m)))), $^)
-cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
-
quiet_cmd_link_multi-m = LD [M] $@
-cmd_link_multi-m = $(cmd_link_multi-link)
+cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
$(multi-used-m): FORCE
$(call if_changed,link_multi-m)
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling
2018-03-19 11:26 ` [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling Masahiro Yamada
@ 2018-03-19 11:32 ` Masahiro Yamada
0 siblings, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2018-03-19 11:32 UTC (permalink / raw)
To: Linux Kbuild mailing list
Cc: Sam Ravnborg, Michal Marek, Linux Kernel Mailing List,
Nicholas Piggin, Masahiro Yamada
2018-03-19 20:26 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> Now, Kbuild nicely handles composite objects to avoid multiple
> definition.
>
> Makefiles can simply add the same objects multiple times across
> composite objects.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> The is clean-up from build system point of view.
>
> I will apply this for the Kbuild tree.
>
>
> lib/zstd/Makefile | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/lib/zstd/Makefile b/lib/zstd/Makefile
> index dd0a359..a1a64cf 100644
> --- a/lib/zstd/Makefile
> +++ b/lib/zstd/Makefile
> @@ -4,15 +4,7 @@ obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
> ccflags-y += -O3
>
> # Object files unique to zstd_compress and zstd_decompress
This comment line should be removed as well.
> -zstd_compress-y := fse_compress.o huf_compress.o compress.o
> -zstd_decompress-y := huf_decompress.o decompress.o
> -
> -# These object files are shared between the modules.
> -# Always add them to zstd_compress.
> -# Unless both zstd_compress and zstd_decompress are built in
> -# then also add them to zstd_decompress.
> -zstd_compress-y += entropy_common.o fse_decompress.o zstd_common.o
> -
> -ifneq ($(CONFIG_ZSTD_COMPRESS)$(CONFIG_ZSTD_DECOMPRESS),yy)
> - zstd_decompress-y += entropy_common.o fse_decompress.o zstd_common.o
> -endif
> +zstd_compress-y := fse_compress.o huf_compress.o compress.o \
> + entropy_common.o fse_decompress.o zstd_common.o
> +zstd_decompress-y := huf_decompress.o decompress.o \
> + entropy_common.o fse_decompress.o zstd_common.o
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-03-19 11:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 11:26 [PATCH 1/7] kbuild: rename real-objs-y/m to real-obj-y/m Masahiro Yamada
2018-03-19 11:26 ` [PATCH 2/7] kbuild: link $(real-obj-y) instead of $(obj-y) into built-in.a Masahiro Yamada
2018-03-19 11:26 ` [PATCH 3/7] lib: zstd: clean up Makefile for simpler composite object handling Masahiro Yamada
2018-03-19 11:32 ` Masahiro Yamada
2018-03-19 11:26 ` [PATCH 4/7] net: liquidio: " Masahiro Yamada
2018-03-19 11:26 ` [PATCH 5/7] kbuild: remove partial section mismatch detection for built-in.a Masahiro Yamada
2018-03-19 11:26 ` [PATCH 6/7] kbuild: clean up built-in.a archive rule Masahiro Yamada
2018-03-19 11:26 ` [PATCH 7/7] kbuild: clean up multi-used module link rule Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).