Dynamic-loaded libraries, etc.
Posted: Fri Nov 22, 2002 10:23 am
Hello, ...
there's something that troubles me a bit about shared dynamically-loaded libraries ... Every process might have a different memory map, so how will the kernel ensure that - say - gui.dll (or libgui.so) will be mapped at the same virtual address in every process ?
If not mapped at the same address, the library will have to be relocated to its new location, no ? thus, breaking the 'sharability' (as every process will need a separate copy of the library with its own relocation entries written ...)
Now, there is the option of Position Independent Code: have a global register that keeps the address of a jump-table for the functions, so that when the library needs the address of function F (or the address for static variable X), it knows it is located at [ebx + <offset for x>] or [ebx + offset for F in the jump-table]
But locking one register to this still frustrate me ...
Why doesn't IA-32 have a [eip + offset] addressing mode
What do you suggest ?
there's something that troubles me a bit about shared dynamically-loaded libraries ... Every process might have a different memory map, so how will the kernel ensure that - say - gui.dll (or libgui.so) will be mapped at the same virtual address in every process ?
If not mapped at the same address, the library will have to be relocated to its new location, no ? thus, breaking the 'sharability' (as every process will need a separate copy of the library with its own relocation entries written ...)
Now, there is the option of Position Independent Code: have a global register that keeps the address of a jump-table for the functions, so that when the library needs the address of function F (or the address for static variable X), it knows it is located at [ebx + <offset for x>] or [ebx + offset for F in the jump-table]
But locking one register to this still frustrate me ...
Why doesn't IA-32 have a [eip + offset] addressing mode
What do you suggest ?