[uClinux-dev] after call --strip-unneeded to a module, will the module still work?

David McCullough david_mccullough at au.securecomputing.com
Mon Jan 15 16:58:09 EST 2007


Jivin David Wu lays it down ...
> On Sun, 14 Jan 2007 17:37:49 -0500, David McCullough  
> <david_mccullough at au.securecomputing.com> wrote:
> 
> >
> >Jivin David Wu lays it down ...
> >>On Fri, 19 Jan 2007 13:39:56 -0500, Sagaert Johan  
> >><sagaert.j at belgacom.net>
> >>wrote:
> >>
> >>>Hi
> >>>
> >>>My problem was that the module compiled and was loaded, but did not  
> >>work.
> >>>adding the -S  fixed my problem.
> >>>
> >>Then it also proved that strip on modules caused problems for sure.
> >
> >Except it doesn't for any number of platforms that we use.
> >
> >Can you do some investigations as to why it is failing ?  Stripping
> >unneeded symbols from a module should not render it unloadable,  and if
> >it is knowing why will help us make the right fix :-)
> The problem seems to be related to the m68k-elf-strip(2.95.3) which  
> removes at least init_module and cleanup_module symbols after stripped  
> with --strip-unneeded. So the insmod (in busybox) couldn't find them, as a  
> result the kernel (2.4.x) sys_init_module() will not call the mod->init().
> 
> module stripped without --strip-unneeded:
> ------------------------------
> 00000000 ? __module_kernel_version
> 00000026 ? __module_license
> 0000001a ? __module_parm_lvpw
>          U __mulsi3
> 000001ea T cleanup_module
> 00000000 t clear_pixbuf
> 00000000 t gcc2_compiled.
> 0000007a T init_module
> 00000004 d lvpw
> 00000000 d mylcd
> 00000000 b old_lssa
> 00000008 d old_lvpw
> 0000000c D pixbuf
>          U printk
> 000001ea T test_module_fini
> 0000007a t test_module_init
> 
> module stripped with --strip-unneeded:
> ---------------------------------------
>          U __mulsi3
> 0000000c D pixbuf
>          U printk
> 
> (I added two debugging lines in insmod.c )
>         module->init =
>                 obj_symbol_final_value(f, obj_find_symbol(f, SPFX  
> "init_module"));
> printf("module->init=%p\n", module->init);
>         module->cleanup =
>                 obj_symbol_final_value(f, obj_find_symbol(f, SPFX  
> "cleanup_module"));
> printf("module->cleanup=%p\n", module->cleanup);
> 
> This is the output when installing the module.
> working case:
> ------------------------
> # insmod mc68x328lcd.o
> Using mc68x328lcd.o
> module->init=0x7bf0da
> module->cleanup=0x7bf24a
> Test Module init
> size of pixbuf(0X007bf38c) = 9600
> address of dmacr (a39) = 0xfffffa39
> value of lssa = 0x0
> value of lvpw was 0xff is now 0x3c
> value of lxmax was 0xf0  at 0xfffffa08
> value of lpolcf was 0x0  at 0xfffffa21
> value of lposr was 0x0  at 0xfffffa2d
> # lsmod
> Module                  Size  Used by
> mc68x328lcd            10564   0 (unused)
> 
> not working case:
> --------------------
> # insmod mc68x328lcd.o
> Using mc68x328lcd.o
> module->init=(nil)
> module->cleanup=(nil)
> # lsmod
> Module                  Size  Used by
> mc68x328lcd            10540   0 (unused)
> 
> But m68k-uclinux-strip( --version GNU strip 2.16.91 20060320) seems work  
> properly(I have tried to load the module after stripped with  
> --strip-unneeded)
> m68k-uclinux-nm mc68x328lcd.o:
> ---------------------------------
> 000001ea T cleanup_module
> 0000007a T init_module
> 0000001a R __module_parm_lvpw
>          U __mulsi3
> 0000000c D pixbuf
>          U printk
> 000001ea T test_module_fini
> # insmod mc68x328lcd.o
> Using mc68x328lcd.o
> module->init=0x7bf0da
> module->cleanup=0x7bf24a
> Test Module init
> size of pixbuf(0X007bf38c) = 9600
> address of dmacr (a39) = 0xfffffa39
> value of lssa = 0x0
> value of lvpw was 0xff is now 0x3c
> value of lxmax was 0xf0  at 0xfffffa08
> value of lpolcf was 0x0  at 0xfffffa21
> value of lposr was 0x0  at 0xfffffa2d
> 
> So David, what do you suggest to do? using newer compiler (we must know  
> strip works properly) or modify the Makefile (not strip modules with  
> --strip-unneeded)


The strip should work,  and is absolutely needed on some platforms that
put lots of junk into their modules.

I would try a newer toolchain,  then if that didn't work,  add a
workaround for the m68k,  somewhere in vendors/config/arch/m68knommu
if possible,  or at least keyed off that.

Cheers,
Davidm

> >>>----- Original Message -----
> >>>From: "David Wu" <davidwu at arcturusnetworks.com>
> >>>To: "uClinux development list" <uclinux-dev at uclinux.org>
> >>>Sent: Saturday, January 13, 2007 5:40 PM
> >>>Subject: Re: [uClinux-dev] after call --strip-unneeded to a module,will
> >>>the
> >>>module still work?
> >>>
> >>>
> >>>>Hi Johan,
> >>>>
> >>>>On Thu, 18 Jan 2007 04:41:08 -0500, Sagaert Johan
> >>>><sagaert.j at belgacom.net>
> >>>>wrote:
> >>>>
> >>>>> Hi
> >>>>>
> >>>>> Had the same :
> >>>>>
> >>>>> Just add  -S like here :
> >>>>>
> >>>>>   $(ROMFSINST) -S ../src/ssvhwa-demos/ssvhwa.o /lib/modules/ssvhwa.o
> >>>>>
> >>>>> this lis in trhe makefile in the vendors directory.
> >>>>My modules are in the kernel tree and installed by make  
> >>modules_install.
> >>>>The above line has nothing to do with modules_install I guess.
> >>>>
> >>>>>
> >>>>> Regards
> >>>>>  Johan
> >>>>>
> >>>>>
> >>>>> ----- Original Message -----
> >>>>> From: "David Wu" <davidwu at arcturusnetworks.com>
> >>>>> To: <uclinux-dev at uclinux.org>
> >>>>> Sent: Saturday, January 13, 2007 12:57 AM
> >>>>> Subject: [uClinux-dev] after call --strip-unneeded to a module,will
> >>>>the
> >>>>> module still work?
> >>>>>
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I'm using uClinux-dist-test-20061215.tar.bz2 release. The toplevel
> >>>>>> Makefile does a strip on the modules which casues my modules not
> >>>>>> working:(see this line in Makefile)
> >>>>>>
> >>>>>> find $(ROMFSDIR)/lib/modules -type f -name "*o" | xargs -r $(STRIP)
> >>>>-R
> >>>>>> .comment -R .note -g --strip-unneeded;
> >>>>>>
> >>>>>> Does anyone know if this is supposed to work? If it does then
> >>>>something
> >>>>>> might wrong with my modules.
> >>>>>>
> >>>>>> Thanks,
> >>>>>>
> >>>>>> --
> >>
> >>--
> >>David Wu
> 
> -- 
> David
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev

-- 
David McCullough,  david_mccullough at securecomputing.com,   Ph:+61 734352815
Secure Computing - SnapGear  http://www.uCdot.org http://www.cyberguard.com



More information about the uClinux-dev mailing list