Skip to content

Commit 088e74c

Browse files
[llvm][llvm-readobj] Add NT_ARM_GCS Linux core note type (#117545)
The ARM Guarded Control Stack extension (GCS) is similar to existing shadow stack extensions for other architectures. The core note will include which features of GCS are enabled, which have been locked in their current state, and the stack pointer of the shadow stack. Note that 0x40f is NT_ARM_POE, FPMR is supported by LLDB and GCS will be soon, POE is not at this time. So NT_ARM_POE will be added when that work starts. See https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h.
1 parent 4dde52d commit 088e74c

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

llvm/include/llvm/BinaryFormat/ELF.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ enum : unsigned {
17241724
NT_ARM_ZA = 0x40c,
17251725
NT_ARM_ZT = 0x40d,
17261726
NT_ARM_FPMR = 0x40e,
1727+
NT_ARM_GCS = 0x410,
17271728

17281729
NT_FILE = 0x46494c45,
17291730
NT_PRXFPREG = 0x46e62b7f,

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_NT>::enumeration(
136136
ECase(NT_ARM_ZA);
137137
ECase(NT_ARM_ZT);
138138
ECase(NT_ARM_FPMR);
139+
ECase(NT_ARM_GCS);
139140
ECase(NT_FILE);
140141
ECase(NT_PRXFPREG);
141142
ECase(NT_SIGINFO);

llvm/test/tools/llvm-readobj/ELF/note-core.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@
265265
# RUN: llvm-readelf --notes %t_nt_arm_fpmr.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_FPMR (AArch64 Floating Point Mode Register)"
266266
# RUN: llvm-readobj --notes %t_nt_arm_fpmr.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_FPMR (AArch64 Floating Point Mode Register)"
267267

268+
## Check ELF::NT_ARM_GCS
269+
# RUN: yaml2obj %s -DTYPE=0x410 -o %t_nt_arm_gcs.o
270+
# RUN: llvm-readelf --notes %t_nt_arm_gcs.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_ARM_GCS (AArch64 Guarded Control Stack state)"
271+
# RUN: llvm-readobj --notes %t_nt_arm_gcs.o | FileCheck %s --check-prefix=CHECK-LLVM -DDESC="NT_ARM_GCS (AArch64 Guarded Control Stack state)"
272+
268273
## Check ELF::NT_FILE.
269274
# RUN: yaml2obj %s -DTYPE=0x46494c45 -o %t_nt_file.o
270275
# RUN: llvm-readelf --notes %t_nt_file.o | FileCheck %s --check-prefix=CHECK-GNU -DDESC="NT_FILE (mapped files)"

llvm/tools/llvm-readobj/ELFDumper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6057,6 +6057,7 @@ const NoteType CoreNoteTypes[] = {
60576057
{ELF::NT_ARM_ZA, "NT_ARM_ZA (AArch64 SME ZA registers)"},
60586058
{ELF::NT_ARM_ZT, "NT_ARM_ZT (AArch64 SME ZT registers)"},
60596059
{ELF::NT_ARM_FPMR, "NT_ARM_FPMR (AArch64 Floating Point Mode Register)"},
6060+
{ELF::NT_ARM_GCS, "NT_ARM_GCS (AArch64 Guarded Control Stack state)"},
60606061

60616062
{ELF::NT_FILE, "NT_FILE (mapped files)"},
60626063
{ELF::NT_PRXFPREG, "NT_PRXFPREG (user_xfpregs structure)"},

0 commit comments

Comments
 (0)