[unit tests] Add '-mbranch-protection=standard' flag to arm64
This change adds standard branch protection to bionic unit tests
for arm64 targets. For more information see
https://developer.arm.com/search#q=branch-protection
Both Armv8.3-A Pointer Authentication (using the A-key) hint-space
instructions and Armv8.5-A Branch Target Identification hint-space
landing pads are added to the generated code.
Test: 1. Tested on flame
2. Tested on FVP
Change-Id: Ice991c538a9101448dea64c357f3f6bfb93877eb
diff --git a/tests/Android.bp b/tests/Android.bp
index d1afd51..b840f36 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -39,10 +39,14 @@
"-D__STDC_LIMIT_MACROS",
],
header_libs: ["bionic_libc_platform_headers"],
- // Make the bionic tests implicitly test bionic's shadow call stack support.
+ // Ensure that the tests exercise shadow call stack support and
+ // the hint space PAC/BTI instructions.
arch: {
arm64: {
- cflags: ["-fsanitize=shadow-call-stack"],
+ cflags: [
+ "-fsanitize=shadow-call-stack",
+ "-mbranch-protection=standard",
+ ],
},
},
stl: "libc++",