tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

AW: modload under netbsd-5 appears not to export symbols from loaded modules for use by subsequent modules



Hi,

> Brian Buhrow wrotes:
>
> I'm working on bringing  some modules forward from NetBSD-3 to NetBSD-5. 
>
> Is there a reason why the linker can't see the symbols from the first
> module when loading the second module?  Is it easily worked around?
>
> #/etc/rc.d/lkm3 start 
> mod_zaptel.o: Module loaded as ID 0
> mod_ztdummy.o: /usr/pkg/lkm/mod_ztdummy.o: In function `ztdummy_timer':
> ... undefined reference to `zt_receive'

o we ran into the same? problem(s) as we ported some LKMs from 3.0 to 5.0
  [We dont use the /etc/rc.d/lkm* scripts but the problem may be the same]

o Our 'solution' was
  1) a fix in the kernel-sources: within src/sys/kern/kern_ksyms.c
     - ksyms_hdr.kh_shdr[SYMTAB].sh_info = ksyms_symsz / sizeof(Elf_Sym);
     + ksyms_hdr.kh_shdr[SYMTAB].sh_info = 0;

     This reverts a change that was introduced within version 1.36 of
     this file. ELF-docs stated, that sh_info (for section SYMTAB) should
     be "One greater than the symbol table index of the last local symbol
     (binding STB_LOCAL)". So 0 may be wrong, but much better than declaring
     ALL symbols as "local" symbols, so that the linker (invoked by modload)
     dont use them anymore.

  2) force the use of /dev/ksyms for linking - by "modload -A /dev/ksyms". At
     the end we removed the '#if 0' from the file src/sbin/modload/modload.c.
     We dont know why, but the (default) use of /dev/ksyms by modload (if no
     other kernel is given by "-A" )  was removed by #if 0 within the
     'latest' 5.0 sources/ISOs.

o This works for us with 5.0 - with the "user-space" LKM-linking modload.
  If there is an easier way ... we are also interested in ;-)
 
  If you allready try/use the new "in-kernel" LKM linking stuff (we dont
  know the state nor when/or by what scripts/configs this may be invoked)
  ... then forget all above.


best regards
:peter:

--------------------------------------------------------------------------------------------------
 
TELES AG Informationstechnologien
Ernst-Reuter-Platz 8
10587 Berlin
Web:     www.teles.de <http://www.teles.de>
--------------------------------------------------------------------------------------------------
Vorstand: Prof. Dr.-Ing. Sigram Schindler (Vorsitz), Richard Fahringer, Frank 
Paetsch, Olaf Schulz
Aufsichtsrat: Prof. Dr. Walter L. Rust (Vorsitz), Prof. Dr. Radu 
Popescu-Zeletin, Prof. Dr. Ralph N. Schindler 
Handelsregister: Amtsgericht Berlin Charlottenburg, HRB 60781  


Home | Main Index | Thread Index | Old Index