<div dir="ltr"><div dir="ltr"><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"></div></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 23, 2020 at 1:45 PM Eric Astor <<a href="mailto:epastor@google.com">epastor@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<br><div><br></div><div>While working on alias support for the LLVM-ML project, I ran into a feature implemented back in 2010: default-null weak externals in COFF, a GNU extension.</div><div><a href="https://reviews.llvm.org/rG17990d56907b" target="_blank">https://reviews.llvm.org/rG17990d56907b</a><br></div><div><div></div><div>I'd like to disable this feature when targeting MSVC compatibility. Does anyone have more context on this, and why it'd be a terrible idea?<br></div></div><div><br></div><div>For context: This seems to be designed to let LLVM implement a GNU extension in COFF libraries. However, it leads to very different behavior than we see for cl.exe (and ml.exe) on Windows; for already-defined aliasees, it injects an alternate placeholder ".weak.<alias>.default.<uniquifier>" symbol which resolves back to the current location. I admit, I'm not quite sure how this helps. If anyone can explain the purpose, I'd really appreciate it!</div><div><br></div><div>In Windows PE/COFF files, aliases typically just resolve to their target symbol. For an example, see <a href="https://reviews.llvm.org/D87403#inline-811289" target="_blank">https://reviews.llvm.org/D87403#inline-811289</a>.</div><div><br></div><div>Thanks,</div><div>- Eric</div></div></blockquote><div><br></div><div><br></div><div>Sadly I don't recall why I made that change, probably should have included that in the commit message. I do know that at the time I was focused on link.exe support, not mingw. I just looked through my commit history from that time and it doesn't really explain much.</div><div><br></div><div>I believe that as long as the "compare weak symbol against null" does the right thing any changes you make here are fine.</div><div><br></div><div>- Michael Spencer  <br></div></div></div>