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
I don't think this feature is complete. At least I think I need
to do something for garbage-collected sections and ICF-merged
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