[llvm] [llvm-objdump] Support --mcpu=help/--mattr=help without -d (PR #165661)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 03:27:22 PST 2025


================
@@ -1,12 +1,38 @@
 # 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
+# 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
+
+## We should be able to retrieve help message without -d.
+# RUN: llvm-objdump --mattr=help %t 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK
+# RUN: llvm-objdump --mcpu=help %t 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK
+
+## 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 error when we can't infer triple.
+# RUN: not llvm-objdump --mattr=help 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-ERROR
+# RUN: not llvm-objdump --mcpu=help 2>&1 \
+# RUN:   | FileCheck %s --check-prefix=CHECK-ERROR
+
 # REQUIRES: x86-registered-target
----------------
jh7370 wrote:

Let's move this to the start of the file, as is traditional for `REQUIRES` statements.

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


More information about the llvm-commits mailing list