diff mbox series

[meta-oe] abseil-cpp: Backport `xpaclri` asm fix

Message ID 20250301103611.28262-1-alex.kiernan@gmail.com
State Accepted
Headers show
Series [meta-oe] abseil-cpp: Backport `xpaclri` asm fix | expand

Commit Message

Alex Kiernan March 1, 2025, 10:36 a.m. UTC
Native build on aarch64 breaks with:

| {standard input}: Assembler messages:
| {standard input}:169: Error: selected processor does not support `xpaclri'
| {standard input}:411: Error: selected processor does not support `xpaclri'
| {standard input}:859: Error: selected processor does not support `xpaclri'
| {standard input}:1140: Error: selected processor does not support `xpaclri'

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@a-squared-projects.uk>
---
 ...-hint-space-instruction-to-strip-PAC.patch | 32 +++++++++++++++++++
 .../abseil-cpp/abseil-cpp_20250127.0.bb       |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Actually-use-the-hint-space-instruction-to-strip-PAC.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Actually-use-the-hint-space-instruction-to-strip-PAC.patch b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Actually-use-the-hint-space-instruction-to-strip-PAC.patch
new file mode 100644
index 000000000000..a235797de917
--- /dev/null
+++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Actually-use-the-hint-space-instruction-to-strip-PAC.patch
@@ -0,0 +1,32 @@ 
+From 5852b47a81e5334a667d1e12dbfa55c0f8111100 Mon Sep 17 00:00:00 2001
+From: Derek Mauro <dmauro@google.com>
+Date: Fri, 7 Feb 2025 08:49:06 -0800
+Subject: [PATCH] Actually use the hint space instruction to strip PAC bits for
+ return addresses in stack traces as the comment says
+
+https://android.googlesource.com/platform/libcore/+/71f2c75111e87091616f0f3b86bea6c4d345dad1/src/hotspot/os_cpu/linux_aarch64/pauth_linux_aarch64.inline.hpp
+
+PiperOrigin-RevId: 724360415
+Change-Id: I691160e43354131a04919765ce283e07c3c933a9
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+Signed-off-by: Alex Kiernan <alexk@a-squared-projects.uk>
+Upstream-Status: Backport [https://github.com/abseil/abseil-cpp/commit/5852b47a81e5334a667d1e12dbfa55c0f8111100]
+---
+ absl/debugging/internal/stacktrace_aarch64-inl.inc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc
+index 4490c4e13cae..dccadaeb7c24 100644
+--- a/absl/debugging/internal/stacktrace_aarch64-inl.inc
++++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc
+@@ -188,7 +188,9 @@ inline void* ClearPacBits(void* ptr) {
+   // compatibility with ARM platforms that do not support pointer
+   // authentication, we use the hint space instruction XPACLRI instead. Hint
+   // space instructions behave as NOPs on unsupported platforms.
+-  asm("xpaclri" : "+r"(x30));
++#define ABSL_XPACLRI_HINT "hint #0x7;"
++  asm(ABSL_XPACLRI_HINT : "+r"(x30));  // asm("xpaclri" : "+r"(x30));
++#undef ABSL_XPACLRI_HINT
+   return x30;
+ }
+ 
diff --git a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.0.bb b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.0.bb
index 88e20c05776e..f217d4daf889 100644
--- a/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.0.bb
+++ b/meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20250127.0.bb
@@ -14,6 +14,7 @@  SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH};protocol=https \
            file://0002-Remove-maes-option-from-cross-compilation.patch \
            file://0003-Remove-neon-option-from-cross-compilation.patch \
            file://0004-abseil-ppc-fixes.patch \
+           file://0001-Actually-use-the-hint-space-instruction-to-strip-PAC.patch \
           "
 
 S = "${WORKDIR}/git"