From aed84542d5a05b415a9a7f54494107aea8bd7e89 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 30 Dec 2020 22:11:45 -0800 Subject: [PATCH] ELF: Teach the linker about the 'B' augmentation string character. This character indicates that when return pointer authentication is being used, the function signs the return address using the B key. Differential Revision: https://reviews.llvm.org/D93954 --- lld/ELF/EhFrame.cpp | 4 ++-- lld/test/ELF/eh-frame-cfi-b-key.s | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 lld/test/ELF/eh-frame-cfi-b-key.s diff --git a/lld/ELF/EhFrame.cpp b/lld/ELF/EhFrame.cpp index 13f0484ff9e4..578c640f0214 100644 --- a/lld/ELF/EhFrame.cpp +++ b/lld/ELF/EhFrame.cpp @@ -194,7 +194,7 @@ uint8_t EhReader::getFdeEncoding() { readByte(); else if (c == 'P') skipAugP(); - else if (c != 'S') + else if (c != 'B' && c != 'S') failOn(aug.data(), "unknown .eh_frame augmentation string: " + aug); } return DW_EH_PE_absptr; @@ -211,7 +211,7 @@ bool EhReader::hasLSDA() { skipAugP(); else if (c == 'R') readByte(); - else if (c != 'S') + else if (c != 'B' && c != 'S') failOn(aug.data(), "unknown .eh_frame augmentation string: " + aug); } return false; diff --git a/lld/test/ELF/eh-frame-cfi-b-key.s b/lld/test/ELF/eh-frame-cfi-b-key.s new file mode 100644 index 000000000000..406674e8b5c8 --- /dev/null +++ b/lld/test/ELF/eh-frame-cfi-b-key.s @@ -0,0 +1,9 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc -filetype=obj -triple aarch64-arm-none-eabi %s -o %t.o +// RUN: ld.lld %t.o -o %t --icf=all --eh-frame-hdr + +.globl _start +_start: +.cfi_startproc +.cfi_b_key_frame +.cfi_endproc