bts.cpp: Increase constructor priority

It seems that some gcc versions do not consider the priority of
"C" __attribute__((constructor)) definitions in the same order as
they do C++ static initializers, which are called in the order in which
they appear in the compile unit (source file).

The problem has been observed at least in a
environment based on T2 SDE with GCC 6.3.0 and binutils 2.28.

Let's work around this by making sure the __attribute__((constructor))
function always gets the highest priority value permitted by gcc (101).

Closes: SYS#5093
Change-Id: I65de69a32ac929e6ddd4e58980027f9e76813153
This commit is contained in:
Harald Welte 2020-09-30 19:57:02 +02:00
parent 84abd2f65e
commit 0a369e560c
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ extern "C" {
/* e must make sure to initialize logging before the BTS static
* constructors are executed below, as those call libosmocore APIs that
* require logging already to be initialized. */
__attribute__((constructor)) static void early_init(void)
__attribute__((constructor (101))) static void early_init(void)
{
if (!tall_pcu_ctx) {
tall_pcu_ctx = talloc_named_const(NULL, 1, "Osmo-PCU context");