[PATCH] D120357: [llvm-nm]add helper function to print out the object file name, archive name, architecture name

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 2 06:10:22 PST 2022


DiggerLin marked an inline comment as done.
DiggerLin added inline comments.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1889
+  CurrentFilename = Obj.getFileName();
+  if (IsSymbolsEmpty && SymbolList.empty() && !Quiet) {
     writeFileName(errs(), ArchiveName, ArchitectureName);
----------------
jhenderson wrote:
> Why have you just introduced this change? How is it better than the previous code?
yes, in the original code of function getSymbolNamesFromObject( )

```
  auto Symbols = Obj.symbols();
  .....
 
  if (DynamicSyms) {
    const auto *E = dyn_cast<ELFObjectFileBase>(&Obj);
    if (!E) {
      error("File format has no dynamic symbol table", Obj.getFileName());
      return;
    }
  Symbols = E->getDynamicSymbolIterators();
```
 The value of Symbols be changed by the line 
Symbols = E->getDynamicSymbolIterators();
 Symbols  maybe not the equal to  Obj.symbols()

so we can not use the 
if ( Obj.symbols().empty() && SymbolList.empty() && !Quiet) 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120357



More information about the llvm-commits mailing list