Received: from eggs.gnu.org ([208.118.235.92]:47967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAlNp-0002cI-MU for qemu-devel@nongnu.org; Thu, 22 Mar 2012 13:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAlNj-0001MY-8q for qemu-devel@nongnu.org; Thu, 22 Mar 2012 13:01:05 -0400 Received: from 204.146.238.178.in-addr.arpa ([178.238.146.204]:60382 helo=mail.local) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAlNi-0001LU-UT for qemu-devel@nongnu.org; Thu, 22 Mar 2012 13:00:59 -0400 Message-ID: <4F6B5AC5.9020504@nowonline.co.uk> Date: Thu, 22 Mar 2012 17:00:53 +0000 From: Lee Essen MIME-Version: 1.0 References: <4F69B137.3070709@nowonline.co.uk> <4F69D142.7020307@suse.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Thoughts around dtrace linking... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: =?ISO-8859-1?Q?Andreas_F=E4rber?= , Stefan Hajnoczi , qemu-devel@nongnu.org On 22/03/2012 16:28, Stefan Hajnoczi wrote: > On Wed, Mar 21, 2012 at 1:01 PM, Andreas F=E4rber wr= ote: >> Hi, >> >> Am 21.03.2012 11:45, schrieb Lee Essen: >>> I've been trying to find a sensible way to solve the Solaris/Illumos >>> dtrace requirement to pass all the objs to the dtrace command so that >>> the resultant object file contains all the symbols needed to properly >>> link the relevant binary. >>> >>> The easiest way to do this is just prior to linking the binary, so >>> something like this (in rules.mak): >>> >>> LINK =3D $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) >>> $(LDFLAGS) -o $@ $(sort $(1)) $(LIBS)," LINK $(TARGET_DIR)$@") >>> >>> DTRACE =3D $(call quiet-command,dtrace $(CONFIG_DTRACE_FLAGS) -o >>> $(1)-dtrace.o -G -s $(2) $(3), " GEN $(TARGET_DIR)$(1)-dtrace.o= ") >>> >>> %$(EXESUF): %.o >>> $(call DTRACE,$*,trace-dtrace.dtrace,$^) >>> $(call LINK,$^ $*-dtrace.o) > > What I find slightly surprising is that you're putting the -dtrace.o > generation step as a command in the executable's target. > > I would expect the -dtrace.o to be a target itself, which also allows > make to use it's timestamping on dependencies to ensure we only > rebuild when necessary. i.e. specifying dependencies is the make way > of doing things, and I think we should try where possible. Yes, that's the way I had it the first time around, but it means quite a=20 bit more complexity in the makefiles and having to touch each executable=20 section, I had thought the rules.mak approach was cleaner. For example: qemu-ga-all-objs=3Dqemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y)=20 $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ) #ifdef USE_SOLARIS_DTRACE_APPROACH qemu-ga.dtrace.o: $(qemu-ga-all-objs) [assuming rule in rules.mak] qemu-ga-all-objs+=3Dqemu-ga.dtrace.o #endif qemu-ga$(EXESUF): qemu-ga-all-objs There's also a complication with the creation of the .dtrace.o in=20 Makefile.target because of it being one level down in the directory=20 structure and needing access to trace-dtrace.dtrace. None of it is unsurmountable, but it gets a bit untidy. TBH, I can do this either way, just let me know which approach you=20 prefer and I'll put a patch together. >>> >>> Obviously with the relevant tests around it to check the trace backen= d, >>> and also an adjustment in Makefile.target to cause the right thing to >>> happen for each target. >>> Or, is there a better way? >> >> The two issues I see (as info for Stefan et al.) are >> a) compiling DTrace probes into .o files requires linking those object= s >> with that additional .o file to avoid linker errors (even for tools >> where using DTrace probes does not seem to make much sense), > > qemu-tool binaries are built with tracing enabled. But this is a good > point, we need to check that all binaries buildable from the QEMU > source tree continue to work with this change. > Actually this is a good point ... if you are thinking of removing=20 tracing from some of the binaries then the rules.mak approach doesn't=20 really make sense. Let me know how you want to proceed. Cheers, Lee.