Subject: Re: -current amd64 kernel compilation failure with COMPAT_NETBSD32
To: Nicolas Joly <njoly@pasteur.fr>
From: Gary Duzan <gary@duzan.org>
List: port-amd64
Date: 09/27/2005 09:12:21
In Message <20050927120817.GA27323@lanfeust.sis.pasteur.fr> ,
   Nicolas Joly <njoly@pasteur.fr> wrote:

=>
=>Hi,
=>
=>I just updated my -current sources and noticed that amd64 kernels with
=>COMPAT_NETBSD32 does not compile anymore :
=>
=>#    create  GENERIC.MP/assym.h
=>cat /local/src/NetBSD/src/sys/arch/amd64/amd64/genassym.cf  |  /local/src/NetBSD/tool/amd64/bin/nbgenassym -- /local/src/NetBSD/tool/amd6
4/bin/x86_64--netbsd-gcc  -mcmodel=kernel -mno-red-zone  -ffreestanding   -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-ari
th -Wmissing-prototypes -Wstrict-prototypes -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare  -fno-zero-initia
lized-in-bss    -Damd64 -Dx86_64 -I.  -I/local/src/NetBSD/src/sys/arch -I/local/src/NetBSD/src/sys -nostdinc -DLKM -DMAXUSERS=32 -D_KERNEL 
-D_KERNEL_OPT  -I/local/src/NetBSD/src/sys/dist/ipf   > assym.h.tmp &&  mv -f assym.h.tmp assym.h
=>In file included from /tmp/genassym.7332/assym.c:23:
=>machine/netbsd32_machdep.h:86: error: parse error before "siginfo32_t"
=>machine/netbsd32_machdep.h:86: warning: no semicolon at end of struct or union
=>machine/netbsd32_machdep.h:88: error: parse error before '}' token

   I can confirm this. A bit of hackery (included below) got it
going again, though I don't claim correctness, and the 32 bit
compatability doesn't seem that great. ("ls" works, but not a lot
else.)

					Gary Duzan



Index: arch/amd64/include/netbsd32_machdep.h
===================================================================
RCS file: /usr2/netbsd-cvs/src/sys/arch/amd64/include/netbsd32_machdep.h,v
retrieving revision 1.6
diff -u -r1.6 netbsd32_machdep.h
--- arch/amd64/include/netbsd32_machdep.h	14 Sep 2005 16:19:27 -0000	1.6
+++ arch/amd64/include/netbsd32_machdep.h	26 Sep 2005 18:23:54 -0000
@@ -5,6 +5,7 @@
 
 #include <sys/ucontext.h>
 #include <compat/sys/ucontext.h>
+#include <compat/sys/siginfo.h>
 
 typedef	u_int32_t netbsd32_pointer_t;
 #define	NETBSD32PTR64(p32)	((void *)(u_long)(u_int)(p32))
Index: compat/netbsd32/netbsd32.h
===================================================================
RCS file: /usr2/netbsd-cvs/src/sys/compat/netbsd32/netbsd32.h,v
retrieving revision 1.41
diff -u -r1.41 netbsd32.h
--- compat/netbsd32/netbsd32.h	24 Sep 2005 21:34:18 -0000	1.41
+++ compat/netbsd32/netbsd32.h	26 Sep 2005 18:34:43 -0000
@@ -637,6 +637,11 @@
 vaddr_t netbsd32_vm_default_addr(struct proc *, vaddr_t, vsize_t);
 void netbsd32_adjust_limits(struct proc *);
 
+void netbsd32_si_to_si32(siginfo32_t *, const siginfo_t *);
+#ifdef unused
+void netbsd32_si32_to_si(siginfo_t *, const siginfo32_t *);
+#endif
+
 #ifdef SYSCTL_SETUP_PROTO
 SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
 #endif /* SYSCTL_SETUP_PROTO */
Index: compat/netbsd32/netbsd32_signal.c
===================================================================
RCS file: /usr2/netbsd-cvs/src/sys/compat/netbsd32/netbsd32_signal.c,v
retrieving revision 1.14
diff -u -r1.14 netbsd32_signal.c
--- compat/netbsd32/netbsd32_signal.c	24 Sep 2005 21:34:18 -0000	1.14
+++ compat/netbsd32/netbsd32_signal.c	26 Sep 2005 18:39:19 -0000
@@ -53,12 +53,6 @@
 #include <compat/sys/siginfo.h>
 #include <compat/sys/ucontext.h>
 
-static void netbsd32_si_to_si32(siginfo32_t *, const siginfo_t *);
-#ifdef unused
-static void netbsd32_si32_to_si(siginfo_t *, const siginfo32_t *);
-#endif
-
-
 int
 netbsd32_sigaction(l, v, retval)
 	struct lwp *l;
@@ -273,7 +267,7 @@
 }
 #endif
 
-static void
+void
 netbsd32_si_to_si32(siginfo32_t *si32, const siginfo_t *si)
 {
 	memset(si32, 0, sizeof (*si32));