[LLVMdev] AsmPrinter::EmitLinkage

Nathan Jeffords blunted2night at gmail.com
Tue May 11 09:25:49 PDT 2010


On Tue, May 11, 2010 at 2:03 AM, Anton Korobeynikov <anton at korobeynikov.info
> wrote:

> > I think it emits valid output, but I don't think it handles weak symbols
> > correctly, as COFF supports true weak symbols, but this code appears to
> turn
> > them into a linkonce section which is not quite the same thing.
> Yes. This was intentional, since:
> 1. At the time of writing the code binutils did not support weak stuff
> 2. It was my feeling, that weak (especially external weak stuff) on
> COFF differs in some details from e.g. weak on MachO/ELF. I might be
> wrong, however...
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>

It is my understanding that weak symbols are symbols that can be overridden
(i.e. library provides a default implementation, and the application may
override it). Whereas linkonce (or COMDAT) is for symbol that might show up
in multiple object file but are effectively the same so its not particularly
important which one is selected. According to Microsoft's COFF
documentation, weak linkage is supported. From what I can gather from the
documentation, only one symbol may be defined as weak, and the overriding
symbol if present would be define normally. Perhaps this is the difference
in detail you speak of.

-Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100511/f50cbd14/attachment.html>


More information about the llvm-dev mailing list