[lld] f6b1bfb - [ELF] Support 'G' in .eh_frame

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 14:29:03 PDT 2022


Author: Florian Mayer
Date: 2022-06-08T14:28:58-07:00
New Revision: f6b1bfb7d5cc5201f5910c7e11766abc279a1f7a

URL: https://github.com/llvm/llvm-project/commit/f6b1bfb7d5cc5201f5910c7e11766abc279a1f7a
DIFF: https://github.com/llvm/llvm-project/commit/f6b1bfb7d5cc5201f5910c7e11766abc279a1f7a.diff

LOG: [ELF] Support 'G' in .eh_frame

Reviewed By: MaskRay, eugenis

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

Added: 
    lld/test/ELF/stack-tagging-cfi.s

Modified: 
    lld/ELF/EhFrame.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/EhFrame.cpp b/lld/ELF/EhFrame.cpp
index 794fe04346a99..f2fc99fe350c0 100644
--- a/lld/ELF/EhFrame.cpp
+++ b/lld/ELF/EhFrame.cpp
@@ -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
index 0000000000000..82ed2f5a9d923
--- /dev/null
+++ b/lld/test/ELF/stack-tagging-cfi.s
@@ -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, at function
+WithUnwind:
+	.cfi_startproc
+	.cfi_mte_tagged_frame
+	ret
+.Lfunc_end0:
+	.size	WithUnwind, .Lfunc_end0-WithUnwind
+	.cfi_endproc


        


More information about the llvm-commits mailing list