This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linking/ELF question


Hi Robert,

> I have an object file (.o) and have no access to the source. I would
> like to link this file into a shared library. However, the symbol I
> after does not show up in the shared library. I suspect the reason is
> that readelf tells me that the symbol is hidden like so:
>
> 14: 0000000000000000   516 FUNC    GLOBAL HIDDEN    3 theSymbol
>
> Can I somehow change the attribute or force ld to ignore the "HIDDEN"
> attribute such that I will get the symbol in the glbal section in the
> shared library I am trying to create?

The basic idea behind having a hidden symbol in a shared library is to
prevent it from being accessed directly from any executable it is linked
with. This allows the visibility of the symbol to be hidden and does not
cause a GOT entry to be created for this hidden symbol hence reducing
dynamic loading costs(one less symbol to resolve) and making the whole
program more efficient.

If however you want to provide an access mechanism for the symbol to the
outside world , you could provide a function to access the same. However
this symbol cannot be directly exported from the shared library. For more
information about this you might like to read some great papers on shared
library design and implementation in ELF on Ulrich Dreppers site

http://people.redhat.com/drepper

Hope this helps.

cheers
Ramana



>
> Thanks,
> Robert
>
>
>
> --
> Robert Schweikert <Robert.Schweikert@abaqus.com>
> ABAQUS
>


----
Ramana Radhakrishnan
Codito Technologies


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]