[llvm-dev] Weak symbol/alias semantics

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 18 07:34:50 PST 2017

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.

> 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


More information about the llvm-dev mailing list