<div dir="ltr">Can we have a subdir in the test that requires latest version of gold -- so that more tests can be added?<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 22, 2016 at 11:41 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"><span class="">tejohnson added inline comments.<br>
<br>
================<br>
Comment at: test/tools/gold/X86/thinlto_emit_linked_objects.ll:18<br>
@@ +17,3 @@<br>
+; RUN:    %t.o \<br>
+; RUN:    --start-lib %t2.o --end-lib<br>
+<br>
----------------<br>
</span><div><div class="h5">tejohnson wrote:<br>
> mehdi_amini wrote:<br>
> > tejohnson wrote:<br>
> > > tejohnson wrote:<br>
> > > > tejohnson wrote:<br>
> > > > > mehdi_amini wrote:<br>
> > > > > > tejohnson wrote:<br>
> > > > > > > tejohnson wrote:<br>
> > > > > > > > davidxl wrote:<br>
> > > > > > > > > tejohnson wrote:<br>
> > > > > > > > > > davidxl wrote:<br>
> > > > > > > > > > > tejohnson wrote:<br>
> > > > > > > > > > > > davidxl wrote:<br>
> > > > > > > > > > > > > Perhaps add test case about real archive case as well.<br>
> > > > > > > > > > > > For a distributed build the build system needs to extract the constituent objects (otherwise the combined index paths will not point to an object file)<br>
> > > > > > > > > > > I think this feature is more about two step link (not about a particular distributed build system). It is possible that some other distributed build system uses archive, right?<br>
> > > > > > > > > > Using archives directly with a distributed build won't work - the combined index module paths need to point to an object file for the distributed backends to import from. The build system needs to extract the objects (e.g. into a temp dir) and pass those.<br>
> > > > > > > > > ><br>
> > > > > > > > > > Note that archives passed to a non-distributed build work fine because we load the modules from the offset within the archive passed to the plugin from gold and serve those to the importer.<br>
> > > > > > > > > how about thin archive?<br>
> > > > > > > > Gold does not seem to like thin archives (regardless of LTO vs ThinLTO). I get an error (from gold, not the plugin) like:<br>
> > > > > > > ><br>
> > > > > > > > error: foo.a: no archive symbol table (run ranlib)<br>
> > > > > > > ><br>
> > > > > > > > (even when I run ranlib)<br>
> > > > > > > Note this issue is specific to bitcode files in the archive - gold with regular native objects in a thin archive works just fine. Looks like ranlib doesn't work on an archive of bitcode files, and that seems to be needed with a thin archive.<br>
> > > > > > Do you mean "ranlib doesn't work on a *thin* archive of bitcode files"?<br>
> > > > > > Otherwise how do you build LLVM itself with LTO?<br>
> > > > > According to <a href="http://llvm.org/docs/GoldPlugin.html" rel="noreferrer" target="_blank">http://llvm.org/docs/GoldPlugin.html</a> it isn't supported for archives of bitcode files at all, but apparently isn't needed for a whole (non-thin) archive:<br>
> > > > ><br>
> > > > > "export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a"<br>
> > > > So I can't get gold to work with a (non-thin) archive created by ar, it gives the same error. Maybe it needs to take the -plugin option? In any case, a non-thin archive created via llvm-ar is accepted and works fine. I don't see an llvm-ar option to create a thin archive though?<br>
> > > Aha - llvm-ar does support thin archives, it's just that the T option is not documented in the help. =)<br>
> > ><br>
> > > With that, it does work for llvm-ar thin archives! Will add another case to the new test that does the same for thin archives before submitting.<br>
> > > According to <a href="http://llvm.org/docs/GoldPlugin.html" rel="noreferrer" target="_blank">http://llvm.org/docs/GoldPlugin.html</a> it isn't supported for archives of bitcode files at all.<br>
> ><br>
> > Documentation patch?<br>
> Reading through that page some more, it gives instructions earlier on getting the plugin to work with ar:<br>
> "ar and nm also accept the -plugin option and it’s possible to to install LLVMgold.so to /usr/lib/bfd-plugins for a seamless setup. If you built your own gold, be sure to install the ar and nm-new you built to /usr/bin."<br>
><br>
> So I think it is ok. I just took the latter comment out of context.<br>
><br>
> However, I will send a patch to document the llvm-ar T modifier<br>
> With that, it does work for llvm-ar thin archives! Will add another case to the new test that does the same for thin archives before submitting.<br>
<br>
</div></div>And, removed in r276453 due to bot failure - looks like gold v1.11 does not like the thin archive (gold v1.12 is fine though!).<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D22677" rel="noreferrer" target="_blank">https://reviews.llvm.org/D22677</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>