Message ID | 4712D8F4B26E034E80552F30A67BE0B1A2D69E@ORSMSX112.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 22/03/2017 03:03, Xu, Anthony wrote: > When building target x86_64-softmmu, all other architectures' trace.o are linked into > x86_64-softmmu/qemu-system-x86_64, like hw/arm/trace.o, hw/mips/trace.o etc., > that is not necessary. > Same thing happens when building other targets. > > Only current target arch traces should be linked into qemu-system. > > Signed-off -by: Anthony Xu <anthony.xu@intel.com> It's a bit cleaner, but does the benefit outweight the maintenance cost of the additional code added to the Makefiles? Paolo
On Wed, Mar 22, 2017 at 02:37:21PM +0100, Paolo Bonzini wrote: > > > On 22/03/2017 03:03, Xu, Anthony wrote: > > When building target x86_64-softmmu, all other architectures' trace.o are linked into > > x86_64-softmmu/qemu-system-x86_64, like hw/arm/trace.o, hw/mips/trace.o etc., > > that is not necessary. > > Same thing happens when building other targets. > > > > Only current target arch traces should be linked into qemu-system. > > > > Signed-off -by: Anthony Xu <anthony.xu@intel.com> > > It's a bit cleaner, but does the benefit outweight the maintenance cost > of the additional code added to the Makefiles? Perhaps all trace.o files should be put into their own .a instead of being added directly to the linker line: COMMON_LDADDS = $(trace-obj-y) libqemuutil.a libqemustub.a I think the linker would only pull in .o files containing symbols that are actually referenced by the program. It would look like this: ###################################################################### # Build libraries libqemustub.a: $(stub-obj-y) libqemuutil.a: $(util-obj-y) libqemutrace.a: $(trace-obj-y) ###################################################################### COMMON_LDADDS = libqemuutil.a libqemustub.a libqemutrace.a This eliminates the maintenance burden with Anthony's patch. Stefan
diff --git a/Makefile.target b/Makefile.target index 7df2b8c..638e044 100644 --- a/Makefile.target +++ b/Makefile.target @@ -177,6 +177,41 @@ block-obj-y := common-obj-y := chardev-obj-y := include $(SRC_PATH)/Makefile.objs + +# remove all arch related trace +trace-obj-y := $(filter-out hw/alpha/trace.o hw/alpha/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/alpha/trace.o target/alpha/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/arm/trace.o hw/arm/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/arm/trace.o target/arm/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/i386/trace.o hw/i386/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/i386/trace.o target/i386/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/mips/trace.o hw/mips/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/mips/trace.o target/mips/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/sparc/trace.o hw/sparc/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/sparc/trace.o target/sparc/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/s390x/trace.o hw/s390x/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/s390x/trace.o target/s390x/trace-dtrace.o,$(trace-obj-y)) + +trace-obj-y := $(filter-out hw/ppc/trace.o hw/ppc/trace-dtrace.o,$(trace-obj-y)) +trace-obj-y := $(filter-out target/ppc/trace.o target/ppc/trace-dtrace.o,$(trace-obj-y)) + +# add current arch related trace +carch := $(TARGET_BASE_ARCH) +ifneq ($(wildcard $(SRC_PATH)/hw/$(carch)/trace-events),) +trace-obj-y += hw/$(carch)/trace.o +trace-obj-$(CONFIG_TRACE_DTRACE) += hw/$(carch)/trace-dtrace.o +endif + +ifneq ($(wildcard $(SRC_PATH)/target/$(carch)/trace-events),) +trace-obj-y += target/$(carch)/trace.o +trace-obj-$(CONFIG_TRACE_DTRACE) += target/$(carch)/trace-dtrace.o +endif + dummy := $(call unnest-vars,,target-obj-y) target-obj-y-save := $(target-obj-y) dummy := $(call unnest-vars,.., \