[llvm-dev] (no subject)

Martin Storsjö via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 25 15:05:45 PDT 2020


Hi Eric,

On Fri, 25 Sep 2020, Eric Astor wrote:

> Thanks, Martin!
> My biggest question is around the behavior for alias-to-alias linkage. Using
> Microsoft tools (ml64.exe), if you define an external symbol t2, alias t4 to
> t2, and alias t7 to t4, you get exactly what you asked for:
> [ 8](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000001 t2
> [ 9](sec  0)(fl 0x00)(ty   0)(scl  69) (nx 1) 0x00000001 t4
> AUX indx 8 srch 3
> [11](sec  0)(fl 0x00)(ty   0)(scl  69) (nx 1) 0x00000001 t7
> AUX indx 9 srch 3
> 
> Using LLVM, we instead get a second weak default-null reference pointing
> directly to t2, rather than to t4:
> [ 3](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000001 t2
> ...
> [ 7](sec  0)(fl 0x00)(ty   0)(scl  69) (nx 1) 0x00000000 t4
> AUX indx 9 srch 3
> [ 9](sec  1)(fl 0x00)(ty   0)(scl  69) (nx 0) 0x00000001 .weak.t4.default.t1
> ...
> [17](sec  0)(fl 0x00)(ty   0)(scl  69) (nx 1) 0x00000000 t7
> AUX indx 19 srch 3
> [19](sec  1)(fl 0x00)(ty   0)(scl  69) (nx 0) 0x00000001 .weak.t7.default.t1
> 
> Due to our creation of ".weak" intermediates duplicating the current
> resolution of the aliasee, I think this can result in a different resolution
> for t7 than would happen in the Microsoft tools case? (Say, in a context
> where t4 has a strong definition.)
> Maybe we should eliminate the ".weak" intermediates if the reference's
> target is already an external symbol? They seem unnecessary for that case.

Yes, that does indeed sound like a good thing to do - and your patch does 
look like it achieves it - so that, in one way or another, certainly is 
the way to go.

// Martin


More information about the llvm-dev mailing list