This patch removes the build dependencies on linux headers, by
defining a few definitions that we need from those headers.
libgcc/ChangeLog:
2016-06-28 Walter Lee <w...@tilera.com>
* config/tilepro/atomic.h: Do not include arch/spr_def.h and
asm/unistd.h.
(SPR_CMPEXCH_VALUE): Define for tilegx.
(__NR_FAST_cmpxchg): Define for tilepro.
(__NR_FAST_atomic_update): Define for tilepro.
(__NR_FAST_cmpxchg64): Define for tilepro.
gcc/ChangeLog:
2016-06-28 Walter Lee <w...@tilera.com>
* config/tilegx/linux.h: Do not include arch/icache.h
(CLEAR_INSN_CACHE): Provide inlined definition directly.
* config/tilepro/linux.h: Do not include arch/icache.h
(CLEAR_INSN_CACHE): Provide inlined definition directly.
Index: libgcc/config/tilepro/atomic.h
===================================================================
--- libgcc/config/tilepro/atomic.h (revision 237823)
+++ libgcc/config/tilepro/atomic.h (working copy)
@@ -93,9 +93,11 @@
#endif
#ifdef __tilegx__
-#include <arch/spr_def.h>
+#define SPR_CMPEXCH_VALUE 0x2780
#else
-#include <asm/unistd.h>
+#define __NR_FAST_cmpxchg -1
+#define __NR_FAST_atomic_update -2
+#define __NR_FAST_cmpxchg64 -3
#endif
Index: gcc/config/tilegx/linux.h
===================================================================
--- gcc/config/tilegx/linux.h (revision 237823)
+++ gcc/config/tilegx/linux.h (working copy)
@@ -55,12 +55,23 @@
/* For __clear_cache in libgcc2.c. */
#ifdef IN_LIBGCC2
-#include <arch/icache.h>
-
/* Use the minimum page size of 4K. Alternatively we can call
- getpagesize() but it introduces a libc dependence. */
+ getpagesize() but it introduces a libc dependence.
+ See Linux arch/tile/include/uapi/arch/icache.h for more commentary. */
#undef CLEAR_INSN_CACHE
-#define CLEAR_INSN_CACHE(beg, end) invalidate_icache (beg, end - beg, 4096)
+#define CLEAR_INSN_CACHE(BEG, END) \
+{ \
+ long size = (long) (END) - (long) (BEG); \
+ if (size) \
+ { \
+ const char *p = (const char *) ((unsigned long) (BEG) & -64L); \
+ const char *end = p + (size < 4096 ? size : 4096) - 1; \
+ __insn_mf (); \
+ for (; p <= end; p += 64) \
+ __insn_icoh (p); \
+ __insn_drain (); \
+ } \
+}
#else
Index: gcc/config/tilepro/linux.h
===================================================================
--- gcc/config/tilepro/linux.h (revision 237823)
+++ gcc/config/tilepro/linux.h (working copy)
@@ -47,12 +47,31 @@
/* For __clear_cache in libgcc2.c. */
#ifdef IN_LIBGCC2
-#include <arch/icache.h>
-
-/* Use the minimum page size of 4K. Alternatively we can call getpagesize()
- but it introduces a libc dependence. */
+/* Use the minimum page size of 4K. Alternatively we can call
+ getpagesize() but it introduces a libc dependence.
+ See Linux arch/tile/include/uapi/arch/icache.h for more commentary. */
#undef CLEAR_INSN_CACHE
-#define CLEAR_INSN_CACHE(beg, end) invalidate_icache (beg, end - beg, 4096)
+#define CLEAR_INSN_CACHE(BEG, END) \
+{ \
+ long size = (long) (END) - (long) (BEG); \
+ if (size) \
+ { \
+ const char *start = (const char *) ((unsigned long) (BEG) & -64L);\
+ const char *end = start + (size < 16384 ? size : 16384) - 1; \
+ long num_passes = 4; \
+ __insn_mf (); \
+ do \
+ { \
+ const char *p; \
+ for (p = start; p <= end; p += 64) \
+ __insn_icoh (p); \
+ start += 4096; \
+ end += 4096; \
+ } \
+ while (--num_passes > 0); \
+ __insn_drain (); \
+ } \
+}
#else