Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 21 May 2020 22:22:53 +0200
From: Harald Welte <>
Subject: MUSL ignores__attribute__((constructor(priority))) ?

Hi all!

While investigating some really strange behavior of osmocom software
on MUSL based systems (see
there are two observations:

1) if there are multiple libraries (in this example libosmocore and libtalloc,
   where libosmocore depends on libtalloc), the __attribute__((constructor))
   functions are not called in inverse dependency order, i.e. the talloc
   ones are *not* called before those of libosmocore.

2) even when adding an explicit "priority" field like
   static __attribute__((constructor(65535))) void on_dso_load_ctx(void)
   the MUSL doesnt' seem to respect this, i.e. it still calls the
   constructor with the high priority value *before* the constructor of lower
   priority.  This is not as specified in

I don't know whether '1' is a bug (i.e. whether it is valid to assume constructors
of libraries are executed in-line with library dependencies).   However, I am
quite convinced '2' is a bug.


p.s.: Please keep me in Cc, I'm not a subscriber to this list.

- Harald Welte <> 
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.