[PATCH] D50034: Add a CommandGuide for llvm-objdump

Michael Trent via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 13:11:41 PDT 2018


mtrent marked an inline comment as done.
mtrent added a comment.

The short summary is "-macho" doesn't mean the target file is Mach-O. "-macho" means use the Mach-O specific file parser for walking the file contents, instead of using llvm-Object. When run in this way llvm-objdump will display information in a different way. Like it or hate it, it's what llvm-objdump does currently.



================
Comment at: docs/CommandGuide/llvm-objdump.rst:28
+
+  Display mach-o binding info.
+
----------------
beanz wrote:
> Does this require -macho?
No. The input file must be Mach-O (I assume) but you don't need to use the "-macho" specific binary parser.


================
Comment at: docs/CommandGuide/llvm-objdump.rst:56
+ 
+  Display mach-o exported symbols.
+
----------------
beanz wrote:
> I assume this also requires -macho?
No. The input file must be Mach-O (I assume) but you don't need to use the "-macho" specific binary parser.


================
Comment at: docs/CommandGuide/llvm-objdump.rst:77
+
+  Display mach-o lazy binding info.
+
----------------
beanz wrote:
> requires -macho?
No. The input file must be Mach-O (I assume) but you don't need to use the "-macho" specific binary parser.


================
Comment at: docs/CommandGuide/llvm-objdump.rst:106
+
+  Display mach-o rebasing info.
+
----------------
beanz wrote:
> requires -macho?
No. The input file must be Mach-O (I assume) but you don't need to use the "-macho" specific binary parser.


================
Comment at: docs/CommandGuide/llvm-objdump.rst:173
+  Create a CFG for every symbol in the object file and write it to a graphviz
+  file (Mach-O-only).
+
----------------
beanz wrote:
> Maybe change "Mach-O-only" to "requires -macho" for consistency.
Actually, looks like the -cfg option has been removed from newer objdumps, so I'll pull it from the CommandGuide.


================
Comment at: docs/CommandGuide/llvm-objdump.rst:201
+
+  Use Mach-O specific object file parser.
+
----------------
beanz wrote:
> Side note for a separate conversation. Do we really need this flag? Is there a reason we can't just use the magic bits at the beginning of the file stream to set the mode?
This flag is basically magic sauce meaning "run llvm-objdump in a otool compatible way", affecting both how the data is consumed and how it is printed. You can verify this yourself by comparing the output of "llvm-objdump -r" and "llvm-objdump -r -macho". It's entirely possible that general purpose developer tools would like to have a common llvm-y way of describing object file details, such as for some kind of CI system or packaging automation. So the same way you should use the high-level llvm-Object API to return data for general files, you can use the high-level llvm-objdump CLI to return this same data.

As Mach-O specific features that were implemented using the llbm-Ojbect API, one could argue that those features should have been made in the Mach-O specific parser instead of llvm-Object. I am going to argue that changing the implementation of llvm-objdump is beyond the scope of my task, which is to make a CommandGuide describing llvm-objdump's current behavior. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D50034





More information about the llvm-commits mailing list