[PATCH] D67388: Add a feature to dump dependency graph.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 01:43:33 PDT 2019


ruiu created this revision.
ruiu added reviewers: peter.smith, MaskRay, grimar.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
ruiu edited the summary of this revision.

This patch is not intended to be submitted as-is.

This patch implements an experimental feature that can be enabled
by --print-dependency-graph flag. When you give that option to lld,
lld prints out dependencies between files in the following format:

  <file1> <file2> <symbol>

The above line means <file1> uses <symbol> defined by <file2>.

This is a simple feature but seems pretty useful when debugging
why some file gets loaded. To find out why some file gets linked,
you can start from a special file `<commandline>` to follow the
triplets until you reach the file.

I uploaded an example output of --print-dependency-graph to
https://gist.github.com/rui314/f2f6b1bf5a30a12630183d5a0e5ad100

I don't think this feature is complete. At least I think I need
to do something for garbage-collected sections and ICF-merged
sections.

Rationale for the file format: I considered several different file
format for representing the dependency graph. I chose the above
format because a line-oriented text file format is easy to handle
by a scripting language. Since the same name is repeated many times
in an output, an output tend to be extremely large, but I think that
the advantage of simplicity outweighs the disadvantage, especially
for those who uses the option for the first time to debug some random
problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67388

Files:
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/InputFiles.h
  lld/ELF/Options.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67388.219491.patch
Type: text/x-patch
Size: 3492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190910/44e20c20/attachment.bin>


More information about the llvm-commits mailing list