From: "Greg Stein" <[EMAIL PROTECTED]> Sent: Wednesday, October 03, 2001 4:09 AM
> On Wed, Oct 03, 2001 at 09:56:40AM +0200, G�nter Knauf wrote: > > Hi Bill, > > can you please explain if every module really needs an entry in BaseAddress.ref? I >tested with many modules without an entry and it seems to work with the linker defaults... > > If it is needed how should it be done then with 3rd party modules? > > Yes, it is needed. Without it, the linker will assign the same, fixed > address to every module. At runtime, those modules will then need to be > relocated to some address. > > Using BaseAddress.ref, we can effectively do the relocation at link time. > Sure, it is possible some other code is present and a relocation is forced, > but that will be atypical. > > Relocation is expensive. Doing it at link time rather than load time is a > huge win. It's expensive in CPU at load time, but it's also expensive in memory. Each process that loads the .dll suddenly needs to keep a 'private' relocated copy of the code segment, even when all .dll's ended up at the same alt address :( > 3rd party modules can do whatever they want. Invariably, they will probably > get relocated and/or clash with other 3rd party modules. But we *do* have > control over Apache itself and can help those. Easiest is to simply assign a random address somewhere between 0x20000000 and 0x5F0000000. You are very unlikely to ever clash with another module loaded between those addresses. [Note these are segment aligned at 0x10000 boundries.] > There are further optimizations with assigning addresses that we probably > don't do. Specifically, if there are "gaps" in the address space, then you > end up wasting space in the processor's mapping tables. As a result, you > want to pack the modules as tightly as possible. > > Of course, that tight-packing is at odds with the optional loading of > modules. If we do the packing, then decide not to load something, then we > end up with a hole. > > [ and you can extend that to third party modules if we attempt to act as a > registry for them. it goes without saying that people won't have every > third party module, so each apache process would have *huge* holes, thus > wasting significant processor tables ] That's very common on Win32, and reasonably optimized because of it. Com .dlls suffer the same problem, so it's been a priority for some time.
