From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjQUO-0008C3-Pe for qemu-devel@nongnu.org; Fri, 04 Sep 2009 00:33:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjQUJ-0008A9-6S for qemu-devel@nongnu.org; Fri, 04 Sep 2009 00:33:31 -0400 Received: from [199.232.76.173] (port=59266 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjQUJ-0008A6-0F for qemu-devel@nongnu.org; Fri, 04 Sep 2009 00:33:27 -0400 Received: from mail-yx0-f176.google.com ([209.85.210.176]:59619) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjQUI-0002nO-O9 for qemu-devel@nongnu.org; Fri, 04 Sep 2009 00:33:26 -0400 Received: by yxe6 with SMTP id 6so262582yxe.22 for ; Thu, 03 Sep 2009 21:33:25 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20090903171732.GA19183@1und1.de> References: <87ljkxibay.fsf@lechat.rtp-net.org> <20090903120010.GA27116@1und1.de> <200909031538.19806.paul@codesourcery.com> <20090903171732.GA19183@1und1.de> Date: Fri, 4 Sep 2009 07:33:25 +0300 Message-ID: Subject: Re: [Qemu-devel] [PATCH v2] Build *-user targets as PIE From: "Kirill A. Shutemov" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Kirill A. Shutemov" , qemu-devel@nongnu.org On Thu, Sep 3, 2009 at 8:17 PM, Reimar D=C3=B6ffinger wrote: > On Thu, Sep 03, 2009 at 06:07:21PM +0300, Kirill A. Shutemov wrote: >> On Thu, Sep 3, 2009 at 5:38 PM, Paul Brook wrote: >> >> PIE code usually is a bit slower. Approximately, 1% for i386 accordin= g to >> >> some tests. RISC architectures should be affected less, since they ha= ve >> >> more registers. On other hand we are getting rid from text relocation= s on >> >> i386 which make executable loading slower. So... >> > >> > I think you've got that backwards. >> > A traditional (fixed address) executable requires no load-time relocat= ion for >> > internal references because all addresses are known at static link tim= e. PIE >> > require the dynamic linker adjust all absolute addresses. >> >> Usermode qemu on i386 is not a traditional executable, sicne it uses >> -Wl,-shared for linking. In result we've got an executable which looks >> like PIE, but dynamic linker have to resolve text relocations. I think >> the best way it to create a true PIE without a text relocations. > > It is close to getting of topic, but since you state it, why try so hard > to avoid text relocations? > Sure, there are advantages (the biggest one is less issues with > mis-/insufficiently configured selinux I think), possibly better sharing > of pages when many instances are run and better delayed loading, but on > x86/i386 that doesn't sound like a clear advantage compared to the in > some cases quite relevant speed loss. Do you have any numbers about speed loss? > Also, since this patch adds --disable-pie, isn't the hack currently used > still necessary for that case? > Or is --disable-pie supposed to disable self-hosting? Then maybe the > option should be named --disable-self-hosting (and if that is indeed the > only side-effect it might be better to disable it by default)? >