From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH 5/5 V2] kvm tools: Initialize and use VESA and VNC Date: Wed, 25 May 2011 14:53:35 +0200 Message-ID: <20110525125335.GD29300@elte.hu> References: <20110524085024.GA31453@elte.hu> <4DDB77E5.4080306@redhat.com> <20110524194019.GA27634@elte.hu> <4DDCBC08.3030507@redhat.com> <20110525083200.GF21552@elte.hu> <4DDCC8A0.8050708@redhat.com> <20110525093611.GD28500@elte.hu> <4DDCD364.9090903@redhat.com> <20110525101744.GA30983@elte.hu> <4DDCDD84.8010800@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sasha Levin , penberg@kernel.org, john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Paolo Bonzini Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:39950 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337Ab1EYMxm (ORCPT ); Wed, 25 May 2011 08:53:42 -0400 Content-Disposition: inline In-Reply-To: <4DDCDD84.8010800@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: * Paolo Bonzini wrote: > On 05/25/2011 12:17 PM, Ingo Molnar wrote: > > > Also it's not clear why ((constructor)) was written in the way it > > was: why apparently no access is given to the array of init > > functions > > It is accessible---glibc uses it. > > > and why it's not possible to turn the auto-execution off but > > still have the array generated, for legitimate cases that want to > > use data driven constructor execution. > > The compiler doesn't care about what is done with the data. It > simply provides the table for the runtime library to use it. > ((constructor)) is a veneer over the same infrastructure used for > C++ global constructors; that explains its design pretty well. Obviously the compiler did not provide this feature into a vacuum, it expected the C library to execute constructors, right? So the above dodges my question of why there is no method (in glibc) to turn auto-execution off and let the app do it. If all that was possible then ((constructor)) could certainly be used as a generalized shortcut for certain ((section)) uses. > > the ((section)) approach we could create a clear runtime BUG_ON() > > assert for a zero-sized array of init function pointers, > > Not really. The problem is that f1.o is not pulled from the static > library _because the linker thinks it is not necessary_. If f1.o > defines another symbol, and f.o uses it, then the constructor is > pulled in together with the rest of f.o. As soon as _one_ > constructor is pulled in (even from outside the static library), > your BUG() would not detect silently missing imports anymore. Yeah, good point. Thanks, Ingo