<div dir="ltr">Filed <a href="https://llvm.org/bugs/show_bug.cgi?id=30610">https://llvm.org/bugs/show_bug.cgi?id=30610</a> to track, we can continue discussion there.<div><br></div><div>Thanks,</div><div>Teresa</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 10:48 AM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ah, you are using 3.9 which explains the lack of additional save-temps files. In any case I just reproduced the multiple def issue with a head compiler. The module assembly is linked into the importing module as you suspected, even though it isn't referenced. Looks like the IRLinker always appends the module inline assembly when linking in a module (despite the fact that we only link in certain symbols). Will investigate a fix.<span class="HOEnZb"><font color="#888888"><div><br></div><div>Teresa</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 9:40 AM, Johan Engelen <span dir="ltr"><<a href="mailto:jbc.engelen@gmail.com" target="_blank">jbc.engelen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The plugin version (and LLVM) are LLVM 3.9.0 (the release source tarball).<br></div><div class="gmail_extra"><div class="gmail_quote"><br></div><div class="gmail_quote">I've attached the source files and the temporary files generated.</div><div class="gmail_quote">`a.o` is the "MAIN" module.</div><div class="gmail_quote">`b.o` is the "ASM" module.</div><div class="gmail_quote"><br></div><div class="gmail_quote">The error I get is:</div><div class="gmail_quote">/usr/bin/ld: error: a.o.thinlto.o: multiple definition of 'foo'</div><div class="gmail_quote">/usr/bin/ld: b.o.thinlto.o: previous definition here</div><div class="gmail_quote"><br></div><div class="gmail_quote">(the files depend on D runtime lib, so upon succes you should see missing symbol errors :-)</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks,</div><div class="gmail_quote"> Johan</div><div><div class="m_-7049269875612958086h5"><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Oct 3, 2016 at 6:17 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class="m_-7049269875612958086m_7758300482695768480gmail-"><blockquote type="cite"><div>On Oct 3, 2016, at 8:07 AM, Johan Engelen via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-7049269875612958086m_7758300482695768480gmail-m_8337146210687482587Apple-interchange-newline"><div><div dir="ltr">With `save-temps` as plugin option, I get extra files for the MAIN module (called `a.o`): `a.o.opt.bc` and `a.thinlto.bc`.</div></div></blockquote><div><br></div></span><div>I’d expect as temps `a.thinlto.bc` for the index + one file per input. Also there should be a number like: `a.o.4.opt.bc`</div><div><br></div><div>Can you attach the generated temp files?</div><div><br></div><div>Thanks,</div><div><br></div><div>— </div><span class="m_-7049269875612958086m_7758300482695768480gmail-HOEnZb"><font color="#888888"><div>Mehdi</div><div><br></div><div><br></div><br></font></span><blockquote type="cite"><div><div><div class="m_-7049269875612958086m_7758300482695768480gmail-h5"><div dir="ltr"><div>The `a.thinlto.bc` file contains nothing, only `source_filename = ...` .</div><div>The `a.o.opt.bc` (this looks like the result after ThinLTO importing and optimization) contains the assembly block that it should not have:</div><div>```</div><div><div>module asm "\09.text"</div><div>module asm "\09.globl\09foo"</div><div>module asm "\09.align\0916, 0x90"</div><div>module asm "\09.type\09foo,@function"</div><div>module asm "foo:"</div><div>module asm "\09movq %rdi, %rax"</div><div>module asm "\09rorw $8, %ax"</div><div>module asm "\09ret "</div><div>module asm "\09.size\09foo, .-foo"</div><div>module asm ""</div></div><div>```</div><div>The asm is the same as in the other module (where it _should_ be defined), and the linkage has not been changed.</div><div><br></div><div>Thanks for the help,</div><div> Johan</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 4:45 PM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><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">Oh sorry, misunderstood and thought you were implementing in a new linker. For gold you can pass -Wl,-plugin-opt,save-temps and look at the bitcode after each phase of ThinLTO, e.g. I think the files will have .3.import.bc extensions.<span class="m_-7049269875612958086m_7758300482695768480gmail-m_8337146210687482587m_2981833881305647625HOEnZb"><font color="#888888"><div><br></div><div>Teresa</div></font></span></div><div class="gmail_extra"><div><div class="m_-7049269875612958086m_7758300482695768480gmail-m_8337146210687482587m_2981833881305647625h5"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 7:42 AM, Johan Engelen <span dir="ltr"><<a href="mailto:jbc.engelen@gmail.com" target="_blank">jbc.engelen@gmail.com</a>></span> wrote:<br><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"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 3, 2016 at 4:27 PM, Teresa Johnson <span dir="ltr"><<a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a>></span> wrote:<br><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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="m_-7049269875612958086m_7758300482695768480gmail-m_8337146210687482587m_2981833881305647625m_-2678425756575116267m_4773286970547948026gmail-">On Mon, Oct 3, 2016 at 6:53 AM, Johan Engelen via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><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,<div> I am trying to add ThinLTO to the LDC compiler. It seems to work well on Mac (XCode 8) and Ubuntu (ld.gold + LLVMgold plugin).</div><div>However, I am running into trouble with module-scope inline assembly blocks.</div></div></blockquote><div><br></div></span><div>Are you adding the support using the new LTO API or using the libLTO C interfaces?</div></div></div></div></blockquote><div><br></div></span><div>Perhaps I don't fully understand, but I think the answer is: neither :)</div><div>What I do is output the module as bitcode with the module summary index added (`llvm::WriteBitcodeToFile`, summary index created with `llvm::ModuleSummaryIndexBuild<wbr>er`). This is then passed to the system linker. The problems arise with ld.gold + LLVMgold plugin. I am using LLVM 3.9.0.</div><div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span>-- <br><div class="m_-7049269875612958086m_7758300482695768480gmail-m_8337146210687482587m_2981833881305647625m_-2678425756575116267gmail_signature"><span style="font-family:times;font-size:inherit"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</span></div>
</blockquote></div><br></div></div></div></div><span class="m_-7049269875612958086m_7758300482695768480gmail-">
______________________________<wbr>_________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-7049269875612958086gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> <a href="tel:408-460-2413" value="+14084602413" target="_blank">408-460-2413</a></td></tr></tbody></table></span></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Teresa Johnson |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 408-460-2413</td></tr></tbody></table></span></div>
</div>