[ELF] Support 'G' in .eh_frame
authorFlorian Mayer <fmayer@google.com>
Wed, 8 Jun 2022 21:22:04 +0000 (14:22 -0700)
committerFlorian Mayer <fmayer@google.com>
Wed, 8 Jun 2022 21:28:58 +0000 (14:28 -0700)
Reviewed By: MaskRay, eugenis

Differential Revision: https://reviews.llvm.org/D127148

lld/ELF/EhFrame.cpp
lld/test/ELF/stack-tagging-cfi.s [new file with mode: 0644]

index 794fe04..f2fc99f 100644 (file)
@@ -171,7 +171,7 @@ uint8_t EhReader::getFdeEncoding() {
       readByte();
     else if (c == 'P')
       skipAugP();
-    else if (c != 'B' && c != 'S')
+    else if (c != 'B' && c != 'S' && c != 'G')
       failOn(aug.data(), "unknown .eh_frame augmentation string: " + aug);
   }
   return DW_EH_PE_absptr;
@@ -188,7 +188,7 @@ bool EhReader::hasLSDA() {
       skipAugP();
     else if (c == 'R')
       readByte();
-    else if (c != 'B' && c != 'S')
+    else if (c != 'B' && c != 'S' && c != 'G')
       failOn(aug.data(), "unknown .eh_frame augmentation string: " + aug);
   }
   return false;
diff --git a/lld/test/ELF/stack-tagging-cfi.s b/lld/test/ELF/stack-tagging-cfi.s
new file mode 100644 (file)
index 0000000..82ed2f5
--- /dev/null
@@ -0,0 +1,19 @@
+# REQUIRES: aarch64
+
+# RUN: llvm-mc -filetype=obj -triple aarch64 -mattr=+mte %s -o %t.o
+# RUN: ld.lld --eh-frame-hdr %t.o -o %t
+# RUN: llvm-objdump --dwarf=frames %t | FileCheck %s
+
+# CHECK: Augmentation:          "zRG"
+
+       .text
+       .globl  WithUnwind
+       .p2align        2
+       .type   WithUnwind,@function
+WithUnwind:
+       .cfi_startproc
+       .cfi_mte_tagged_frame
+       ret
+.Lfunc_end0:
+       .size   WithUnwind, .Lfunc_end0-WithUnwind
+       .cfi_endproc