[LLVMdev] Win32 COFF Support

Nathan Jeffords blunted2night at gmail.com
Wed May 5 18:44:12 PDT 2010


...
> Thanks, applied in r103150!  llvm-mc -filetype=obj probably needs a similar
> patch.
>
>
cool!, I will make that change and submit it too.

> ...
> Yes probably, I don't know what the .def and .scl directives "do" :)
>
>
I think I can figure out the right thing to do here.


> Also, w.r.t. section handling stuff, there is this fixme in the asmprinter:
>
>     } else if (const char *LinkOnce = MAI->getLinkOnceDirective()) {
>       // .globl _foo
>       OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
>       // FIXME: linkonce should be a section attribute, handled by COFF
> Section
>       // assignment.
>       //
> http://sourceware.org/binutils/docs-2.20/as/Linkonce.html#Linkonce
>       // .linkonce discard
>       // FIXME: It would be nice to use .linkonce samesize for non-common
>       // globals.
>       OutStreamer.EmitRawText(StringRef(LinkOnce));
>     } else {
>
> Basically, it seems like the MCSectionCOFF implementation should get the
> linkonce bit.  I'm not an expert on COFF, but I think that's the right place
> for it.  ".linkonce" will also have to be added as a new MCStreamer api,
> which would set the bit.
>
>
linkonce is one option for COFF COMDAT sections. I think that this call
should not exist at all, instead, when the AsmPrinter asks the TLOF what
section to use for the global, TLOF should create a new unique section with
the bit set already.

One thing that I don't understand is why common symbols do not get sections
assigned to them. I ended up assigning them to the '.bss' section in my
streamer (which I now know was wrong) but it still seems like they should be
part of some section. At least in COFF, they will be handled as a COMDAT
just like symbols with the linkonce linkage type.

I guess this all goes back to the assembly language view of things. I think
I have enough information to handle these things correctly now.

Thanks for the feedback.

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


More information about the llvm-dev mailing list