[PATCH] D78032: [llvm-objdump] Default to the "apple-latest" mcpu when disassembling arm64 Mach-O binaries

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 11:17:54 PDT 2020


MaskRay added a comment.

In GNU objdump, `-m` is another option which takes an argument.

  -m machine
   --architecture=machine
       Specify the architecture to use when disassembling object files.  This can be useful when disassembling object files which do not
       describe architecture information, such as S-records.  You can list the available architectures with the -i option.
  
       If the target is an ARM architecture then this switch has an additional effect.  It restricts the disassembly to only those
       instructions supported by the architecture specified by machine.  If it is necessary to use this switch because the input file does not
       contain any architecture information, but it is also desired to disassemble all the instructions use -marm.

Would it be possible to remove the `-m` alias for `--macho`?



================
Comment at: llvm/test/tools/llvm-objdump/MachO/apple-latest-default.s:2
+// RUN: llvm-mc -triple arm64-apple-ios -mattr=+apple-a13 -show-encoding \
+// RUN: -filetype=obj %s -o - 2> %t | llvm-objdump -m -d - | FileCheck %s
+
----------------
Add a comment about the purpose of the test.

```
## I would prefer comments starting with ##
# RUN: # is for RUN and CHECK lines
# CHECK: ...
```

Delete `-show-encoding` which is a no-op with the object output (`-filetype=obj`)

Prefer `--macho` to `-m`. It looks strange to me that without `--macho`, the instruction cannot be decoded (`<unknown>`). I did not expect the `--macho` flag should matter here.

Delete `2> %t` because stderr is not needed by the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78032





More information about the llvm-commits mailing list