Author: lukecheeseman Date: Mon Dec 17 03:43:24 2018 New Revision: 349339 URL: http://llvm.org/viewvc/llvm-project?rev=349339&view=rev Log: [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 Modified: libunwind/trunk/src/DwarfInstructions.hpp libunwind/trunk/src/DwarfParser.hpp Modified: libunwind/trunk/src/DwarfInstructions.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=349339&r1=349338&r2=349339&view=diff ============================================================================== --- libunwind/trunk/src/DwarfInstructions.hpp (original) +++ libunwind/trunk/src/DwarfInstructions.hpp Mon Dec 17 03:43:24 2018 @@ -211,9 +211,13 @@ int DwarfInstructions<A, R>::stepWithDwa 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 } Modified: libunwind/trunk/src/DwarfParser.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfParser.hpp?rev=349339&r1=349338&r2=349339&view=diff ============================================================================== --- libunwind/trunk/src/DwarfParser.hpp (original) +++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 17 03:43:24 2018 @@ -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 &a 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 &a case 'S': cieInfo->isSignalFrame = true; break; +#if defined(_LIBUNWIND_TARGET_AARCH64) + case 'B': + cieInfo->addressesSignedWithBKey = true; + break; +#endif default: // ignore unknown letters break; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits