[PATCH] D69607: Add a feature to explain why some file gets included to the linker's output
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 23:34:51 PDT 2019
MaskRay added inline comments.
================
Comment at: lld/ELF/Explain.cpp:101
+ enqueueSpecial("(--entry option)", config->entry);
+ enqueueSpecial("(--init option)", config->init);
+ enqueueSpecial("(--fini option)", config->fini);
----------------
--init and --fini are used in --gc-sections but they do not fetch lazy definitions. I do not know why GNU ld behaves this way.
================
Comment at: lld/ELF/Explain.cpp:157
+
+ if (!seen.insert(sym.file).second)
+ return;
----------------
We can make edges a superset of specialEdges, then we can just delete `seen` and use `edges.try_emplace(...)` here.
================
Comment at: lld/ELF/Explain.cpp:167
+ auto *sym = dyn_cast_or_null<Defined>(symtab->find(symName));
+ if (!sym || sym->isWeak())
+ return;
----------------
pcc wrote:
> I don't think the `isWeak` part here is correct.
`-u`/`-e` can fetch a weak lazy definition. This may cause a bogus `file unreachable` error.
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