[ltt-dev] UST __trace_mark_tp_counter

Mathieu Desnoyers compudj at krystal.dyndns.org
Tue Oct 12 10:50:19 EDT 2010

* 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.


> /Nils

Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.

More information about the lttng-dev mailing list