summaryrefslogtreecommitdiffstats
path: root/libunwind
diff options
context:
space:
mode:
authorLuke Cheeseman <luke.cheeseman@arm.com>2018-12-17 11:43:24 +0000
committerLuke Cheeseman <luke.cheeseman@arm.com>2018-12-17 11:43:24 +0000
commit357973192d2eb45aa8c36b02cfef84d5d533d9d0 (patch)
tree847f177004c557850d20b09d8aa17dcd1bcb1636 /libunwind
parent490ae11717b8da8c50a6d73e6c392df8dfd28553 (diff)
downloadbcm5719-llvm-357973192d2eb45aa8c36b02cfef84d5d533d9d0.tar.gz
bcm5719-llvm-357973192d2eb45aa8c36b02cfef84d5d533d9d0.zip
[AArch64][libunwind] Unwinding support for return address signing with B Key
- Support for the case where the return address has been signed with the B key - When the B key is used, a 'B' character is present in the augmentation string of CIE associated with the FDE for the function. Differential Revision: https://reviews.llvm.org/D55704 llvm-svn: 349339
Diffstat (limited to 'libunwind')
-rw-r--r--libunwind/src/DwarfInstructions.hpp10
-rw-r--r--libunwind/src/DwarfParser.hpp11
2 files changed, 18 insertions, 3 deletions
diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp
index 2bf19c56332..1d35b228c40 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -211,9 +211,13 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
register unsigned long long x17 __asm("x17") = returnAddress;
register unsigned long long x16 __asm("x16") = cfa;
- // This is the autia1716 instruction. The hint instruction is used here
- // as gcc does not assemble autia1716 for pre armv8.3a targets.
- asm("hint 0xc": "+r"(x17): "r"(x16));
+ // These are the autia1716/autib1716 instructions. The hint instructions
+ // are used here as gcc does not assemble autia1716/autib1716 for pre
+ // armv8.3a targets.
+ if (cieInfo.addressesSignedWithBKey)
+ asm("hint 0xe" : "+r"(x17) : "r"(x16)); // autib1716
+ else
+ asm("hint 0xc" : "+r"(x17) : "r"(x16)); // autia1716
returnAddress = x17;
#endif
}
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp
index 68506a35053..9de2898c075 100644
--- a/libunwind/src/DwarfParser.hpp
+++ b/libunwind/src/DwarfParser.hpp
@@ -49,6 +49,9 @@ public:
bool isSignalFrame;
bool fdesHaveAugmentationData;
uint8_t returnAddressRegister;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+ bool addressesSignedWithBKey;
+#endif
};
/// Information about an FDE (Frame Description Entry)
@@ -263,6 +266,9 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
cieInfo->dataAlignFactor = 0;
cieInfo->isSignalFrame = false;
cieInfo->fdesHaveAugmentationData = false;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+ cieInfo->addressesSignedWithBKey = false;
+#endif
cieInfo->cieStart = cie;
pint_t p = cie;
pint_t cieLength = (pint_t)addressSpace.get32(p);
@@ -326,6 +332,11 @@ const char *CFI_Parser<A>::parseCIE(A &addressSpace, pint_t cie,
case 'S':
cieInfo->isSignalFrame = true;
break;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+ case 'B':
+ cieInfo->addressesSignedWithBKey = true;
+ break;
+#endif
default:
// ignore unknown letters
break;
OpenPOWER on IntegriCloud