[PATCH] D22677: [ThinLTO/gold] Support for getting list of included objects from gold

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 11:13:10 PDT 2016


tejohnson added inline comments.

================
Comment at: test/tools/gold/X86/thinlto_emit_linked_objects.ll:18
@@ +17,3 @@
+; RUN:    %t.o \
+; RUN:    --start-lib %t2.o --end-lib
+
----------------
tejohnson wrote:
> tejohnson wrote:
> > mehdi_amini wrote:
> > > tejohnson wrote:
> > > > tejohnson wrote:
> > > > > davidxl wrote:
> > > > > > tejohnson wrote:
> > > > > > > davidxl wrote:
> > > > > > > > tejohnson wrote:
> > > > > > > > > davidxl wrote:
> > > > > > > > > > Perhaps add test case about real archive case as well.
> > > > > > > > > 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)
> > > > > > > > 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?
> > > > > > > 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.
> > > > > > > 
> > > > > > > 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.
> > > > > > how about thin archive?
> > > > > Gold does not seem to like thin archives (regardless of LTO vs ThinLTO). I get an error (from gold, not the plugin) like:
> > > > > 
> > > > > error: foo.a: no archive symbol table (run ranlib)
> > > > > 
> > > > > (even when I run ranlib)
> > > > 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.
> > > Do you mean "ranlib doesn't work on a *thin* archive of bitcode files"? 
> > > Otherwise how do you build LLVM itself with LTO?
> > According to http://llvm.org/docs/GoldPlugin.html it isn't supported for archives of bitcode files at all, but apparently isn't needed for a whole (non-thin) archive:
> > 
> > "export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a"
> 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?
Aha - llvm-ar does support thin archives, it's just that the T option is not documented in the help. =)

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.


https://reviews.llvm.org/D22677





More information about the llvm-commits mailing list