[compiler-rt] [llvm] Reapply "compiler-rt: Introduce runtime functions for emulated PAC." (PR #148094)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 10 18:00:35 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,c,h -- compiler-rt/lib/builtins/aarch64/emupac.cpp compiler-rt/test/builtins/Unit/aarch64/emupac.c compiler-rt/lib/builtins/int_types.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/builtins/aarch64/emupac.cpp b/compiler-rt/lib/builtins/aarch64/emupac.cpp
index 62c551971..eb7de9ff6 100644
--- a/compiler-rt/lib/builtins/aarch64/emupac.cpp
+++ b/compiler-rt/lib/builtins/aarch64/emupac.cpp
@@ -97,8 +97,8 @@ static const uint8_t emu_da_key[16] = {0xb5, 0xd4, 0xc9, 0xeb, 0x79, 0x10,
0x4a, 0x79, 0x6f, 0xec, 0x8b, 0x1b,
0x42, 0x87, 0x81, 0xd4};
-extern "C" [[gnu::flatten]] uint64_t
-__emupac_pacda_impl(uint64_t ptr, uint64_t disc) {
+extern "C" [[gnu::flatten]] uint64_t __emupac_pacda_impl(uint64_t ptr,
+ uint64_t disc) {
if (pac_supported()) {
__asm__ __volatile__(".arch_extension pauth\npacda %0, %1"
: "+r"(ptr)
@@ -116,15 +116,15 @@ __emupac_pacda_impl(uint64_t ptr, uint64_t disc) {
}
uint64_t hash;
siphash<1, 3>(reinterpret_cast<uint8_t *>(&ptr), 8, emu_da_key,
- *reinterpret_cast<uint8_t(*)[8]>(&hash));
+ *reinterpret_cast<uint8_t (*)[8]>(&hash));
return (ptr & ~pac_mask) | (hash & pac_mask);
}
__asm__(".globl __emupac_pacda\n"
"__emupac_pacda:\n" FRAME_POINTER_WRAP(__emupac_pacda_impl));
-extern "C" [[gnu::flatten]] uint64_t
-__emupac_autda_impl(uint64_t ptr, uint64_t disc) {
+extern "C" [[gnu::flatten]] uint64_t __emupac_autda_impl(uint64_t ptr,
+ uint64_t disc) {
if (pac_supported()) {
__asm__ __volatile__(".arch_extension pauth\nautda %0, %1"
: "+r"(ptr)
@@ -135,7 +135,7 @@ __emupac_autda_impl(uint64_t ptr, uint64_t disc) {
(ptr & ttbr1_mask) ? (ptr | pac_mask) : (ptr & ~pac_mask);
uint64_t hash;
siphash<1, 3>(reinterpret_cast<uint8_t *>(&ptr_without_pac), 8, emu_da_key,
- *reinterpret_cast<uint8_t(*)[8]>(&hash));
+ *reinterpret_cast<uint8_t (*)[8]>(&hash));
if (((ptr & ~pac_mask) | (hash & pac_mask)) != ptr) {
__builtin_trap();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/148094
More information about the llvm-commits
mailing list