[llvm] [llvm-objdump] Default to --mattr=+all for AArch64be and AArch64_32 (PR #118311)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 07:46:04 PST 2024


https://github.com/hstk30-hw created https://github.com/llvm/llvm-project/pull/118311

GNU objdump disassembles all unknown instructions by default. 
Complement for [D128030](https://reviews.llvm.org/D128030)。

>From 267650bbb2aaf6ed17f507bd9a7faf9e3e15725a Mon Sep 17 00:00:00 2001
From: hstk30 <hanwei62 at huawei.com>
Date: Mon, 2 Dec 2024 22:30:49 +0800
Subject: [PATCH] [llvm-objdump] Default to --mattr=+all for AArch64be and
 AArch64_32

---
 llvm/test/tools/llvm-objdump/ELF/AArch64/mattr.s | 4 ++++
 llvm/tools/llvm-objdump/llvm-objdump.cpp         | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/mattr.s b/llvm/test/tools/llvm-objdump/ELF/AArch64/mattr.s
index e236660770648a..5fd77b579984af 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AArch64/mattr.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/mattr.s
@@ -1,6 +1,10 @@
 ## When --mattr and --mcpu are both empty, disassemble all known instructions.
 # RUN: llvm-mc -filetype=obj -triple=aarch64 -mattr=+all %s -o %t
 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefixes=CHECK,ALL
+# RUN: llvm-mc -filetype=obj -triple=aarch64_be -mattr=+all %s -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefixes=CHECK,ALL
+# RUN: llvm-mc -filetype=obj -triple=aarch64_32 -mattr=+all %s -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefixes=CHECK,ALL
 
 ## If --mattr or --mcpu is specified, don't default to --mattr=+all.
 # RUN: llvm-objdump -d --no-show-raw-insn --mattr=+v8a %t | FileCheck %s --check-prefixes=CHECK,UNKNOWN
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 86ba9193dff2d1..246d5cfa05818a 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2556,7 +2556,7 @@ static void disassembleObject(ObjectFile *Obj, bool InlineRelocs) {
   if (!MAttrs.empty()) {
     for (unsigned I = 0; I != MAttrs.size(); ++I)
       Features.AddFeature(MAttrs[I]);
-  } else if (MCPU.empty() && Obj->getArch() == llvm::Triple::aarch64) {
+  } else if (MCPU.empty() && Obj->makeTriple().isAArch64()) {
     Features.AddFeature("+all");
   }
 



More information about the llvm-commits mailing list