Subject: Re: Undefined kernel symbols: bcopy, strchr, memset, etc
To: None <port-macppc@netbsd.org>
From: Shawn Pearce <shawnp@nortelnetworks.com>
List: port-macppc
Date: 11/22/1999 14:38:41
Bill Studenmund wrote:

> On Fri, 19 Nov 1999, Shawn Pearce wrote:
>
> > Bill Studenmund wrote:
> >
> > > On Thu, 18 Nov 1999, Shawn Pearce wrote:
> > >
> > > > I just downloaded and attempted to build the NetBSD port of MacPPC from
> > > > the 1.4.1 distribution.  However, after getting make, config, lorder and
> > > > getting a ppcmake script I found off the web all installed (not to
> > > > mention a working powerpc-netbsd-gcc), the NetBSD kernel wouldn't link
> > > > because of undefined symbols.  These were:
>
> This is with the 1.4.1 NetBSD make?

Yes.  And I set the MACHINE and MACHINE_ARCH defaults for the make I built to be
macppc and powerpc respectively, so it should be using those regardless of
whether the value is set in the environment or not.  But the ppcmake script I use
to invoke this bsdmake sets those anyway.

> The way these files get built is that the kernel's Makefile includes
> libkern's make file with this line:
>
> .include "$S/lib/libkern/Makefile.inc"
>
> This include file adds some rules to the make process, including one which
> will fork off a copy of make to actually make the library. That make will
> define a variable M, and use it to find the powerpc-specific includes:
>
> ARCHSUBDIR= ${MACHINE_ARCH:C/mipse[bl]/mips/}
> M= ${.CURDIR}/arch/${ARCHSUBDIR}
>
> CPPFLAGS=       -I$M ${KERNCPPFLAGS} ${KERNMISCCPPFLAGS}
>
> .if exists ($M/Makefile.inc)
> .PATH:  $M
> .include "$M/Makefile.inc"
> .endif
>
> So sys/lib/kern/arch/powerpc/Makefile.inc isn't getting found.

I see that.  I narrowed the problem down to the line:

    ARCHSUBDIR= ${MACHINE_ARCH:C/mipse[bl]/mips/}

This line causes ARCHSUBDIR to be set to '' (empty string) even though
MACHINE_ARCH is set to powerpc.  Changing it to:

    ARCHSUBDIR=${MACHINE_ARCH}

It gets a lot farther.  bcopy is still undefined, but its the _only_ undefined.
Adding bcopy.c to sys/lib/kern/arch/powerpc/Makefile.inc fixes this problem and
my kernel linked completely.

So why is my bsdmake (from the 1.4.1 distribution) producing an empty string for
ARCHSUBDIR?

--
Shawn.