Use existing command line of objcopy and ld instead of writing new one and simply edit the flags.
`targets' is to let know kbuild that other files beside the one declared in obj-bin-y will be built. Signed-off-by: Anthony PERARD <[email protected]> --- xen/common/libelf/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile index 9a433f01fbd4..2be9ea82b241 100644 --- a/xen/common/libelf/Makefile +++ b/xen/common/libelf/Makefile @@ -4,9 +4,14 @@ nocov-y += libelf.o SECTIONS := text data $(SPECIAL_DATA_SECTIONS) ccflags-y += -Wno-pointer-sign +ldflags-y += -r +OBJCOPYFLAGS += $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) -libelf.o: libelf-temp.o Makefile - $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@ +libelf-temp-objs := libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-relocate.o +targets += $(libelf-temp-objs) libelf-temp.o -libelf-temp.o: libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-relocate.o - $(LD) $(LDFLAGS) -r -o $@ $^ +$(obj)/libelf.o: $(obj)/libelf-temp.o FORCE + $(call if_changed,objcopy) + +$(obj)/libelf-temp.o: $(addprefix $(obj)/,$(libelf-temp-objs)) FORCE + $(call if_changed,ld) -- Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
