Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Fabrice Le Fessant <fabrice.le_fessant@i...>
Subject: Re: Dynamic loading. Again.

>  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.
>  What's usually required is segmentation (splitting the code into
>  executable
>  and data segments).

Well, you are right. You don't need to generate position independent
code, but it is better if you want the code to be shared between
processes. Otherwise, each process has its own code, and a shared
library is not that shared ... 

The problem with generating position independent code is that you need
one register for the GOT pointer. One the i386 arch, this is a big
penalty. Moreover, all function calls are indirect (we did not
optimize for the case of "static" functions), and the GOT must be
saved and re-computed -- if used -- at every function entry point,
since it is different for each module. 

I think some optimizations should probably improve this a lot !

- Fabrice

Homepage: http://pauillac.inria.fr/~lefessan