Change in osmo-pcu[master]: bts.cpp: Increase constructor priority

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 1 18:32:31 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/20389 )

Change subject: bts.cpp: Increase constructor priority
......................................................................

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
---
M src/bts.cpp
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/bts.cpp b/src/bts.cpp
index 5cd2b1d..da62b30 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -59,7 +59,7 @@
 	/* 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");

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/20389
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I65de69a32ac929e6ddd4e58980027f9e76813153
Gerrit-Change-Number: 20389
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201001/17d015e8/attachment.htm>


More information about the gerrit-log mailing list