lkml.org 
[lkml]   [1998]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject2.1.114 on UP won't compile: Take 2
Date
From
After the discussion on the list I sat down to fix this problem in a way
that I hope is acceptable to all parties. It even clarifies the code in
include/linux/sched.h a bit ;-)

The resulting init_task.c compiles under gcc-2.7.2.3 and egcs-19980727, and
this is really simple, so there should be no further problems.

I don't have ready access to non-intel machines, please check that I didn't
goof. I'm now writing this under the patched kernel: i586 UP, egcs-19980727,
binutils-2.9.1.0.7

--- linux/include/linux/sched.h.dist-2.1.114 Mon Aug 3 20:07:56 1998
+++ linux/include/linux/sched.h Tue Aug 4 18:46:05 1998
@@ -322,16 +322,6 @@

#define DEF_PRIORITY (20*HZ/100) /* 200 ms time slices */

-/* Note: This is very ugly I admit. But some versions of gcc will
- * dump core when an empty structure constant is parsed at
- * the end of a large top level structure initialization. -DaveM
- */
-#ifdef __SMP__
-#define INIT_LOCKS SPIN_LOCK_UNLOCKED
-#else
-#define INIT_LOCKS
-#endif
-
/*
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -367,7 +357,8 @@
/* fs */ &init_fs, \
/* files */ &init_files, \
/* mm */ &init_mm, \
-/* signals */ INIT_LOCKS, &init_signals, {{0}}, {{0}}, NULL, &init_task.sigqueue, 0, 0, \
+/* signals */ SPIN_LOCK_UNLOCKED, &init_signals, \
+ {{0}}, {{0}}, NULL, &init_task.sigqueue, 0, 0 \
}

union task_union {
--- linux/include/asm-i386/spinlock.h.dist-2.1.114 Mon Aug 3 20:04:49 1998
+++ linux/include/asm-i386/spinlock.h Tue Aug 4 19:05:48 1998
@@ -10,8 +10,18 @@
/*
* Your basic spinlocks, allowing only a single CPU anywhere
*/
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-mips/spinlock.h.dist-2.1.114 Thu Jun 26 15:33:40 1997
+++ linux/include/asm-mips/spinlock.h Tue Aug 4 19:05:26 1998
@@ -3,8 +3,18 @@

#ifndef __SMP__

-/* gcc 2.7.2 can crash initializing an empty structure. For now we
- try to do though ... */
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
+typedef struct { } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { }
+#endif
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }

--- linux/include/asm-alpha/spinlock.h.dist-2.1.114 Mon Mar 30 04:21:41 1998
+++ linux/include/asm-alpha/spinlock.h Tue Aug 4 19:06:09 1998
@@ -3,9 +3,18 @@

#ifndef __SMP__

-/* gcc 2.7.2 can crash initializing an empty structure. */
-typedef struct { int dummy; } spinlock_t;
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
#define SPIN_LOCK_UNLOCKED { 0 }
+#else
+typedef struct { } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-m68k/spinlock.h.dist-2.1.114 Sat May 24 12:10:24 1997
+++ linux/include/asm-m68k/spinlock.h Tue Aug 4 19:05:38 1998
@@ -5,8 +5,18 @@
* We don't do SMP on the m68k .... at least not yet.
*/

-typedef struct { int dummy; } spinlock_t;
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
#define SPIN_LOCK_UNLOCKED { 0 }
+#else
+typedef struct { } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-sparc/spinlock.h.dist-2.1.114 Mon Jun 16 19:36:00 1997
+++ linux/include/asm-sparc/spinlock.h Tue Aug 4 19:05:01 1998
@@ -10,8 +10,18 @@

#ifndef __SMP__

+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-ppc/spinlock.h.dist-2.1.114 Fri May 8 03:18:24 1998
+++ linux/include/asm-ppc/spinlock.h Tue Aug 4 19:05:17 1998
@@ -3,8 +3,18 @@

#ifndef __SMP__

+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-sparc64/spinlock.h.dist-2.1.114 Sat Aug 16 12:51:10 1997
+++ linux/include/asm-sparc64/spinlock.h Tue Aug 4 19:06:19 1998
@@ -10,8 +10,18 @@

#ifndef __SMP__

+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)
--- linux/include/asm-arm/spinlock.h.dist-2.1.114 Tue Jul 21 20:51:51 1998
+++ linux/include/asm-arm/spinlock.h Tue Aug 4 19:05:57 1998
@@ -6,8 +6,18 @@
/*
* Your basic spinlocks, allowing only a single CPU anywhere
*/
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+/*
+ * At least gcc-2.7.2.3 is broken with respect to some uses of empty structures
+ * (Notably, it segfaults in arch/*/kernel/init_task.c). This is a workaround.
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl> 19980804
+ */
+typedef struct {int buggy_gcc; } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { 0 }
+#else
typedef struct { } spinlock_t;
#define SPIN_LOCK_UNLOCKED { }
+#endif

#define spin_lock_init(lock) do { } while(0)
#define spin_lock(lock) do { } while(0)

--
Horst von Brand vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile +56 32 672616

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.322 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site