[PATCH] [ELF] Initial support for symbols visibility
Nick Kledzik
kledzik at apple.com
Sat Mar 14 18:16:13 PDT 2015
On 03/14/15, Shankar Easwaran <shankarke at gmail.com> wrote:
>
>
> >
> > >
> >
> > > ================
> >
> > > Comment at: lib/ReaderWriter/ELF/SectionChunks.h:790
> >
> > > @@ -776,1 +789,3 @@
> >
> > > + }
> >
> > > + sym.setVisibility(visibility);
> >
> > > sym.setBindingAndType(binding, type);
> >
> > > ----------------
> >
> > > This is very confusing, if you see line 771. We set binding for local symbols to be STB_LOCAL if scope is set to scopeTranslationUnit, so visibility would need to be set as STV_DEFAULT ? No ?
> >
> > >
> >
> >
> >
> > To me the whole notion of modeling visibility using 'Scope' is
> >
> > confusing. I don't see why we can't expose visibility as I did in my
> >
> > previous patch
>
>
> If we want to a new attribute visibility to the Atom, I think we would need to cleanup and redefine scope IMO. This way it would be much cleaner than defining visibility attributes in multiple places .
>
>
>
>
>
ELF has some historic baggage in that it initially only had STB_LOCAL and STB_GLOBAL. Later when visibility hidden was invented (which is in-between LOCAL and GLOBAL), it was wedged into the ELF format by adding some new bits to st_other field. In lld, the Scope is a continuum from translation unit, to linkage unit, to global.
In ELF "protected" is a combination of two things: 1) the scope is global, 2) the symbol is not interposable. So a visibility=protected symbol in ELF should map to an atom with:
scope=global, interposable=no.
Whereas regular global symbols in ELF should have interposable=yes.
-Nick
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150314/693c6c1d/attachment.html>
More information about the llvm-commits
mailing list