Commit 28f874d6 authored by Kai Germaschewski's avatar Kai Germaschewski

Fix the kernel build when we have multi-part objects both in $(obj-y)

and $(obj-m).

Before, we would have built (though not linked) the individual objects
for multi-part modules even when building vmlinux and vice versa.
parent 085c9a18
...@@ -126,11 +126,23 @@ endif ...@@ -126,11 +126,23 @@ endif
# for make >= 3.78 the following is cleaner: # for make >= 3.78 the following is cleaner:
# multi-used := $(foreach m,$(obj-y) $(obj-m), $(if $($(basename $(m))-objs), $(m))) # multi-used := $(foreach m,$(obj-y) $(obj-m), $(if $($(basename $(m))-objs), $(m)))
multi-used := $(sort $(foreach m,$(obj-y) $(obj-m),$(patsubst %,$(m),$($(basename $(m))-objs)))) multi-used-y := $(sort $(foreach m,$(obj-y),$(patsubst %,$(m),$($(basename $(m))-objs))))
ld-multi-used := $(filter-out $(list-multi),$(multi-used)) multi-used-m := $(sort $(foreach m,$(obj-m),$(patsubst %,$(m),$($(basename $(m))-objs))))
ld-multi-objs := $(foreach m, $(ld-multi-used), $($(basename $(m))-objs)) ld-multi-used-y := $(filter-out $(list-multi),$(multi-used-y))
ld-multi-used-m := $(filter-out $(list-multi),$(multi-used-m))
ld-multi-objs-y := $(foreach m, $(ld-multi-used-y), $($(basename $(m))-objs))
ld-multi-objs-m := $(foreach m, $(ld-multi-used-m), $($(basename $(m))-objs))
$(ld-multi-used-y) : %.o: $(ld-multi-objs-y)
rm -f $@
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs), $^)
@ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(LD) $(EXTRA_LDFLAGS) $($(basename $@)-objs)),$$(strip $$(subst $$(comma),:,$$(LD) $$(EXTRA_LDFLAGS) $$($(basename $@)-objs)))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
echo 'endif' \
) > $(dir $@)/.$(notdir $@).flags
$(ld-multi-used) : %.o: $(ld-multi-objs) $(ld-multi-used-m) : %.o: $(ld-multi-objs-m)
rm -f $@ rm -f $@
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs), $^) $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs), $^)
@ ( \ @ ( \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment