This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: symbol relocation during dynamic loading
On Mon, 2004-04-19 at 16:44, Ian Lance Taylor wrote:
> Robert Schweikert <Robert.Schweikert@abaqus.com> writes:
>
> > I am using the --retain-symbols-file <filename> link option to restrict
> > the exported symbols from shared libraries. Using elfdump libName
> > --export to compare the exported symbols between libraries linked with
> > and without the --retain-symbols-file <filename> option indicates that
> > things worked as expected and I only get the symbols I want exported.
> > Also the size of the "restricted" library is smaller (as expected).
> >
> > The question now is why the relocations are the same between the 2
> > libraries. If I set the LD_DEBUG environment variable to statistics and
> > load both libraries I end up with the same number of relocations. My
> > expectation was that the number of relocations would decrease and thus I
> > would end up with faster load times.
> >
> > Can anyone explain why the number of relocations did not show any
> > changes?
>
> Hmmm. You neglected to mention your target.
The target is IA32
> The only type of
> relocation which is likely to disappear entirely is a PC relative
> relocation to a publically visible function. If the function is
> hidden, then the relocation can go away. All other relocations are
> likely to remain, perhaps in the form of R_*_RELATIVE.
>
> That said, there is another way to hide symbols in a shared library,
> which is to use a version script. It is possible that using a version
> script will remove relocations where --retain-symbols-file will not.
> That is because the implementation of the two options is, I believe,
> different. I haven't checked whether this is so. But it is possible.
> (Yes, if they are indeed different, this probably a bug.)
OK, this leads me to a follow up question.If the number of relocations
does not change the improved load performance I am hoping to achieve
would be based on hopefully shorter hash buckets and fewer string
comparisons. Is this correct? And is there a way to extract this
information from the linker?
Thanks,
Robert
>
> Ian
--
Robert Schweikert <Robert.Schweikert@abaqus.com>
ABAQUS