Subject: port-mips/31857: can't load module pf.o, undefined symbols 'bswap64' in kernel.
To: None <port-mips-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <tnozaki@netbsd.org>
List: netbsd-bugs
Date: 10/18/2005 15:57:00
>Number:         31857
>Category:       port-mips
>Synopsis:       can't load module pf.o, undefined symbols 'bswap64' in kernel.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 18 15:57:00 +0000 2005
>Originator:     Takehiko NOZAKI
>Release:        3.99.9
>Organization:
>Environment:
NetBSD xxx 3.99.9 NetBSD 3.99.9 (XXX) #0: Fri Oct 14 23:20:31 JST 2005 tnozaki@xxx:/usr/obj/sys/arh/hpcmips/compile/XXX hpcmips
>Description:
my hpcmips machine fail to load kernel module /usr/lkm/pf.o.
it claims that there's undefined symbols 'bswap64' in kernel.

bswap64 is included in libkernel but
all mips arch seems always build libkernel as *.a, not *.o.
so it may not linked to kernel.


>How-To-Repeat:
# modload /usr/lkm/pf.o
/usr/lkm/pf.o(.text+0x5640): In function `pf_insert_state':
: undefined reference to `bswap64'
/usr/lkm/pf.o(.text+0x5644): In function `pf_insert_state':
: undefined reference to `bswap64'
/usr/lkm/pf.o(.text+0x56fc): In function `pf_insert_state':
: undefined reference to `bswap64'
/usr/lkm/pf.o(.text+0x5700): In function `pf_insert_state':
: undefined reference to `bswap64'
modload: can't prelink `/usr/lkm/pf.o' creating `/usr/lkm/pf'
#

$ nm /usr/lkm/pf.o | grep bswap64
         U bswap64

$ nm /netbsd | grep bswap
802ba520 T bswap16
802bb030 T bswap32

>Fix:
--- sys/arch/mips/conf/Makefile.mips.orig	2005-10-13 00:08:55.000000000 +0900
+++ sys/arch/mips/conf/Makefile.mips	2005-10-18 23:55:03.000000000 +0900
@@ -59,6 +59,9 @@
 ##
 ## (3) libkern and compat
 ##
+.if !empty(IDENT:M-DLKM)
+KERN_AS=	obj
+.endif
 
 ##
 ## (4) local objects, compile rules, and dependencies