[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
Tue Mar 8 10:46:00 PST 2022


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


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1774
     if (Nsect == 0)
-      return;
+      return false;
   }
----------------
jhenderson wrote:
> DiggerLin wrote:
> > jhenderson wrote:
> > > Are you sure this should be `return false`? (I don't know either way, but we should preserve behaviour).
> > the patch almost is NFC patch, I do not think it is a good idea to change the preserve 
> >  behaviour.
> I said we should preserve behaviour. My question was: does this?
not sure your question, would  you like to  explain more detail?

according to the comment

 
```
 // If a "-s segname sectname" option was specified and this is a Mach-O
  // file get the section number for that section in this object file.
  unsigned int Nsect = 0;
  MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(&Obj);
  if (!SegSect.empty() && MachO) {
    Nsect = getNsectForSegSect(MachO);
    // If this section is not in the object file no symbols are printed.
    if (Nsect == 0)
      return false;
  }
```

if the user specific a section name from llvm-nm command line
"-s segname sectname", but the section not in the Mach-O object, it can not get the symbol. it should return the false. 

do I answer your question ? 



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