[PATCH] D109572: [ELF] Add --why-extract to query why an archive member/lazy object file is extracted

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 10 07:27:46 PDT 2021


peter.smith added a comment.

Not had a chance to formulate a strong opinion yet, I think James has some interesting thoughts, but I expect a lot of this will come down to personal preference.

I can share the results of what Arm's proprietary linker does which has been useful. It essentially integrates this into the --verbose output, which does interleave with other verbose output but in this particular case it works out ok as it helps show where the reference and definitions are from each object. A hand edited example example, the library names are a little strange as they encode properties about the library for example .l is for little endian:

  Selecting member vsnprintf.o(c_wfu.l) to define vsnprintf.
  ...
  Loading member vsnprintf.o from c_wfu.l.
                definition:  vsnprintf
                reference :  _printf_a
                 ...
  Selecting member _printf_a.o(c_wfu.l) to define _printf_a.
  ...
  Loading member _printf_a.o from c_wfu.l.
                definition:  _printf_a
                weak ref  :  _printf_fp_hex
                ...

While not complete as it only cites the first single symbol reference that is resolved by a library member, it can usually be used to trace back. The information is not tabulated so interleaving isn't as much of a problem.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109572/new/

https://reviews.llvm.org/D109572



More information about the llvm-commits mailing list