[compiler-rt] [Compiler-rt] Implement AEABI Unaligned Read/Write Helpers in compiler-rt (PR #167913)
Simi Pallipurath via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 06:05:36 PST 2025
================
@@ -0,0 +1,88 @@
+// REQUIRES: arm-target-arch || armv6m-target-arch
+// RUN: %clang_builtins %s %librt -o %t && %run %t
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+extern int __aeabi_uread4(void *);
+extern int __aeabi_uwrite4(int, void *);
+extern long long __aeabi_uread8(void *);
+extern long long __aeabi_uwrite8(long long, void *);
+
+#define lenof(x) (sizeof((x)) / sizeof(*(x)))
+
+int test_unaligned(void) {
+ long long target8;
+ int target4;
+ const char source[] = "abcdefghijklmno";
+ static char dest1[lenof(source)], dest2[lenof(source)];
----------------
simpal01 wrote:
Using static is optional. It’s used here mainly to improve reproducibility — since it provides a stable address from which we can repeatably test unaligned writes.
https://github.com/llvm/llvm-project/pull/167913
More information about the llvm-commits
mailing list