tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel constructor



On Mon, Nov 10, 2014 at 5:25 PM, Martin Husemann <martin%duskware.de@localhost> wrote:
> On Sun, Nov 09, 2014 at 05:46:21PM -0800, Matt Thomas wrote:
>> No more link sets please.
>
> I agree.

I agreed one week ago.  But now I have MI linker script that merges
"link_set_*" into .rodata, I can live with link-set. :)

>> Can't we use __attributes__((__constructor__))
>> and __attributes__((destructor));
>
> How about splitting the $subsystem_init() function from the function
> marked as __constructor__: let the constructor function register the
> $subsystem_init() function as a callback passing either a simple
> integral priority or (even better, but not sure if this is
> overengeneering) some representation of the dependencies - then
> (topological) sort all registered callbacks and call them one after the
> other.

__attribute__((constructor(n))), where n being priority, can do
ordering (hint from pooka@).

Question is, how to provide __CTOR_LIST__, __CTOR_LIST_END__ equivalent symbols.

(It is super easy if MI linker script is there. :)


Home | Main Index | Thread Index | Old Index