NetBSD Problem Report #43958

From www@NetBSD.org  Sat Oct  9 23:35:56 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 823C763B951
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  9 Oct 2010 23:35:56 +0000 (UTC)
Message-Id: <20101009233556.0DDB963B94B@www.NetBSD.org>
Date: Sat,  9 Oct 2010 23:35:56 +0000 (UTC)
From: dross@pobox.com
Reply-To: dross@pobox.com
To: gnats-bugs@NetBSD.org
Subject: Can't compile Atari kernel with ksyms pseudo-device enabled
X-Send-Pr-Version: www-1.0

>Number:         43958
>Category:       kern
>Synopsis:       Can't compile Atari kernel with ksyms pseudo-device enabled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 09 23:40:00 +0000 2010
>Last-Modified:  Mon Nov 08 22:30:02 +0000 2010
>Originator:     David Ross
>Release:        5.0.2
>Organization:
n/a
>Environment:
NetBSD computer 5.0.2 NetBSD 5.0.2 (GENERIC) #0: Sat Feb  6 17:53:27 UTC 2010  builds@b7.netbsd.org:/home/builds/ab/netbsd-5-0-2-RELEASE/i386/201002061851Z-obj/home/builds/ab/netbsd-5-0-2-RELEASE/src/sys/arch/i386/compile/GENERIC i386
>Description:
Tried to compile with "pseudo-device ksyms" in the kernel configuration file.  Compilation fails here:

#   compile  MYKERNEL/machdep.o
/usr/src/tooldir.NetBSD-5.0.2-i386/bin/m68k--netbsdelf-gcc -pipe -fomit-frame-pointer -ffreestanding -fno-zero-initialized-in-bss -O2 -std=gnu99 -fno-strict-aliasing -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Werror -m68030 -m68881 -Datari -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DM68030 -DPANICWAIT -DST_POOL_SIZE=24 -DTT_VIDEO -DDISKLABEL_NBDA -DDISKLABEL_AHDI -DRELOC_KERNEL -DMSGBUFSIZE=32768 -DMAXUSERS=16 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/m68k/string -I/usr/src/sys/dist/ipf -c /usr/src/sys/arch/atari/atari/machdep.c
/usr/src/sys/arch/atari/atari/machdep.c: In function 'consinit':
/usr/src/sys/arch/atari/atari/machdep.c:209: error: 'Elf32_Ehdr' undeclared (first use in this function)
/usr/src/sys/arch/atari/atari/machdep.c:209: error: (Each undeclared identifier is reported only once
/usr/src/sys/arch/atari/atari/machdep.c:209: error: for each function it appears in.)

*** Failed target:  machdep.o
*** Failed command: echo '# ' "compile MYKERNEL/machdep.o"; echo /usr/src/tooldir.NetBSD-5.0.2-i386/bin/m68k--netbsdelf-gcc -pipe -fomit-frame-pointer -ffreestanding -fno-zero-initialized-in-bss -O2 -std=gnu99 -fno-strict-aliasing -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Werror -m68030 -m68881 -Datari -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DM68030 -DPANICWAIT -DST_POOL_SIZE="24" -DTT_VIDEO -DDISKLABEL_NBDA -DDISKLABEL_AHDI -DRELOC_KERNEL -DMSGBUFSIZE="32768" -DMAXUSERS=16 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/m68k/string -I/usr/src/sys/dist/ipf -c /usr/src/sys/arch/atari/atari/machdep.c; /usr/sr
 c/tooldir.NetBSD-5.0.2-i386/bin/m68k--netbsdelf-gcc -pipe -fomit-frame-pointer -ffreestanding -fno-zero-initialized-in-bss -O2 -std=gnu99 -fno-strict-aliasing -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Werror -m68030 -m68881 -Datari -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DM68030 -DPANICWAIT -DST_POOL_SIZE="24" -DTT_VIDEO -DDISKLABEL_NBDA -DDISKLABEL_AHDI -DRELOC_KERNEL -DMSGBUFSIZE="32768" -DMAXUSERS=16 -D_KERNEL -D_KERNEL_OPT -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/m68k/string -I/usr/src/sys/dist/ipf -c /usr/src/sys/arch/atari/atari/machdep.c
*** Error code 1

Stop.
nbmake: stopped in /usr/obj/sys/arch/atari/compile/MYKERNEL

ERROR: Failed to make all in /usr/src/sys/arch/atari/compile/obj/MYKERNEL
*** BUILD ABORTED ***
computer$ 
>How-To-Repeat:
Try to compile an atari kernel with the ksyms pseudo-device.
>Fix:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/43958: Can't compile Atari kernel with ksyms
 pseudo-device enabled
Date: Sun, 10 Oct 2010 02:13:50 +0000

 On Sat, Oct 09, 2010 at 11:40:00PM +0000, dross@pobox.com wrote:
  > /usr/src/sys/arch/atari/atari/machdep.c: In function 'consinit':
  > /usr/src/sys/arch/atari/atari/machdep.c:209: error: 'Elf32_Ehdr' undeclared (first use in this function)
  > /usr/src/sys/arch/atari/atari/machdep.c:209: error: (Each undeclared identifier is reported only once
  > /usr/src/sys/arch/atari/atari/machdep.c:209: error: for each function it appears in.)

 Is there any reason not to move the inclusion of ksyms.h up along with
 the opt_*.h near the top of the file?

 Then you can change line 110 to match line 200:

    -#if defined(DDB) && defined(__ELF__)
    +#if (NKSYMS || defined(DDB) || defined(LKM)) && defined(__ELF__)
    #include <sys/exec_elf.h>
    #endif

 (Note: for HEAD, s/LKM/MODULAR/)

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Ross <dross@pobox.com>
To: <gnats-bugs@netbsd.org>, <kern-bug-people@netbsd.org>,
	<gnats-admin@netbsd.org>, <netbsd-bugs@netbsd.org>
Cc: 
Subject: RE: kern/43958: Can't compile Atari kernel with ksyms pseudo-device
 enabled
Date: Sun, 7 Nov 2010 00:50:25 -0800

 David=2C
 =20
 Ahh...  if I explicitly include <sys/exec_elf.h> then it starts building.  =
 Then I realized I had disabled DDB in my kernel config.  Once I enabled DDB=
  again I was able to build just fine with ksyms.
 =20
 I'm not sure if it's completely nonsensical to build the kernel with ksyms =
 but without DDB.  If that's the case then this bug should be closed.  Other=
 wise maybe it makes sense to remove "defined(DDB) &&" from the conditional =
 regulating the inclusion of <sys/exec_elf.h>?
 =20
 David Ross
 dross@pobox.com

 ----------------------------------------
 > From: dholland-bugs@netbsd.org
 > To: kern-bug-people@netbsd.org=3B gnats-admin@netbsd.org=3B netbsd-bugs@n=
 etbsd.org=3B dross@pobox.com
 > Subject: Re: kern/43958: Can't compile Atari kernel with ksyms pseudo-dev=
 ice enabled
 > CC:
 > Date: Sun=2C 10 Oct 2010 02:15:04 +0000
 >
 > The following reply was made to PR kern/43958=3B it has been noted by GNA=
 TS.
 >
 > From: David Holland=20
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: kern/43958: Can't compile Atari kernel with ksyms
 > pseudo-device enabled
 > Date: Sun=2C 10 Oct 2010 02:13:50 +0000
 >
 > On Sat=2C Oct 09=2C 2010 at 11:40:00PM +0000=2C dross@pobox.com wrote:
 > > /usr/src/sys/arch/atari/atari/machdep.c: In function 'consinit':
 > > /usr/src/sys/arch/atari/atari/machdep.c:209: error: 'Elf32_Ehdr' undecl=
 ared (first use in this function)
 > > /usr/src/sys/arch/atari/atari/machdep.c:209: error: (Each undeclared id=
 entifier is reported only once
 > > /usr/src/sys/arch/atari/atari/machdep.c:209: error: for each function i=
 t appears in.)
 >
 > Is there any reason not to move the inclusion of ksyms.h up along with
 > the opt_*.h near the top of the file?
 >
 > Then you can change line 110 to match line 200:
 >
 > -#if defined(DDB) && defined(__ELF__)
 > +#if (NKSYMS || defined(DDB) || defined(LKM)) && defined(__ELF__)
 > #include <sys/exec_elf.h>
 > #endif
 >
 > (Note: for HEAD=2C s/LKM/MODULAR/)
 >
 > --
 > David A. Holland
 > dholland@netbsd.org
 > 		 	   		  =

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/43958: Can't compile Atari kernel with ksyms
 pseudo-device enabled
Date: Mon, 8 Nov 2010 03:41:58 +0000

 On Sun, Nov 07, 2010 at 07:55:03AM +0000, David Ross wrote:
  > I'm not sure if it's completely nonsensical to build the kernel with ksyms
  > but without DDB.

 I don't think so.

  > If that's the case then this bug should be closed.  Otherwise
  > maybe it makes sense to remove "defined(DDB) &&" from the conditional
  > regulating the inclusion of <sys/exec_elf.h>?

 That or what I suggested before...

 I notice however that the code that needs exec_elf.h looks kind of
 bogus in its own right:

    #ifndef __ELF__
 	   ksyms_addsyms_elf(*(int *)&end, ((int *)&end) + 1, esym);
    #else
 	   ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr),
 	       (void *)&end, esym);
    #endif

 Surely it shouldn't be calling ksyms_addsyms_*elf* when *not* __ELF__?

 -- 
 David A. Holland
 dholland@netbsd.org

From: David Ross <dross@pobox.com>
To: <gnats-bugs@netbsd.org>, <kern-bug-people@netbsd.org>,
	<gnats-admin@netbsd.org>, <netbsd-bugs@netbsd.org>
Cc: 
Subject: RE: kern/43958: Can't compile Atari kernel with ksyms pseudo-device
 enabled
Date: Mon, 8 Nov 2010 14:25:36 -0800

 =20
 David=2C
 =20
 Ok=2C FWIW I'm unblocked because I can just build with DDB.  But yeah=2C lo=
 oks like there is a bug to fix.  =3D)
 =20
 Thank you!
 =20
 David Ross
 dross@pobox.com


 ----------------------------------------
 > From: dholland-bugs@netbsd.org
 > To: kern-bug-people@netbsd.org=3B gnats-admin@netbsd.org=3B netbsd-bugs@n=
 etbsd.org=3B dross@pobox.com
 > Subject: Re: kern/43958: Can't compile Atari kernel with ksyms pseudo-dev=
 ice enabled
 > CC:
 > Date: Mon=2C 8 Nov 2010 03:45:02 +0000
 >
 > The following reply was made to PR kern/43958=3B it has been noted by GNA=
 TS.
 >
 > From: David Holland=20
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: kern/43958: Can't compile Atari kernel with ksyms
 > pseudo-device enabled
 > Date: Mon=2C 8 Nov 2010 03:41:58 +0000
 >
 > On Sun=2C Nov 07=2C 2010 at 07:55:03AM +0000=2C David Ross wrote:
 > > I'm not sure if it's completely nonsensical to build the kernel with ks=
 yms
 > > but without DDB.
 >
 > I don't think so.
 >
 > > If that's the case then this bug should be closed. Otherwise
 > > maybe it makes sense to remove "defined(DDB) &&" from the conditional
 > > regulating the inclusion of ?
 >
 > That or what I suggested before...
 >
 > I notice however that the code that needs exec_elf.h looks kind of
 > bogus in its own right:
 >
 > #ifndef __ELF__
 > ksyms_addsyms_elf(*(int *)&end=2C ((int *)&end) + 1=2C esym)=3B
 > #else
 > ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr)=2C
 > (void *)&end=2C esym)=3B
 > #endif
 >
 > Surely it shouldn't be calling ksyms_addsyms_*elf* when *not* __ELF__?
 >
 > --
 > David A. Holland
 > dholland@netbsd.org
 > 		 	   		  =

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.