[PATCH] D41527: [llvm-readobj] Support -needed-libs option for Mach-O files

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 12:50:03 PST 2017


davide requested changes to this revision.
davide added a comment.
This revision now requires changes to proceed.

I'm across the pond fo the rest of the year, sorry if communication is a little slow :)



================
Comment at: tools/llvm-readobj/MachODumper.cpp:42-43
 
+  void printNeededLibraries() override;
+
   // MachO-specific.
----------------
this is `Mach-O specific` no? So it should be grouped with the others.


================
Comment at: tools/llvm-readobj/MachODumper.cpp:687-692
+    if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
+        Command.C.cmd == MachO::LC_ID_DYLIB ||
+        Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||
+        Command.C.cmd == MachO::LC_REEXPORT_DYLIB ||
+        Command.C.cmd == MachO::LC_LAZY_LOAD_DYLIB ||
+        Command.C.cmd == MachO::LC_LOAD_UPWARD_DYLIB) {
----------------
maybe this would be more readable if it used a `switch`, not sure if it's entirely feasible.


================
Comment at: tools/llvm-readobj/MachODumper.cpp:695
+      if (Dl.dylib.name < Dl.cmdsize) {
+        const char *P = (const char *)(Command.Ptr) + Dl.dylib.name;
+        Libs.push_back(P);
----------------
`static_cast<>` and `auto *`.


================
Comment at: tools/llvm-readobj/MachODumper.cpp:701
+
+  std::stable_sort(Libs.begin(), Libs.end());
+
----------------
Why you need this stable sort?


Repository:
  rL LLVM

https://reviews.llvm.org/D41527





More information about the llvm-commits mailing list