On Wed, Jan 18, 2017 at 7:16 AM, Rafael Avila de Espindola < rafael.espindola at gmail.com> wrote:> >> The rule should be that the alias to aliasee link is never broken. The > >> reason being that an alias at the file level is just another symbol with > >> the same value. > >> > >> So if foo is an alias to bar, accessing that foo will always be the same > >> as accessing that bar, regardless of either of them being weak. I say > >> *that* foo and *that* bar because symbol resolution may pick another foo > >> and another bar. > >> > > > > Are you just talking about the comdat case? > > No, that is always the case. > > > If this also applies to the > > non-comdat case, I'm not sure how this works in the following situation > > (copied from an example in my response just now to pcc): > > > > If a module contains the following, and both @x and @y are non-prevailing > > in that module: > > > > @x = weak global ... > > @y = weak alias @x > > > > and the prevailing def for @x is in moduleX with a different value than > the > > prevailing def for @y which comes from moduleY. Just because they are > > aliased in this module doesn't mean they must be aliased elsewhere, > > right? > > Correct. > > > For this case (weak non-prevailing alias to a weak non-prevailing def) I > > think it should eventually become: > > > > @x = external global > > @y = external global > > When dropping @x and @y during IR linking? I agree. > > > Trying to understand how this fits with your comment that "The rule > should > > be that the alias to aliasee link is never broken", unless that is just > > referring to the case I mentioned just above about when they are both in > > comdats. > > In the above example the "link/connection" is not broken. The original > @x and @y still refer to the same data, it is just that neither is used > in the final linked object. >Ok, thanks. But how does that property work the strongalias case from the original email. E.g.: @f = weak global ... @strongalias = alias @f What we had concluded was that it should be transformed into the following when this copy of @f is non-prevailing: @f = external global @f.llvm.1 = internal global ... // Internalized copy of original @f @strongalias = alias @fv.llvm.1 Maybe we are just using different terminology for the same thing, but in this case it seems as though we have broken the link between the original alias @f and aliasee @strongalias? Or is the point that we haven't broken the link between the value in this module of @f (copied to @f.llvm.1) and @strongalias? Teresa> Cheers, > Rafael >-- Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170118/1935324a/attachment.html>
Rafael Avila de Espindola via llvm-dev
2017-Jan-18 15:34 UTC
[llvm-dev] Weak symbol/alias semantics
Teresa Johnson <tejohnson at google.com> writes:> Ok, thanks. But how does that property work the strongalias case from the > original email. E.g.: > > @f = weak global ... > @strongalias = alias @f > > What we had concluded was that it should be transformed into the following > when this copy of @f is non-prevailing: > > @f = external global > @f.llvm.1 = internal global ... // Internalized copy of original @f > @strongalias = alias @fv.llvm.1I would use private instead of insternal, but yes, that is it.> Maybe we are just using different terminology for the same thing, but in > this case it seems as though we have broken the link between the original > alias @f and aliasee @strongalias? Or is the point that we haven't broken > the link between the value in this module of @f (copied to @f.llvm.1) and > @strongalias?Correct. The two origial symbols would still point to the save thing. It is just that one of the symbols is not used and is dropped. This is the case that becames simpler if the IR is required to be written as @data = private global.... @f = weak alias @data @strongalias = alias @data Cheers, Rafael
On Wed, Jan 18, 2017 at 7:34 AM, Rafael Avila de Espindola < rafael.espindola at gmail.com> wrote:> Teresa Johnson <tejohnson at google.com> writes: > > Ok, thanks. But how does that property work the strongalias case from the > > original email. E.g.: > > > > @f = weak global ... > > @strongalias = alias @f > > > > What we had concluded was that it should be transformed into the > following > > when this copy of @f is non-prevailing: > > > > @f = external global > > @f.llvm.1 = internal global ... // Internalized copy of original @f > > @strongalias = alias @fv.llvm.1 > > I would use private instead of insternal, but yes, that is it. >Right, it should be private.> > > Maybe we are just using different terminology for the same thing, but in > > this case it seems as though we have broken the link between the original > > alias @f and aliasee @strongalias? Or is the point that we haven't broken > > the link between the value in this module of @f (copied to @f.llvm.1) and > > @strongalias? > > Correct. The two origial symbols would still point to the save thing. It > is just that one of the symbols is not used and is dropped. This is the > case that becames simpler if the IR is required to be written as > > @data = private global.... > @f = weak alias @data > @strongalias = alias @data >Ok thanks, Teresa> > Cheers, > Rafael >-- Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170118/be978342/attachment.html>