[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shared libs with non-PIC code on i386 - useful



On 17/08, Zdenek Kabelac wrote:
| Philippe Troin wrote:
| > 
| > 
| > > only PIC code, and the gcc (especially gcc-3.0) refuses to do such
| > > linking on non-x86 plattforms. Fortunately, this works fine on i386
| > > and used sometimes.
| > 
| > This ie evil. Having non-PIC shared libraries makes them non-shared
| > anymore (at least in memory).
| 
| Actually you have wrong point of view here.
| 
| There are cases where  'shared non-PIC' library is much better choice.
| 
| E.g. you have several softwares using  MPEG encoding library in the
| system
| - but obviously there is almost zero chance you will all use them at the
| same
| time - and if you will memory mapper will handle this and you will have
| 100KB twice in the memory - BUT the advantage of non-PIC code
| is there is one free register - which is very useful for x86 platform.
| So you will get measurable speed improvements!

Philippe was right and your explanation is right too, but your wording is
wrong: non-PIC libraries are not shared, in the traditional sense, because
they do not share the same physical memory, as you explain. This is what
non-shared mean. I think you intend to write "dynamic" where you write
"shared". That's right, sometimes, dynamic non-shared libraries make a
better choice because you get one more register, but do not call them
shared libaries just because they happen to be bound lately and dynamically.



Reply to: