Re: [PATCH 5/5 V2] kvm tools: Initialize and use VESA and VNC

Ingo Molnar
2011-05-24T19:40:33Z

* Paolo Bonzini <pbonzini@redhat.com> 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