[ltt-dev] UST __trace_mark_tp_counter

Nils Carlson nils.carlson at ericsson.com
Wed Oct 13 02:37:28 EDT 2010



On Tue, 12 Oct 2010, Mathieu Desnoyers wrote:

> * Nils Carlson (nils.carlson at ericsson.com) wrote:
>> I was doing some minor fixes in UST today when I came across a small
>> phenomenon. Since including Davids testcase for trae_mark_tp I cannot
>> compile with -Wall. The compiler throws out a
>>
>> tracepoint_test.o: In function `__check_tp_type':
>> /home/nils/devel/ust/tests/tracepoint/tracepoint_test.c:64: undefined
>> reference to `register_trace_ust_event_msg'
>> collect2: ld returned 1 exit status
>>
>>
>> Looking at the macros in include/ust/marker.h I find the function
>>
>> void __check_tp_type(void)				\
>> 		{							\
>> 			register_trace_##tp_name(tp_cb, call_private); \
>> 		}							\
>>
>> defined inside the __trace_mark_tp_counter function.
>>
>> In the case of _DEFINE_MARKER_TP we don't create the register and
>> unregister functions as far as I can tell. And the error only occurs when
>> compiling with -Wall which I'm guessing is because __check_tp_type is
>> never called and is optimised out completely normally? If I create a void
>> pointer and assign the function address to it I get the error when
>> compiling without -Wall as well.
>>
>> Mathieu: What do you think of this, does it seem reasonable? How do you
>> think we should fix it? Simplest would be to remove the check, I don't
>> know if the register and unregister functions will be used for anything?
>
> Before we discuss this further, please check that the compiling
> scenarios differ because of having -O0 and -O2.. with O2, the compiler
> will remove dead code, which kills the problem. I think your -Wall test
> only removes -O2.


Just to answer this one, before proceeding with David's, I can confirm 
that I end up with -O0 and that everything compiles fine with 
CFLAGS="-Wall -O2". So yes, this kills the problem.

/Nils

> Mathieu
>
>>
>> /Nils
>>
>
> -- 
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com
>




More information about the lttng-dev mailing list