From e2a99ad3e174ab4c9d2320dcecd779230409829f Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 25 Aug 2011 09:18:52 +0100 Subject: [PATCH] build: sort objects to remove duplicates for link Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure. Use GNU make's $(sort) function to remove duplicate object files from the link command-line. Signed-off-by: Stefan Hajnoczi Signed-off-by: Anthony Liguori --- rules.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules.mak b/rules.mak index 884d421..04a9198 100644 --- a/rules.mak +++ b/rules.mak @@ -31,7 +31,7 @@ endif %.o: %.m $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") -LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS)," LINK $(TARGET_DIR)$@") +LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@") %$(EXESUF): %.o $(call LINK,$^) -- 2.7.4