[llvm] [llvm-objdump] Add triple support to `mcpu=help` (PR #165661)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 23:49:37 PST 2025


================
@@ -0,0 +1,64 @@
+# RUN: yaml2obj %s -o %t
+# REQUIRES: arm-registered-target,x86-registered-target
+
+
+# CHECK-HELP: Available CPUs for this target:
+# CHECK-ARM: arm
+# CHECK-X86: i386
+# CHECK-HELP: Available features for this target:
+## To check we still disassemble the file:
+# CHECK-DISASM: file format elf32-littlearm
+# CHECK-SECTION-HEADER: Sections:
+# CHECK-SECTION-HEADER: Idx Name            Size     VMA      Type
+## Don't check the OS-dependent message "No such file or directory".
+# CHECK-FILE-ISSUE: error: 'a.out':
+
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS32
+  Data:            ELFDATA2LSB
+  Type:            ET_EXEC
+  Machine:         EM_ARM
+
+## 2. -d + --mcpu=help + a.out
+## Check the error if there is an issue with the file.
+# RUN: not llvm-objdump -d --mcpu=help 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-FILE-ISSUE
+# RUN: not llvm-objdump -d --mattr=help 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-FILE-ISSUE
+
+## Check if we can handle the default filename.
+# RUN: cp %t a.out
+# RUN: llvm-objdump -d --mcpu=help --section-headers 2>&1 \
+# RUN:   | FileCheck %s --check-prefixes=CHECK-HELP,CHECK-ARM,CHECK-DISASM,CHECK-SECTION-HEADER
+# RUN: llvm-objdump -d --mattr=help --section-headers 2>&1 \
+# RUN:   | FileCheck %s --check-prefixes=CHECK-HELP,CHECK-ARM,CHECK-DISASM,CHECK-SECTION-HEADER
+# RUN: rm a.out
----------------
jh7370 wrote:

To be clear, when I say "ensure there is [adequate] test coverage", I mean "check if test coverage exists and if not, add it", so yes, assuming that test case doesn't exist, it should be added (to the pre-existing test file, because it doesn't have anything to do with `--triple`).

https://github.com/llvm/llvm-project/pull/165661


More information about the llvm-commits mailing list