On Sun, 12 Jul 2020, Mathieu Desnoyers <mathieu.desnoy...@efficios.com> wrote: > ----- On Jul 11, 2020, at 11:29 AM, lttng-dev lttng-dev@lists.lttng.org wrote: > >> Some library might want to generate events in their ctor/dtor. If >> LTTng initialize/finalize its tracepoints/events at the wrong time, >> events are lost. >> >> Order of execution of the ctor/dtor is determined by priority. When >> some priorities are equal, the order of execution seems to be >> determined by: >> >> a) Order of appearance if in the same compilation unit >> >> b) Order of link if in different compilation units >> >> c) Order of load by ld-linux.so or dlopen(3) for >> share objects > > I recall different rules about constructor priorities. Can you provide > links to documentation stating the priority order you describe above ?
I haven't found any documentation on that. This is purely empirical. Although I'm sure that we can dig something if chatting on GCC's IRC. > Also, we should compare two approaches to fulfill your goal: > one alternative would be to have application/library constructors > explicitly call tracepoint constructors if they wish to use them. I would prefer this way. The former solution might not work in some cases (e.g. with LD_PRELOAD and priority =101) and I prefer explicit initialization in that case. I don't see any cons for the second approach, except making the symbols table a few bytes larger. I'll post a patch soon so we can compare and try to find more documentation on ctor priority. -- Olivier Dion PolyMtl _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev