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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 09:04:09 PDT 2019


pcc added a comment.

> removed dependent section tracking because dependencies are within the same object file, while this explain feature works in the file granularity

Is it a good idea to make the feature use file granularity in the `--gc-sections` case? I would imagine that this feature would be used in tricky situations where the explanation for a section being included is not entirely obvious, so doing things at a file granularity may end up hiding critical information. That's just my opinion though.



================
Comment at: lld/ELF/Explain.cpp:95
+
+  // Collect root objects.
+  for (InputFile *f : objectFiles)
----------------
ruiu wrote:
> pcc wrote:
> > Hmm, object files aren't really gc roots, so this could give misleading output (e.g. `ld a.o b.o --explain a` with a.o containing `a: ret` and b.o containing `b: call a` with only b in dynsym won't report b.o). Also, it misses archives included with `--whole-archive`.
> > 
> > Shouldn't this be more similar to MarkLive.cpp? In other words, include dynsym and don't treat object files as roots.
> I think object files are actually roots in this features sense if you do not pass `-gc-sections`, so we need to handle two different cases, `-no-gc-sections` and `-gc-sections`. How is this new code?
Maybe I'm missing something, but I don't see where dynsyms are being added in the new code in the `--gc-sections` case,


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