[Patch] asm workarounds in generic header files

From: Siddha, Suresh B
Date: Mon Sep 08 2003 - 20:07:47 EST


Intel ecc compiler doesn't support inline assembly.
Attached patch is required to enable linux kernel build with Intel ecc compiler.
Please apply.

thanks,
suresh

diff -Nru linux/include/linux/compiler.h linux-2.5/include/linux/compiler.h
--- linux/include/linux/compiler.h Mon Sep 8 11:51:00 2003
+++ linux-2.5/include/linux/compiler.h Mon Sep 8 13:22:13 2003
@@ -74,10 +74,26 @@
#define __attribute_pure__ /* unimplemented */
#endif

+#if defined(__INTEL_COMPILER) && defined(__ECC)
+/* Optimization barrier */
+#include <asm/intrinsics.h>
+#define barrier() __memory_barrier()
+
+#define RELOC_HIDE(ptr, off) \
+ ({ unsigned long __ptr; \
+ __ptr = (unsigned long) (ptr); \
+ (typeof(ptr)) (__ptr + (off)); })
+#else
+/* Optimization barrier */
+/* The "volatile" is due to gcc bugs */
+#define barrier() asm volatile ("":::"memory")
+
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
#define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__asm__ ("" : "=g"(__ptr) : "0"(ptr)); \
(typeof(ptr)) (__ptr + (off)); })
+#endif
+
#endif /* __LINUX_COMPILER_H */
diff -Nru linux/include/linux/kernel.h linux-2.5/include/linux/kernel.h
--- linux/include/linux/kernel.h Mon Sep 8 11:51:01 2003
+++ linux-2.5/include/linux/kernel.h Mon Sep 8 12:06:14 2003
@@ -15,10 +15,6 @@
#include <asm/byteorder.h>
#include <asm/bug.h>

-/* Optimization barrier */
-/* The "volatile" is due to gcc bugs */
-#define barrier() __asm__ __volatile__("": : :"memory")
-
#define INT_MAX ((int)(~0U>>1))
#define INT_MIN (-INT_MAX - 1)
#define UINT_MAX (~0U)

Attachment: asm.patch
Description: asm.patch