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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 01:28:19 PDT 2021


jhenderson added inline comments.


================
Comment at: lld/ELF/Driver.cpp:2196
             e.message());
     if (auto e = tryCreateFile(config->mapFile))
       error("cannot open map file " + config->mapFile + ": " + e.message());
----------------
We should consider adding an equivalent check to this area for the new file, for the same reason as the other cases.


================
Comment at: lld/ELF/Symbols.cpp:326
 
+static void printWhyExtract(const InputFile *reference,
+                            const InputFile &extracted, const Symbol &sym) {
----------------
This function may be a bit misnamed now, since it doesn't actually do any printing. Perhaps `recordWhyExtract`?


================
Comment at: lld/test/ELF/why-extract.s:1
+# REQUIRES: x86
+
----------------
Maybe add a case where there was nothing used from an archive, to show that the file is still created, with the header.


================
Comment at: lld/test/ELF/why-extract.s:14
+# RUN: ld.lld main.o a_b.a b.a -o /dev/null --why-extract=why.txt
+# RUN: FileCheck %s --match-full-lines --strict-whitespace < why.txt
+
----------------
I might suggest changing `< why.txt` to `--input-file=why.txt`, but it's entirely up to you. My motivation is that when using the PowerShell termainl, the `<` character is reserved and not used for stdin for some reason, which means you can't copy and paste this sort of line to aid in debugging.


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