Linked by Adam S on Tue 26th Aug 2008 21:12 UTC
Thread beginning with comment 328107
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
PE doesn't generate position-independent code, so it's slightly faster than ELF since eg. the EBX register is available to x86 applications to use.
Yes. The difference is typically about 5% for processor-bound tasks on x86_32. I doubt the effect is measurable at all on architectures like x86_64 which are not so ridiculously register-starved.
gcc will produce non position independent code if you tell it to.






Member since:
2006-08-02
I've had a detailed look at 2 binary formats over the years, both ELF and Microsoft's PE.
PE doesn't generate position-independent code, so it's slightly faster than ELF since eg. the EBX register is available to x86 applications to use. However each DLL has to be loaded at a particular location in memory, and that location cannot change after the DLL is loaded, so if that memory region is unavailable in a new process, the DLL has to be "rebased", ie. a new private copy of it loaded somewhere else in memory, which uses extra memory in that process.
ELF does generate position-independent code so it never has the rebasing problem, at the cost of a slight slow down in performance, but in ELF symbol lookup is process scoped, not library scoped like everywhere else. So if 2 libraries define the same symbol, the first library loaded wins. This is a big problem in real world applications, as Autopackage discovered.