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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 02:02:42 PDT 2019


grimar added inline comments.


================
Comment at: lld/ELF/Explain.cpp:175
+  error("--explain: no such file or symbol: '" + name +
+        "'. Use --verbose option to see a list of input files.");
+  return nullptr;
----------------
grimar wrote:
> But it doesn't seem helps for the case mentioned in the description?
> 
> If we have a `main.o` compiled from
> ```
> .global _start;
> _start:
> callq foo
> ```
> 
> And a `foo.a` which contains a `foo.o` compiled from
> 
> ```
> .globl foo;
> foo:
> ```
> 
> Then when I invoke `-flavor gnu main.o foo.a "-o" out --verbose` I see:
> ```
> lld: main.o
> lld: foo.a
> ```
> 
> Then, like a possible normal user :) I do:
> `-flavor gnu --explain=foo.a main.o foo.a "-o" out --verbose`
> 
> and I see:
> 
> ```
> lld: main.o
> lld: foo.a
> lld: error: --explain: no such file or symbol: 'foo.a'. Use --verbose option to
> see a list of input files.
> ```
> 
> How I am supposed to realise that I should invoke `-flavor gnu --explain=foo.a(foo.o) main.o foo.a "-o" out --verbose`
> to see the following?
> 
> ```
> lld: main.o
> lld: foo.a
> Explain: This is why 'foo.a(foo.o)' is linked:
> Explain:
> Explain: '(--entry option)' uses '_start' defined in 'main.o'
> Explain: which uses 'foo' defined in 'foo.a(foo.o)'
> ```
> 
btw, note that it says `'(--entry option)' uses '_start'`, but in fact I am not using any command line option like `-e`


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