[llvm] c950ba7 - [llvm][readobj] Add AArch64 SME and SME2 note types
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 05:17:44 PDT 2023
Author: David Spickett
Date: 2023-04-13T13:17:38+01:00
New Revision: c950ba7d4898f63cb7734482b4dfa38ade6f685b
URL: https://github.com/llvm/llvm-project/commit/c950ba7d4898f63cb7734482b4dfa38ade6f685b
DIFF: https://github.com/llvm/llvm-project/commit/c950ba7d4898f63cb7734482b4dfa38ade6f685b.diff
LOG: [llvm][readobj] Add AArch64 SME and SME2 note types
These are used to store new state added by the Scalable Matrix
Extension which is documented in
https://developer.arm.com/documentation/ddi0616/aa/.
The values match those defined by Linux, see:
https://github.com/torvalds/linux/blob/e62252bc55b6d4eddc6c2bdbf95a448180d6a08d/include/uapi/linux/elf.h#L435
The ZT register(s) are added by SME2 which is not yet publicly
documented but has support in LLVM and Linux already.
Also added descriptions for SVE and PAC_MASK notes since those
were missing.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D148126
Added:
Modified:
llvm/include/llvm/BinaryFormat/ELF.h
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/llvm-readobj/ELF/note-core.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index 75f0c960beea0..bb98265d60bea 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -1604,6 +1604,9 @@ enum : unsigned {
NT_ARM_HW_WATCH = 0x403,
NT_ARM_SVE = 0x405,
NT_ARM_PAC_MASK = 0x406,
+ NT_ARM_SSVE = 0x40b,
+ NT_ARM_ZA = 0x40c,
+ NT_ARM_ZT = 0x40d,
NT_FILE = 0x46494c45,
NT_PRXFPREG = 0x46e62b7f,
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 826bd05632511..430923b1b90fe 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -131,6 +131,9 @@ void ScalarEnumerationTraits<ELFYAML::ELF_NT>::enumeration(
ECase(NT_ARM_HW_WATCH);
ECase(NT_ARM_SVE);
ECase(NT_ARM_PAC_MASK);
+ ECase(NT_ARM_SSVE);
+ ECase(NT_ARM_ZA);
+ ECase(NT_ARM_ZT);
ECase(NT_FILE);
ECase(NT_PRXFPREG);
ECase(NT_SIGINFO);
diff --git a/llvm/test/tools/llvm-readobj/ELF/note-core.test b/llvm/test/tools/llvm-readobj/ELF/note-core.test
index 2dbee21365eb0..4c79460f946ab 100644
--- a/llvm/test/tools/llvm-readobj/ELF/note-core.test
+++ b/llvm/test/tools/llvm-readobj/ELF/note-core.test
@@ -230,25 +230,50 @@
# RUN: llvm-readelf --notes %t46.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_HW_WATCH (AArch hardware watchpoint registers)"
# RUN: llvm-readobj --notes %t46.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_HW_WATCH (AArch hardware watchpoint registers)"
+## Check ELF::NT_ARM_SVE
+# RUN: yaml2obj %s -DTYPE=0x405 -o %t47.o
+# RUN: llvm-readelf --notes %t47.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_SVE (AArch64 SVE registers)"
+# RUN: llvm-readobj --notes %t47.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_SVE (AArch64 SVE registers)"
+
+## Check ELF::NT_ARM_PAC_MASK
+# RUN: yaml2obj %s -DTYPE=0x406 -o %t48.o
+# RUN: llvm-readelf --notes %t48.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_PAC_MASK (AArch64 Pointer Authentication code masks)"
+# RUN: llvm-readobj --notes %t48.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_PAC_MASK (AArch64 Pointer Authentication code masks)"
+
+## Check ELF::NT_ARM_SSVE
+# RUN: yaml2obj %s -DTYPE=0x40b -o %t49.o
+# RUN: llvm-readelf --notes %t49.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_SSVE (AArch64 Streaming SVE registers)"
+# RUN: llvm-readobj --notes %t49.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_SSVE (AArch64 Streaming SVE registers)"
+
+## Check ELF::NT_ARM_ZA
+# RUN: yaml2obj %s -DTYPE=0x40c -o %t50.o
+# RUN: llvm-readelf --notes %t50.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_ZA (AArch64 SME ZA registers)"
+# RUN: llvm-readobj --notes %t50.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_ZA (AArch64 SME ZA registers)"
+
+## Check ELF::NT_ARM_ZT
+# RUN: yaml2obj %s -DTYPE=0x40d -o %t51.o
+# RUN: llvm-readelf --notes %t51.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_ZT (AArch64 SME ZT registers)"
+# RUN: llvm-readobj --notes %t51.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_ZT (AArch64 SME ZT registers)"
+
## Check ELF::NT_FILE.
-# RUN: yaml2obj %s -DTYPE=0x46494c45 -o %t47.o
-# RUN: llvm-readelf --notes %t47.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_FILE (mapped files)"
-# RUN: llvm-readobj --notes %t47.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_FILE (mapped files)"
+# RUN: yaml2obj %s -DTYPE=0x46494c45 -o %t52.o
+# RUN: llvm-readelf --notes %t52.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_FILE (mapped files)"
+# RUN: llvm-readobj --notes %t52.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_FILE (mapped files)"
## Check ELF::NT_PRXFPREG.
-# RUN: yaml2obj %s -DTYPE=0x46e62b7f -o %t48.o
-# RUN: llvm-readelf --notes %t48.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_PRXFPREG (user_xfpregs structure)"
-# RUN: llvm-readobj --notes %t48.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_PRXFPREG (user_xfpregs structure)"
+# RUN: yaml2obj %s -DTYPE=0x46e62b7f -o %t53.o
+# RUN: llvm-readelf --notes %t53.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_PRXFPREG (user_xfpregs structure)"
+# RUN: llvm-readobj --notes %t53.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_PRXFPREG (user_xfpregs structure)"
## Check ELF::NT_SIGINFO.
-# RUN: yaml2obj %s -DTYPE=0x53494749 -o %t49.o
-# RUN: llvm-readelf --notes %t49.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_SIGINFO (siginfo_t data)"
-# RUN: llvm-readobj --notes %t49.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_SIGINFO (siginfo_t data)"
+# RUN: yaml2obj %s -DTYPE=0x53494749 -o %t54.o
+# RUN: llvm-readelf --notes %t54.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_SIGINFO (siginfo_t data)"
+# RUN: llvm-readobj --notes %t54.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_SIGINFO (siginfo_t data)"
## Check an arbitrary unknown type.
-# RUN: yaml2obj %s -DTYPE=0x12345678 -o %t50.o
-# RUN: llvm-readelf --notes %t50.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="Unknown note type: (0x12345678)"
-# RUN: llvm-readobj --notes %t50.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="Unknown (0x12345678)"
+# RUN: yaml2obj %s -DTYPE=0x12345678 -o %t55.o
+# RUN: llvm-readelf --notes %t55.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="Unknown note type: (0x12345678)"
+# RUN: llvm-readobj --notes %t55.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="Unknown (0x12345678)"
# CHECK-GNU: Owner Data size Description
# CHECK-GNU-NEXT: CORE 0x00000000 [[DESC]]
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 3199188f30c83..517514f102366 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -5751,6 +5751,12 @@ const NoteType CoreNoteTypes[] = {
"NT_ARM_HW_BREAK (AArch hardware breakpoint registers)"},
{ELF::NT_ARM_HW_WATCH,
"NT_ARM_HW_WATCH (AArch hardware watchpoint registers)"},
+ {ELF::NT_ARM_SVE, "NT_ARM_SVE (AArch64 SVE registers)"},
+ {ELF::NT_ARM_PAC_MASK,
+ "NT_ARM_PAC_MASK (AArch64 Pointer Authentication code masks)"},
+ {ELF::NT_ARM_SSVE, "NT_ARM_SSVE (AArch64 Streaming SVE registers)"},
+ {ELF::NT_ARM_ZA, "NT_ARM_ZA (AArch64 SME ZA registers)"},
+ {ELF::NT_ARM_ZT, "NT_ARM_ZT (AArch64 SME ZT registers)"},
{ELF::NT_FILE, "NT_FILE (mapped files)"},
{ELF::NT_PRXFPREG, "NT_PRXFPREG (user_xfpregs structure)"},
More information about the llvm-commits
mailing list