Subject: netbsd32 & sunos32 LKM's.
To: None <port-sparc64@netbsd.org>
From: matthew green <mrg@eterna.com.au>
List: port-sparc64
Date: 06/05/2001 19:59:52
hi folks.


i've just spent a few hours making both netbsd32 & sunos32 actually load
as lkms (for 64 bit kernel only).  it requires a bit of hacking, due to
the "symbols in one lkm used by another" problem that isn't well solved
in netbsd yet (need /dev/ksyms and to be able to load symbols for elf,)
but it does seem to work this way.  note the extreme abuse of modload(8)'s
-A switch.  the '-T ld.script' is the standard ldscript (elf64_sparc.x),
except with references to etext, edata, end, & _bss_section removed (as
they end up causing the `ld -R /netbsd -R other_module' to have multiply
defined symbols.)


these are the commands i run, in /usr/lkm, to load the netbsd32 & sunos32
modules.  note that there are actually 5 modules in total -- 3 exec modules
and 2 compat modules.  the exec modules must be loaded after the compat
module.


modload -S -d -v -A '/netbsd -T ld.script' compat_netbsd32.o
modload -S -d -v -A '/netbsd -R compat_netbsd32 -T ld.script' exec_netbsd32_aout.o
modload -S -d -v -A '/netbsd -R compat_netbsd32 -T ld.script' exec_netbsd32_elf.o
modload -S -d -v -A '/netbsd -R compat_netbsd32 -T ld.script' compat_sunos32.o
modload -S -d -v -A '/netbsd -R compat_netbsd32 -R exec_netbsd32_aout -R compat_sunos32 -T ld.script' exec_sunos32_aout.o



i'll commit this work shortly.  it is somewhat invasive of, eg., locore.s,
and some MI files and needs to be reviewed, etc.  i'll check out svr4_32
soon, i've just never run any svr4_32 programs before, or setup /emul for
it...



.mrg.