mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-18 01:54:34 +00:00
![Ben Wolsieffer](/assets/img/avatar_default.png)
compiler-rt has accumulated several regressions that prevent it from building on ARMv6. It is important to note that there are two major versions of ARMv6: base ARMv6 and ARMv6K. ARMv6K includes several important new instructions, such as non-word size atomic operations (ldrexd, strexd, etc.) and the yield instruction. Most ARMv6 CPUs actually implement ARMv6K, including all those used in Raspberry Pis, but nixpkgs' "raspberryPi" platform targets base ARMv6. compiler-rt versions 8-14 fail to build on ARMv6 and ARMv6K. compiler-rt 15 (not yet in nixpkgs) builds on ARMv6K but not ARMv6. This patch fixes versions 9-14 on both ARMv6 variants. The patches don't apply cleanly to version 8, and I figured it wasn't worth carrying another version of the patches for such an old version. A total of five patches are required to get compiler-rt building on ARMv6: * armv6-mcr-dmb.patch: use `mcr` to provide the equivalent of `dmb` on ARMv6. Included in LLVM 15. * armv6-sync-ops-no-thumb.patch: prevent certain atomic operation functions from using Thumb mode. Included in LLVM 15. * armv6-no-ldrexd-strexd.patch: don't use ldrexd or strexd, which are not available in base ARMv6. Submitted upstream by me. * armv6-scudo-no-yield.patch: use nop instead of yield on ARMv6 in standalone scudo. Required by versions >=13, since they enable standalone scudo. Submitted upstream by me. * armv6-scudo-libatomic.patch: link standlone scudo to libatomic on ARMv6 (and any other platforms that need it). Not yet submitted because the backport is a bit different from the upstream version and I need to test it.
35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From ff0b373b959165477f45d9f5f9a8da471ae111ab Mon Sep 17 00:00:00 2001
|
|
From: Ben Wolsieffer <benwolsieffer@gmail.com>
|
|
Date: Wed, 7 Dec 2022 18:03:56 -0500
|
|
Subject: [PATCH] [scudo][standalone] Only use yield on ARMv6K and newer
|
|
|
|
The yield instruction is only available in ARMv6K and newer. It behaves as a
|
|
nop on single threaded platforms anyway, so use nop instead on unsupported
|
|
architectures.
|
|
|
|
Differential Revision: https://reviews.llvm.org/D139600
|
|
---
|
|
compiler-rt/lib/scudo/standalone/common.h | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/lib/scudo/standalone/common.h b/lib/scudo/standalone/common.h
|
|
index bc3dfec6dbba..862cda1d4bc4 100644
|
|
--- a/lib/scudo/standalone/common.h
|
|
+++ b/lib/scudo/standalone/common.h
|
|
@@ -109,7 +109,12 @@ inline void yieldProcessor(u8 Count) {
|
|
#elif defined(__aarch64__) || defined(__arm__)
|
|
__asm__ __volatile__("" ::: "memory");
|
|
for (u8 I = 0; I < Count; I++)
|
|
+#if __ARM_ARCH >= 6 && !defined(__ARM_ARCH_6__)
|
|
+ // yield is supported on ARMv6K and newer
|
|
__asm__ __volatile__("yield");
|
|
+#else
|
|
+ __asm__ __volatile__("nop");
|
|
+#endif
|
|
#endif
|
|
__asm__ __volatile__("" ::: "memory");
|
|
}
|
|
--
|
|
2.38.1
|
|
|