[lttng-dev] static versus dynamic linking (TRACEPOINT_PROBE_DYNAMIC_LINKAGE)

Woegerer, Paul Paul_Woegerer at mentor.com
Mon Mar 4 02:57:39 EST 2013


On 03/04/2013 12:51 AM, David Bryant wrote:
> Hello,
> 
> I'm trying to decide whether to use static or dynamic tracepoint probe
> linkage. What are the factors that I should consider?

IMHO, whenever you are about to emit tracepoints from shared objects
it's desirable to have the tracepoint provider being a shared object
itself. You will likely want to share the tracepoint provider if you
have e.g. two shared objects that both emit events from the same
tracepoint provider. Also consider dlopend shared objects. When you
unload them via dlclose it would trigger the static dtors to deregister
its tracepoints (in the static tracepoint probe linkage case). If your
application then goes on and tries to emit events of that kind elsewhere
it will not work anymore.

Using dynamic tracepoint providers passes this "application wide
reference counting problem" to the dynamic linker which will not run
dtors that deregister tracepoints as long as some other part of your
application is still referring to it.

-- 
Paul Woegerer | SW Development Engineer
http://go.mentor.com/sourceryanalyzer

Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS

Android is a trademark of Google Inc. Use of this trademark is subject
to Google Permissions.
Linux is the registered trademark of Linus Torvalds in the U.S. and
other countries.



More information about the lttng-dev mailing list