[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.
----------------
jh7370 wrote:

```suggestion
## We report an error when we can't infer the triple because we don't have --triple or an input object (including a.out).
```
Let's be explicit why we can't infer the triple, while also pointing out that we haven't forgotten that a.out is the default input file.

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


More information about the llvm-commits mailing list