summaryrefslogtreecommitdiffstats
path: root/llvm/lib/BinaryFormat/Dwarf.cpp
diff options
context:
space:
mode:
authorLuke Cheeseman <luke.cheeseman@arm.com>2018-09-26 10:14:15 +0000
committerLuke Cheeseman <luke.cheeseman@arm.com>2018-09-26 10:14:15 +0000
commitf755e687fce0485e3117ef843ee7a27991cc5b1b (patch)
tree835458746b37da7c95a7df4331e1aadf2ff0fc80 /llvm/lib/BinaryFormat/Dwarf.cpp
parent4e8337e001ac2e0cf96f4cacdbdf4df227d7b27e (diff)
downloadbcm5719-llvm-f755e687fce0485e3117ef843ee7a27991cc5b1b.tar.gz
bcm5719-llvm-f755e687fce0485e3117ef843ee7a27991cc5b1b.zip
[AArch64] - Return address signing dwarf support
Functions that have signed return addresses need additional dwarf support: - After signing the LR, and before authenticating it, the LR register is in a state the is unusable by a debugger or unwinder - To account for this a new directive, .cfi_negate_ra_state, is added - This directive says the signed state of the LR register has now changed, i.e. unsigned -> signed or signed -> unsigned - This directive has the same CFA code as the SPARC directive GNU_window_save (0x2d), adding a macro to account for multiply defined codes - This patch matches the gcc implementation of this support: https://patchwork.ozlabs.org/patch/800271/ Differential Revision: https://reviews.llvm.org/D50136 llvm-svn: 343089
Diffstat (limited to 'llvm/lib/BinaryFormat/Dwarf.cpp')
-rw-r--r--llvm/lib/BinaryFormat/Dwarf.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index 5984de73ae6..46b95275395 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -13,6 +13,7 @@
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@@ -455,14 +456,31 @@ StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) {
}
}
-StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
+StringRef llvm::dwarf::CallFrameString(unsigned Encoding,
+ Triple::ArchType Arch) {
+#define SELECT_AARCH64 (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64)
+#define SELECT_MIPS64 Arch == llvm::Triple::mips64
+#define SELECT_SPARC64 Arch == llvm::Triple::sparcv9
+#define SELECT_X86 (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64)
+#define HANDLE_DW_CFA(ID, NAME)
+#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \
+ if (ID == Encoding && PRED) \
+ return "DW_CFA_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+
switch (Encoding) {
default:
return StringRef();
+#define HANDLE_DW_CFA_PRED(ID, NAME, PRED)
#define HANDLE_DW_CFA(ID, NAME) \
case DW_CFA_##NAME: \
return "DW_CFA_" #NAME;
#include "llvm/BinaryFormat/Dwarf.def"
+
+#undef SELECT_X86
+#undef SELECT_SPARC64
+#undef SELECT_MIPS64
+#undef SELECT_AARCH64
}
}
OpenPOWER on IntegriCloud