From patchwork Thu Aug 25 08:18:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 111500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D4956B6F64 for ; Thu, 25 Aug 2011 18:19:11 +1000 (EST) Received: from localhost ([::1]:59756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV9Y-0007FA-2a for incoming@patchwork.ozlabs.org; Thu, 25 Aug 2011 04:19:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV9S-0007Eu-OQ for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:19:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwV9R-0006Zl-QU for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:19:02 -0400 Received: from mtagate7.uk.ibm.com ([194.196.100.167]:42854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV9R-0006Zb-J1 for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:19:01 -0400 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p7P8Ixlb006573 for ; Thu, 25 Aug 2011 08:18:59 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7P8Iwph2224338 for ; Thu, 25 Aug 2011 09:18:58 +0100 Received: from d06av07.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7P8Iv1r014693 for ; Thu, 25 Aug 2011 02:18:58 -0600 Received: from stefanha-thinkpad.manchester-maybrook.uk.ibm.com (dyn-9-174-219-30.manchester-maybrook.uk.ibm.com [9.174.219.30]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7P8Ivlc014677; Thu, 25 Aug 2011 02:18:57 -0600 From: Stefan Hajnoczi To: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= Date: Thu, 25 Aug 2011 09:18:52 +0100 Message-Id: <1314260332-10534-1-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <20110824195317.14304.63305.stgit@ginnungagap.bsc.es> References: <20110824195317.14304.63305.stgit@ginnungagap.bsc.es> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.167 Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] build: sort objects to remove duplicates for link X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- Your patch seems fine but we need to avoid duplicate object files during the link phase. Otherwise we run into linker warnings because qemu-timer-common.o is linked multiple times. Please include this patch and resend the two together with this patch as 1/2 and yours as 2/2. rules.mak | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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,$^)