[llvm-dev] (no subject)

Eric Astor via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 23 20:46:03 PDT 2020


Thanks, Michael! However... comparing weak against null isn't actually
supported by MSVC, to the best of my knowledge. If we want to maintain that
in the PE/COFF world, I think we might have to accept some weird behavior.
I was wondering how much people will scream if I disable this feature in
MSVC-compatible targets.

Best,
- Eric

On Wed, Sep 23, 2020 at 8:53 PM Michael Spencer <bigcheesegs at gmail.com>
wrote:

>
> On Wed, Sep 23, 2020 at 1:45 PM Eric Astor <epastor at google.com> wrote:
>
>> Hi all,
>>
>> 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.
>> https://reviews.llvm.org/rG17990d56907b
>> 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?
>>
>> 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!
>>
>> In Windows PE/COFF files, aliases typically just resolve to their target
>> symbol. For an example, see https://reviews.llvm.org/D87403#inline-811289
>> .
>>
>> Thanks,
>> - Eric
>>
>
>
> 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.
>
> I believe that as long as the "compare weak symbol against null" does the
> right thing any changes you make here are fine.
>
> - Michael Spencer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200923/24c7e6da/attachment.html>


More information about the llvm-dev mailing list