* Paolo Bonzini <[email protected]> wrote:
> On 05/24/2011 10:50 AM, Ingo Molnar wrote:
> > - C constructors have random limitations like apparently not being
> > executed if
> > the constructor is linked into a .a static library.
>
> Ah, forgot about this. Given _why_ this happens (for static libraries, the
> linker omits object modules that are not required to fulfill undefined
> references in previous objects), I'd be surprised if explicit section tricks
> do not have the same limitation. [...]
Since we create an actual array (data) and iterate it the worst i can imagine
is the linker dropping those sections - in which case the build will fail and
we are alerted to the problem.
With ((constructor)) the program will misbehave silently - not good.
> [...] After all the constructor attribute is only syntactic sugar for section
> tricks.
Yeah but not just syntactic sugar but also code built into glibc to execute
them at some point before main().
And this last bit really matters as well.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html