From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA15039 for caml-red; Sun, 3 Dec 2000 23:08:27 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA25214 for ; Thu, 30 Nov 2000 23:01:41 +0100 (MET) Received: from moutvdom01.kundenserver.de (moutvdom01.kundenserver.de [195.20.224.200]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eAUM1df25681; Thu, 30 Nov 2000 23:01:39 +0100 (MET) Received: from [195.20.224.209] (helo=mrvdom02.schlund.de) by moutvdom01.kundenserver.de with esmtp (Exim 2.12 #2) id 141bln-0004t6-00; Thu, 30 Nov 2000 23:01:35 +0100 Received: from drms-3e364b05.pool.mediaways.net ([62.54.75.5] helo=ice.gerd-stolpmann.de) by mrvdom02.schlund.de with esmtp (Exim 2.12 #2) id 141blg-0000yy-00; Thu, 30 Nov 2000 23:01:28 +0100 Received: from localhost (localhost [[UNIX: localhost]]) by ice.gerd-stolpmann.de (8.9.3/8.9.3) id WAA08113; Thu, 30 Nov 2000 22:25:53 +0100 From: Gerd Stolpmann Reply-To: gerd@gerd-stolpmann.de Organization: privat To: John Max Skaller , fabrice.le_fessant@inria.fr Subject: Re: Dynamic loading. Again. Date: Thu, 30 Nov 2000 21:55:31 +0100 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain Cc: Vitaly Lugovsky , caml-list@inria.fr References: <14885.12770.825697.215308@cremant.inria.fr> <3A25FB93.AD27098B@ozemail.com.au> In-Reply-To: <3A25FB93.AD27098B@ozemail.com.au> MIME-Version: 1.0 Message-Id: <00113022255301.00625@ice> Content-Transfer-Encoding: 8bit Sender: weis@pauillac.inria.fr On Thu, 30 Nov 2000, John Max Skaller wrote: >Fabrice Le Fessant wrote: >> >> Last year, Mark Hayden and I did some work on dynamic linking of >> native code for Linux. It worked, with few modifications in the >> compiler to generate relocatable code in the ELF format, but the code >> was really big (something like twice the normal size) and really slow >> (about twice slower). > > Do you know why it was slower?? > > Normally, static and load time linkage produce identical code, >and the code doesn't have to be position independent: any code can >be shared, and have distinct per process data at the same virtual >address. Absolute addresses are relocated by patching once at load time. As far as I know, ELF executables do not patch the code directly because this would have the disadvantage that the text segments could not be shared by several processes (it is unlikely that two processes load the same library at the same start address). There are several sections at the beginning of the library containing the addresses of the resolved symbols; only these sections are patched. As far as I remember one of these special sections contains small stubs implementing jumps and calls to other libraries, and another section is a table of addresses of foreign variables. The text segment must be position-independent. >What's usually required is segmentation (splitting the code into >executable >and data segments). > >{I think all this stinks, and is a result of using a stupid language >like C >for systems programming .. but that's another story] It's assembly language. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ----------------------------------------------------------------------------