English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Dynamic loading. Again.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-12-03 (22:08)
From: Gerd Stolpmann <gerd@g...>
Subject: Re: Dynamic loading. Again.
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

>What's usually required is segmentation (splitting the code into
>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 Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de