[PATCH] D69607: Add a feature to explain why some file gets included to the linker's output

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 03:17:56 PDT 2019


peter.smith added a comment.

I agree that having the most common case built in is valuable. Unless there is an analysis program that is shipped with the linker I suspect that the majority of users won't want to write their own algorithm.
Looking at the example output:

  '(--entry option)' uses '_start'
  '/usr/lib/x86_64-linux-gnu/crt1.o' uses 'main'
  'lld.cpp.o' uses 'lld::elf::link(llvm::ArrayRef<char const*>)'
  'lib/liblldELF.a(Driver.cpp.o)' uses 'llvm::object::Archive::create()'
  'lib/libLLVMObject.a(Archive.cpp.o)' uses 'llvm::Expected<bool>::operator bool()'
  'lib/libLLVMPasses.a(PassBuilder.cpp.o)' uses 'llvm::InlinerPass::~InlinerPass()'
  'lib/libLLVMipo.a(Inliner.cpp.o)'

I'd be tempted to start with the last object in the chain that is unconditionally present on the command line. For example _start, crt1.o, etc. will always be present and most likely not visible to the user as they have been added by the compiler driver. In this case I'd expect lld.cpp.o to be the first entry in the diagnostic.

Although it is implicit, it may be worth stating the dependency as:

  'lld.cpp.o' uses 'lld::elf::link(llvm::ArrayRef<char const*>)' defined in 'lib/liblldELF.a(Driver.cpp.o)'

It would make it a bit more verbose, but everything is on one line.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69607/new/

https://reviews.llvm.org/D69607





More information about the llvm-commits mailing list