On Friday 07 October 2005 15:45, Alan Menegotto wrote:
> Antoine Martin wrote:
> >I tried twice to be sure, but compile fails near the end:
> >
> > CC      arch/um/sys-x86_64/stub_segv.o
> >arch/um/sys-x86_64/stub_segv.c: In function `stub_segv_handler':
> >arch/um/sys-x86_64/stub_segv.c:41: warning: implicit declaration of
> >function `container_of'
> >arch/um/sys-x86_64/stub_segv.c:41: error: parse error before "struct"
> >make[1]: *** [arch/um/sys-x86_64/stub_segv.o] Error 1
> >make: *** [arch/um/sys-x86_64] Error 2
> >
> >Antoine

> I've got no such errors compiling 2.6.13-bs9 (probably one version
> further, I'm not sure about the version). Try the latest 'bs patch' and
> the latest vanilla kernel version (2.6.13-3) and the error should be gone.
Probably you tried 2.6.12-bs9 - 2.6.13 latest -bs is 3.

Also, this was added in -bs3, to fix another problem.

Try the attached patch.
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
uml: compile-time fix for x86_64 frame pointer fix

From: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>

This should fix the compile-time error on x86_64. We can't get container_of from
host headers, since it's new in 2.6. offsetof, instead, is ANSI C. But it's
untested.

Jeff, stick this with the original patch when sending it upstream (it's
introduced by your fix for frame-pointer-less x86_64 binaries).

After Antoine Martin tested this on his build environment, anyway.

Cc: Jeff Dike <[EMAIL PROTECTED]>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>
Index: linux-2.6.13/arch/um/sys-x86_64/stub_segv.c
===================================================================
--- linux-2.6.13.orig/arch/um/sys-x86_64/stub_segv.c
+++ linux-2.6.13/arch/um/sys-x86_64/stub_segv.c
@@ -9,6 +9,7 @@
 #include "uml-config.h"
 #include "sysdep/sigcontext.h"
 #include "sysdep/faultinfo.h"
+#include <stddef.h>
 
 /* Copied from sys-x86_64/signal.c - Can't find an equivalent definition
  * in the libc headers anywhere.
@@ -20,6 +21,11 @@ struct rt_sigframe
         struct siginfo info;
 };
 
+/* Copied here from <linux/kernel.h> - we're userspace. */
+#define container_of(ptr, type, member) ({			\
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
+        (type *)( (char *)__mptr - offsetof(type,member) );})
+
 void __attribute__ ((__section__ (".__syscall_stub")))
 stub_segv_handler(int sig)
 {

Reply via email to