All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel]  [PATCH] Put all trace.o into libqemuutil.a
@ 2017-04-04 21:39 Xu, Anthony
  2017-04-05  8:15 ` Lluís Vilanova
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xu, Anthony @ 2017-04-04 21:39 UTC (permalink / raw)
  To: 'qemu-devel@nongnu.org'
  Cc: 'Stefan Hajnoczi', 'Daniel Berrange',
	'Paolo Bonzini'

Put all trace.o into libqemuutil.a

Currently all trace.o are linked into qemu-system, qemu-img, 
qemu-nbd, qemu-io etc., even the corresponding components 
are not included.
Put all trace.o into libqemuutil.a that the linker would only pull in .o 
files containing symbols that are actually referenced by the 
program.


Signed-off -by: Anthony Xu <anthony.xu@intel.com>



diff --git a/Makefile b/Makefile
index 6c359b2..31d41a7 100644
--- a/Makefile
+++ b/Makefile
@@ -346,7 +346,7 @@ dtc/%:
        mkdir -p $@

 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(chardev-obj-y) \
-       $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) $(trace-obj-y)
+       $(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))

 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 # Only keep -O and -g cflags
@@ -366,11 +366,11 @@ Makefile: $(version-obj-y)
 # Build libraries

 libqemustub.a: $(stub-obj-y)
-libqemuutil.a: $(util-obj-y)
+libqemuutil.a: $(util-obj-y) $(trace-obj-y)

 ######################################################################

-COMMON_LDADDS = $(trace-obj-y) libqemuutil.a libqemustub.a
+COMMON_LDADDS = libqemuutil.a libqemustub.a

 qemu-img.o: qemu-img-cmds.h

diff --git a/Makefile.target b/Makefile.target
index d5ff0c7..69239e0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -185,8 +185,7 @@ dummy := $(call unnest-vars,.., \
                qom-obj-y \
                io-obj-y \
                common-obj-y \
-               common-obj-m \
-               trace-obj-y)
+               common-obj-m)
 target-obj-y := $(target-obj-y-save)
 all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
@@ -198,7 +197,7 @@ all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)

 $(QEMU_PROG_BUILD): config-devices.mak

-COMMON_LDADDS = $(trace-obj-y) ../libqemuutil.a ../libqemustub.a
+COMMON_LDADDS = ../libqemuutil.a ../libqemustub.a

 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f3de81f..579ec07 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -519,7 +519,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests


 # Deps that are common to various different sets of tests below
-test-util-obj-y = $(trace-obj-y) libqemuutil.a libqemustub.a
+test-util-obj-y = libqemuutil.a libqemustub.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
        tests/test-qapi-event.o tests/test-qmp-introspect.o \

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a
  2017-04-04 21:39 [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a Xu, Anthony
@ 2017-04-05  8:15 ` Lluís Vilanova
  2017-04-06 13:23   ` Stefan Hajnoczi
  2017-04-05  9:14 ` Daniel P. Berrange
  2017-04-06 14:38 ` Stefan Hajnoczi
  2 siblings, 1 reply; 5+ messages in thread
From: Lluís Vilanova @ 2017-04-05  8:15 UTC (permalink / raw)
  To: Xu, Anthony
  Cc: 'qemu-devel@nongnu.org', 'Stefan Hajnoczi',
	'Paolo Bonzini'

Xu, Anthony writes:

> Put all trace.o into libqemuutil.a
> Currently all trace.o are linked into qemu-system, qemu-img, 
> qemu-nbd, qemu-io etc., even the corresponding components 
> are not included.
> Put all trace.o into libqemuutil.a that the linker would only pull in .o 
> files containing symbols that are actually referenced by the 
> program.

I think this change conflicts with some of the guest code tracing patches I have
in the queue (I won't be able to send the new series until the end of the month,
sorry).

AFAIR, some of my patches need to link different code for utils and qemu's main
binaries. Although there might be a better way of doing it that I missed.


Cheers,
  Lluis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a
  2017-04-04 21:39 [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a Xu, Anthony
  2017-04-05  8:15 ` Lluís Vilanova
@ 2017-04-05  9:14 ` Daniel P. Berrange
  2017-04-06 14:38 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrange @ 2017-04-05  9:14 UTC (permalink / raw)
  To: Xu, Anthony
  Cc: 'qemu-devel@nongnu.org', 'Stefan Hajnoczi',
	'Paolo Bonzini'

On Tue, Apr 04, 2017 at 09:39:39PM +0000, Xu, Anthony wrote:
> Put all trace.o into libqemuutil.a
> 
> Currently all trace.o are linked into qemu-system, qemu-img, 
> qemu-nbd, qemu-io etc., even the corresponding components 
> are not included.
> Put all trace.o into libqemuutil.a that the linker would only pull in .o 
> files containing symbols that are actually referenced by the 
> program.
> 
> 
> Signed-off -by: Anthony Xu <anthony.xu@intel.com>

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a
  2017-04-05  8:15 ` Lluís Vilanova
@ 2017-04-06 13:23   ` Stefan Hajnoczi
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-06 13:23 UTC (permalink / raw)
  To: Xu, Anthony, 'qemu-devel@nongnu.org', 'Paolo Bonzini'

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

On Wed, Apr 05, 2017 at 11:15:58AM +0300, Lluís Vilanova wrote:
> Xu, Anthony writes:
> 
> > Put all trace.o into libqemuutil.a
> > Currently all trace.o are linked into qemu-system, qemu-img, 
> > qemu-nbd, qemu-io etc., even the corresponding components 
> > are not included.
> > Put all trace.o into libqemuutil.a that the linker would only pull in .o 
> > files containing symbols that are actually referenced by the 
> > program.
> 
> I think this change conflicts with some of the guest code tracing patches I have
> in the queue (I won't be able to send the new series until the end of the month,
> sorry).
> 
> AFAIR, some of my patches need to link different code for utils and qemu's main
> binaries. Although there might be a better way of doing it that I missed.

I don't know the details of your unsent patches, but one possible
solution is stubs/* where we stub out functions that are unavailable in
tools.  That way the same code links in the main QEMU program and in
utils.

When the code runs in utils, it either doesn't take the code path that
reaches the stub function or it calls the stub and continues unaware
that the call was a noop.

If you want to discuss further, feel free to post an RFC preview series
of your work in progress.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a
  2017-04-04 21:39 [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a Xu, Anthony
  2017-04-05  8:15 ` Lluís Vilanova
  2017-04-05  9:14 ` Daniel P. Berrange
@ 2017-04-06 14:38 ` Stefan Hajnoczi
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-06 14:38 UTC (permalink / raw)
  To: Xu, Anthony
  Cc: 'qemu-devel@nongnu.org', 'Daniel Berrange',
	'Paolo Bonzini'

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]

On Tue, Apr 04, 2017 at 09:39:39PM +0000, Xu, Anthony wrote:

Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next

I fixed up the patch when applying it.  Comments below:

> Put all trace.o into libqemuutil.a

Please use the "trace: " prefix for tracing patches.

All components of QEMU have commonly used prefixes that make it easy to
identify which area a patch affects.  People reading the mailing list or
grepping through git logs rely on this.

> 
> Currently all trace.o are linked into qemu-system, qemu-img, 
> qemu-nbd, qemu-io etc., even the corresponding components 
> are not included.
> Put all trace.o into libqemuutil.a that the linker would only pull in .o 
> files containing symbols that are actually referenced by the 
> program.
> 
> 
> Signed-off -by: Anthony Xu <anthony.xu@intel.com>

Please use git-format-patch(1) to send correctly formatted patches in
the future.  git-am(1) was unable to apply your email and I had to do it
manually.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-06 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 21:39 [Qemu-devel] [PATCH] Put all trace.o into libqemuutil.a Xu, Anthony
2017-04-05  8:15 ` Lluís Vilanova
2017-04-06 13:23   ` Stefan Hajnoczi
2017-04-05  9:14 ` Daniel P. Berrange
2017-04-06 14:38 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.