[llvm] [llvm-objdump] Support --mcpu=help/--mattr=help without -d (PR #165661)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 15 00:39:04 PST 2025
================
@@ -1,16 +1,66 @@
# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -d %t --mattr=help 2>&1 | FileCheck %s
-# RUN: llvm-objdump -d %t --mcpu=help 2>&1 | FileCheck %s
# REQUIRES: x86-registered-target
+# RUN: llvm-objdump -d %t --mattr=help 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DISASSEMBLE
+# RUN: llvm-objdump -d %t --mcpu=help 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-DISASSEMBLE
+
+## The help message can be printed without -d.
+# RUN: llvm-objdump --mattr=help %t 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NO-DISASSEMBLE
+# RUN: llvm-objdump --mcpu=help %t 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NO-DISASSEMBLE
+
+## We still handle other options.
+# RUN: llvm-objdump --mattr=help --section-headers %t 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-SECTION-HEADERS
+# RUN: llvm-objdump --mcpu=help --section-headers %t 2>&1 \
+# RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-SECTION-HEADERS
+
+## We report an error when we can't infer the triple because we don't have --triple or an input object (including a.out).
+# RUN: not llvm-objdump --mattr=help 2>&1 \
+# RUN: | FileCheck %s --check-prefix=CHECK-MISSING-ERROR --implicit-check-not=error: -DMSG=%errc_ENOENT
+# RUN: not llvm-objdump --mcpu=help 2>&1 \
+# RUN: | FileCheck %s --check-prefix=CHECK-MISSING-ERROR --implicit-check-not=error: -DMSG=%errc_ENOENT
+
+# RUN: yaml2obj --docnum=2 %s -o %t.minidump
+## We report an error when the binary file isn't an object file format.
+# RUN: not llvm-objdump --mattr=help %t.minidump 2>&1 \
+# RUN: | FileCheck %s --check-prefix=CHECK-UNSUPPORTED-ERROR --implicit-check-not=error: -DFILE=%t.minidump
+# RUN: not llvm-objdump --mcpu=help %t.minidump 2>&1 \
+# RUN: | FileCheck %s --check-prefix=CHECK-UNSUPPORTED-ERROR --implicit-check-not=error: -DFILE=%t.minidump
+
+# RUN: llvm-ar rcs %t.a %t
----------------
jh7370 wrote:
The `s` part of the archive command is unnecessary for the test case, so delete it.
https://github.com/llvm/llvm-project/pull/165661
More information about the llvm-commits
mailing list