[PATCH] D101786: [llvm-objdump] Exclude __mh_execute_header symbol during MachO disassembly

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 13:44:35 PDT 2021


gkm marked 2 inline comments as done.
gkm added inline comments.


================
Comment at: llvm/test/tools/llvm-objdump/MachO/no-text-symbols-disassembly.test:76
+    version:         0
+  - cmd:             LC_UNIXTHREAD
+    cmdsize:         184
----------------
int3 wrote:
> I believe `LC_UNIXTHREAD` is emitted when linking for older target versions. If you pass a modern macOS version to the ld64 you should get `LC_MAIN` instead. Not that it really matters, but LC_MAIN is generally more compact to encode, especially in yaml -- it doesn't have all those PayloadBytes.
`LC_UNIXTHREAD` is required for static linking regardless of version, and there is no way to override that. YAML output for a dynamic link is larger.


================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:1082
+      // code, and is irrelevant for disassembly.
+      if (NameOrErr->equals("__mh_execute_header"))
+        continue;
----------------
int3 wrote:
> there are a bunch of other `__mh_*_header` symbols (you can see them in the LLD source)... should we ignore them all?
Yes, all should be ignored. They serve the same purpose of header introspection and do not offer any useful information about code boundaries to the disassembler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101786



More information about the llvm-commits mailing list