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

Sébastien Lorquet squalyl at
Mon Jun 28 14:19:01 UTC 2010


If I understand correctly, this is the same type of idea of the linux
kernel's __init magic, except that no code cleanup is done?


On Fri, Jun 25, 2010 at 3:28 AM, Harald Welte <laforge at> wrote:

> Hi!
> As indicated in other mails, we now have support for gcc-style constructors
> in OsmocomBB.  The way to use them is relatively easy:  Simply put
> "__attribute__((constructor))" at the function that you want to be
> called during initialization.
> The way how this works is like this:
> * gcc and the linker create a table of function pointers to all the
>  functions with that attribute
> * the code in compal_ramload_start.S takes care of calling
>  lib/ctors.s:do_global_ctors() which iterates over the list
>  and calls each constructor
> This concept is now used for things like prim_fbsb_init() in layer1,
> but I have also started to use it for board_init().  This means that
> board_init() no longer needs to be called from the main() function
> of each app.
> We can probably put more stuff into constructors, but we should also
> be careful as with gcc-4.0.2 we cannot yet indicate priorities and thus
> there is no explicit way to control the ordering in case of dependencies.
> Regards,
>        Harald
> --
> - Harald Welte <laforge at>
> ============================================================================
> "Privacy in residential applications is a desirable marketing option."
>                                                  (ETSI EN 300 175-7 Ch. A6)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the baseband-devel mailing list