[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 14:38:18 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:
> gkm wrote:
> > 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.
> Ah I see. I went to look at my recent diff that added a yaml test, and it seems like yaml2obj doesn't require either load command: rG9260760235261a5cd150b15a3499f7988da65a02
> 
> Not sure if objdump needs it to work, but the guidance I've gotten in the past wrt yaml inputs is to make them as small as possible, even if the resulting binary doesn't execute.
I manually edited the YAML file to remove `PayloadBytes` for `LC_UNIXTHREAD`. I couldn't remove the entire command without getting a non-obvious error from `yaml2obj`. Is manual editing how we're supposed to trim these files?


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