From patchwork Thu Jan 24 15:50:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 215380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7E5C22C0976 for ; Fri, 25 Jan 2013 02:51:05 +1100 (EST) Received: from localhost ([::1]:35712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyP4x-0001ey-Ns for incoming@patchwork.ozlabs.org; Thu, 24 Jan 2013 10:51:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyP4j-0001Dh-5Z for qemu-devel@nongnu.org; Thu, 24 Jan 2013 10:50:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyP4b-0001FS-Ft for qemu-devel@nongnu.org; Thu, 24 Jan 2013 10:50:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyP4b-0001FC-7g for qemu-devel@nongnu.org; Thu, 24 Jan 2013 10:50:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0OFoeG9018876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Jan 2013 10:50:40 -0500 Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0OFoclk025886; Thu, 24 Jan 2013 10:50:39 -0500 From: Stefan Hajnoczi To: Date: Thu, 24 Jan 2013 16:50:32 +0100 Message-Id: <1359042632-1773-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] build: reinstate generated-tracers-dtrace.o 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 Generated trace event code is written to trace/generated-tracers.c. The 'dtrace' backend does not generate C code, instead the dtrace(1) utility takes a .dtrace file as input and produces a .o file as output. Therefore, with 'dtrace' we have: generated-tracers.o <- generated-tracers.dtrace Without 'dtrace' we have: generated-tracers.o <- generated-tracers.c When QEMU is built with ./configure --enable-trace-backend=simple followed by ./configure --enable-trace-backend=dtrace, the generated-tracers.c file remains although the 'dtrace' backend does not use it. Because the %.o: %.c target is defined before the %.o: %.dtrace target in rules.mak, we'll actually pull in the stale .c file instead of using the .dtrace file! The resulting build is a mix of 'dtrace' and 'simple' trace backends - and it fails loudly. Commit 0e848f482bce75f4d9cbac9f495fa45e51d08c9a (build: some simplifications for "trace/Makefile.objs") changed trace/Makefile.objs so that 'dtrace' and non-'dtrace' builds use generated-tracers.o. Previously we used generated-tracers-dtrace.o for 'dtrace' builds only and generated-tracers.o for non-'dtrace' builds only. This patch is somewhat ugly. It undoes the change from 0e848f482bce75f4d9cbac9f495fa45e51d08c9a so that the 'dtrace' and non-'dtrace' builds do not conflict with each other. The result is that 'dtrace' builds no longer fail if stale generated-tracers.c files are present. Signed-off-by: Stefan Hajnoczi --- Can someone think of a better way to fix this? Perhaps we've really outgrown in-tree builds and need to switch to a ./build/ directory that can be blown away each time ./configure runs (fingers crossed you have ccache installed or the build may take some time). rules.mak | 2 +- trace/Makefile.objs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rules.mak b/rules.mak index 6d82c0d..d8b0672 100644 --- a/rules.mak +++ b/rules.mak @@ -29,7 +29,7 @@ else LIBTOOL += $(if $(V),,--quiet) %.lo: %.c $(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," lt CC $@") -%.lo: %.dtrace +%-dtrace.lo: %.dtrace $(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC dtrace -o $@ -G -s $<, " lt GEN $(TARGET_DIR)$@") LINK = $(call quiet-command,\ diff --git a/trace/Makefile.objs b/trace/Makefile.objs index 27fe26b..97e280d 100644 --- a/trace/Makefile.objs +++ b/trace/Makefile.objs @@ -24,6 +24,7 @@ $(obj)/generated-tracers.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/conf @cmp -s $@ $(patsubst %-timestamp,%,$@) || cp $@ $(patsubst %-timestamp,%,$@) $(obj)/generated-tracers.o: $(obj)/generated-tracers.c $(obj)/generated-tracers.h +util-obj-y += generated-tracers.o endif @@ -45,7 +46,8 @@ $(obj)/generated-tracers.dtrace-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR) $(obj)/generated-tracers-dtrace.h: $(obj)/generated-tracers.dtrace $(call quiet-command,dtrace -o $@ -h -s $<, " GEN $@") -$(obj)/generated-tracers.o: $(obj)/generated-tracers.dtrace +$(obj)/generated-tracers-dtrace.o: $(obj)/generated-tracers.dtrace +util-obj-y += generated-tracers-dtrace.o endif ###################################################################### @@ -55,4 +57,3 @@ util-obj-$(CONFIG_TRACE_DEFAULT) += default.o util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o util-obj-$(CONFIG_TRACE_STDERR) += stderr.o util-obj-y += control.o -util-obj-y += generated-tracers.o