<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 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="gmail-"><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="gmail-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="gmail-HOEnZb"><font color="#888888"><div>Mehdi</div><div><br></div><div><br></div><br></font></span><blockquote type="cite"><div><div><div class="gmail-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="gmail-m_8337146210687482587m_2981833881305647625HOEnZb"><font color="#888888"><div><br></div><div>Teresa</div></font></span></div><div class="gmail_extra"><div><div class="gmail-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="gmail-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="gmail-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="gmail-">
______________________________<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>