1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-13 03:09:51 +03:00
aports/testing/ldc-runtime-cross/compiler-rt-riscv64-remove-dep-on-linux-headers.patch
2025-05-30 12:39:15 +00:00

24 lines
868 B
Diff

From 9aa9953a4b922bf7ce095179efdf80f0c63b250a Mon Sep 17 00:00:00 2001
From: q66 <q66@chimera-linux.org>
Date: Fri, 16 Jul 2021 23:28:45 +0200
Subject: [PATCH] avoid dependency on linux headers
---
compiler-rt/lib/builtins/clear_cache.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/compiler-rt/lib/builtins/clear_cache.c
+++ b/compiler-rt/lib/builtins/clear_cache.c
@@ -49,8 +49,10 @@ uintptr_t GetCurrentProcess(void);
#endif
#if defined(__linux__) && defined(__riscv)
-// to get platform-specific syscall definitions
-#include <linux/unistd.h>
+#define SYS_RISCV_FLUSH_ICACHE_LOCAL 1UL
+#define SYS_RISCV_FLUSH_ICACHE_ALL (SYS_RISCV_FLUSH_ICACHE_LOCAL)
+#define __NR_arch_specific_syscall 244
+#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
#endif
// The compiler generates calls to __clear_cache() when creating