On 27/03/2017 20:21, Xu, Anthony wrote: >>> ./trace.o, ./qapi/trace.o and ./util/trace.o are added into >>> libqemuutil.a to avoid recursive dependencies between >>> libqemuutil.a and libqemutrace.a. >> Why would libqemutrace.a depend on libqemuutil.a? > Each trace.c calls trace_event_register_group to register events, > trace_event_register_group is defined in trace/control.c , which > is linked into libqemuutil.a.
Ah: util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o util-obj-y += control.o util-obj-y += qmp.o With the introduction of libqemutrace.a, I believe these should be moved into libqemutrace.a. Paolo > >> Tracing code shouldn't call other QEMU code. That would could create >> infinite recursion when a trace event is fired. > If all trace.o needed by libqemuutil.a are linked into libqemuutil.a, > libqemuutil.a will not depend on libqemutrace.a. This is what this patch > take to break the infinite recursion. > > Or we can link trace/*.o to libqemutrace.a, hope it breaks the infinite > recursion. But trace/*.o may still depend on libqemuutil.a > > Or we can just link all trace.o to libqemuutil.a.