summaryrefslogtreecommitdiff
path: root/lib/builtins/clear_cache.c
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-02-21 17:40:26 +0000
committerRenato Golin <renato.golin@linaro.org>2017-02-21 17:40:26 +0000
commitcf1dffa34854a5d1d7f15fe2acf8d65db6dd3843 (patch)
tree1e58925ca0d4f1e2b282bc6b0e17f8c1528bdf31 /lib/builtins/clear_cache.c
parentf9ab05ca2548238f0a8434f4e92d92c887a75f33 (diff)
[RT ARM] Avoid Linux include with a redefinition
To avoid depending on kernel headers, we just repeat the single define we need, which is likely never going to change. Patch by Joakim Sindholt <opensource@zhasha.com> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295738 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/clear_cache.c')
-rw-r--r--lib/builtins/clear_cache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/builtins/clear_cache.c b/lib/builtins/clear_cache.c
index 4c2ac3b1e..a68f9fcfb 100644
--- a/lib/builtins/clear_cache.c
+++ b/lib/builtins/clear_cache.c
@@ -82,10 +82,6 @@ uintptr_t GetCurrentProcess(void);
#endif
#endif
-#if defined(__linux__) && defined(__arm__)
- #include <asm/unistd.h>
-#endif
-
/*
* The compiler generates calls to __clear_cache() when creating
* trampoline functions on the stack for use with nested functions.
@@ -108,6 +104,15 @@ void __clear_cache(void *start, void *end) {
sysarch(ARM_SYNC_ICACHE, &arg);
#elif defined(__linux__)
+ /*
+ * We used to include asm/unistd.h for the __ARM_NR_cacheflush define, but
+ * it also brought many other unused defines, as well as a dependency on
+ * kernel headers to be installed.
+ *
+ * This value is stable at least since Linux 3.13 and should remain so for
+ * compatibility reasons, warranting it's re-definition here.
+ */
+ #define __ARM_NR_cacheflush 0x0f0002
register int start_reg __asm("r0") = (int) (intptr_t) start;
const register int end_reg __asm("r1") = (int) (intptr_t) end;
const register int flags __asm("r2") = 0;