Subject: lkm/modload woes
To: None <port-pmax@netbsd.org>
From: Bob Lantz <lantz@Stanford.EDU>
List: port-pmax
Date: 10/10/2000 16:16:45
Has anyone gotten loadable kernel modules to work with netbsd/pmax?? I
tried building arla and loading it with modload (and /etc/rc.lkm,) but it
appears that there are problems with modload and the linker (ld.)

The initial ld command put out by modload seems to be:

ld -R /netbsd -e xfs_mod -o /usr/pkg/bin/xfs_makedev -T  0 \
	/usr/pkg/lkm/xfs_mod.o

This is wrong because it should be -Ttext 0. However, the command

ld -R /netbsd -e xfs_mod -o /usr/pkg/bin/xfs_makedev -Ttext 0 \
	/usr/pkg/lkm/xfs_mod.o

/usr/bin/ld: Warning: size of symbol `memcpy' changed from 324 to
84 in /usr/pkg/lkm/xfs_mod.o
/usr/bin/ld: Warning: size of symbol `vfs_detach' changed from 152
to 140 in /usr/pkg/lkm/xfs_mod.o
/usr/bin/ld: Warning: size of symbol `vfs_attach' changed from 216
to 300 in /usr/pkg/lkm/xfs_mod.o
/usr/bin/ld: /usr/pkg/lkm/xfs_mod.o: linking PIC files with non-PIC 
files
Bad value: failed to merge target specific data of file
/usr/pkg/lkm/xfs_mod.o
/usr/bin/ld: /usr/pkg/bin/xfs_makedev: Not enough room for program
headers (allocated 3, need 4)
/usr/bin/ld: final link failed: Bad value

Some things that bother me are:

linking PIC files with non-PIC files -> this generally indicates something
was built incorrectly; but as far as I can tell both the kernel and the
module have been built correctly....

# file /usr/pkg/lkm/xfs_mod.o 
/usr/pkg/lkm/xfs_mod.o: ELF 32-bit LSB relocatable, MIPS R3000_BE -
invalid byte order, version 1, not stripped

The other thing that seems bad is the ld message "not enough room for
program headers." This implies that we need more  ELF headers, but for
some reason ld isn't allocating them or adding them in correctly....

I am using the GENERIC kernel, which should be built with LKM support, as
far as I can tell.

 Does anyone have any ideas or suggestions?? Should I trace through
 ld and see what is going on, or are there some better options?? 

Bob