Hi Ok I do that: /opt/m68k-uclinux-tools-20060615/bin/m68k-uclinux-objdump -D xx.o
ucAsserv.o: file format elf32-m68k Disassembly of section .text: 00000000 <init_module>: 0: 4e56 0000 linkw %fp,#0 4: 42b9 0000 0000 clrl 0 <init_module> a: 42b9 0000 0000 clrl 0 <init_module> 10: 42b9 0000 0000 clrl 0 <init_module> 16: 4879 0000 0000 pea 0 <init_module> 1c: 4eb9 0000 0000 jsr 0 <init_module> 22: 588f addql #4,%sp 24: 2039 0000 0000 movel 0 <init_module>,%d0 2a: 4c39 0800 0000 mulsl 0 <init_module>,%d0 30: 0000 32: 23c0 0000 0000 movel %d0,0 <init_module> 38: 4879 0000 0000 pea 0 <init_module> 3e: 4eb9 0000 0000 jsr 0 <init_module> 44: 588f addql #4,%sp 46: 4280 clrl %d0 48: 6000 0002 braw 4c <init_module+0x4c> 4c: 4e5e unlk %fp 4e: 4e75 rts 00000050 <cleanup_module>: 50: 4e56 0000 linkw %fp,#0 54: 4e5e unlk %fp 56: 4e75 rts Disassembly of section .bss: 00000000 <global_right_encoder>: 0: 0000 0000 orib #0,%d0 00000004 <global_left_encoder>: 4: 0000 0000 orib #0,%d0 00000008 <VitL>: 8: 0000 0000 orib #0,%d0 Disassembly of section .modinfo: 00000000 <__module_kernel_version>: 0: 6b65 bmis 67 <cleanup_module+0x17> 2: 726e moveq #110,%d1 4: 656c bcss 72 <cleanup_module+0x22> 6: 5f76 6572 7369 subqw #7,%fp@(73696f6e)@(00003d32) c: 6f6e 3d32 10: 2e34 2e33 movel %a4@(00000033,%d2:l:8),%d7 14: 312d 7563 movew %a5@(30051),[EMAIL PROTECTED] 18: 302d 414e movew %a5@(16718),%d0 1c: 492d 3130 chkl %a5@(12592),%d4 ... 00000021 <__module_author>: 21: 6175 bsrs 98 <cleanup_module+0x48> 23: 7468 moveq #104,%d2 25: 6f72 bles 99 <cleanup_module+0x49> 27: 3d53 7465 movew %a3@,%fp@(29797) 2b: 7068 moveq #104,%d0 2d: 616e bsrs 9d <cleanup_module+0x4d> 2f: 6520 bcss 51 <cleanup_module+0x1> 31: 4765 043545 33: 726d moveq #109,%d1 35: 6169 bsrs a0 <cleanup_module+0x50> 37: 6e00 6c69 bgtw 6ca2 <cleanup_module+0x6c52> 00000039 <__module_license>: 39: 6c69 bges a4 <cleanup_module+0x54> 3b: 6365 blss a2 <cleanup_module+0x52> 3d: 6e73 bgts b2 <cleanup_module+0x62> 3f: 653d bcss 7e <cleanup_module+0x2e> 41: 4750 043520 43: Address 0x00000045 is out of bounds. Disassembly of section .rodata: 00000000 <.rodata>: 0: 3c36 3e42 movew %fp@(00000042,%d3:l:8),%d6 4: 7567 mvsw [EMAIL PROTECTED],%d2 6: 3a0a movew %a2,%d5 8: 003c 363e orib #62,%ccr c: 4e65 movel %a5,%usp e: 7665 moveq #101,%d3 10: 7220 moveq #32,%d1 12: 5265 addqw #1,[EMAIL PROTECTED] 14: 6163 bsrs 79 <cleanup_module+0x29> 16: 680a bvcs 22 <__module_author+0x1> ... Disassembly of section .comment: 00000000 <.comment>: 0: 0047 4343 oriw #17219,%d7 4: 3a20 movew [EMAIL PROTECTED],%d5 6: 2847 moveal %d7,%a4 8: 4e55 2920 linkw %a5,#10528 c: 322e 3935 movew %fp@(14645),%d1 10: 2e33 2032 movel %a3@(00000032,%d2:w),%d7 14: 3030 3130 3331 movew %a0@(33313520,%d3:w),%d0 1a: 3520 1c: 2872 656c 6561 moveal %a2@(00006561)@(00000000),%a4 22: 7365 mvsw [EMAIL PROTECTED],%d1 24: 2928 436f movel %a0@(17263),[EMAIL PROTECTED] 28: 6c64 bges 8e <.comment+0x8e> 2a: 4669 7265 notw %a1@(29285) 2e: 2070 6174 6368 moveal %a0@(63686573)@(00000000),%a0 34: 6573 36: 202d 2032 movel %a5@(8242),%d0 3a: 3030 3130 3331 movew %a0@(33313820,%d3:w),%d0 40: 3820 42: 6672 bnes b6 <cleanup_module+0x66> 44: 6f6d bles b3 <cleanup_module+0x63> 46: 2068 7474 moveal %a0@(29812),%a0 4a: 703a moveq #58,%d0 4c: 2f2f 6669 movel %sp@(26217),[EMAIL PROTECTED] 50: 6464 bccs b6 <cleanup_module+0x66> 52: 6573 bcss c7 <cleanup_module+0x77> 54: 2e6e 6574 moveal %fp@(25972),%sp 58: 2f63 6f6c movel [EMAIL PROTECTED],%sp@(28524) 5c: 6466 bccs c4 <cleanup_module+0x74> 5e: 6972 bvss d2 <cleanup_module+0x82> 60: 652f bcss 91 <.comment+0x91> 62: 2928 7543 movel %a0@(30019),[EMAIL PROTECTED] 66: 6c69 bges d1 <cleanup_module+0x81> 68: 6e75 bgts df <cleanup_module+0x8f> 6a: 7820 moveq #32,%d4 6c: 5849 addqw #4,%a1 6e: 5020 addqb #8,[EMAIL PROTECTED] 70: 616e bsrs e0 <cleanup_module+0x90> 72: 6420 bccs 94 <.comment+0x94> 74: 7368 6172 mvsw %a0@(24946),%d1 78: 6564 bcss de <cleanup_module+0x8e> 7a: 206c 6962 moveal %a4@(26978),%a0 7e: 2070 6174 6368 moveal %a0@(63686573)@(00000000),%a0 84: 6573 86: 2066 moveal [EMAIL PROTECTED],%a0 88: 726f moveq #111,%d1 8a: 6d20 blts ac <cleanup_module+0x5c> 8c: 6874 bvcs 102 <cleanup_module+0xb2> 8e: 7470 moveq #112,%d2 90: 3a2f 2f77 movew %sp@(12151),%d5 94: 7777 2e73 mvsw %sp@(00000073,%d2:l:8),%d3 98: 6e61 bgts fb <cleanup_module+0xab> 9a: 7067 moveq #103,%d0 9c: 6561 bcss ff <cleanup_module+0xaf> 9e: 722e moveq #46,%d1 a0: 636f blss 111 <cleanup_module+0xc1> a2: 6d2f blts d3 <cleanup_module+0x83> a4: 2900 movel %d0,[EMAIL PROTECTED] Wolfgang Reissnegger a écrit : > Hi, > > try to use "objdump -D xx..o" > > You should see the disassembled section of module_init. > > Stéphane wrote: >> Hi >> >> I don't exactly know but: >> >> objdump -sx xx.o : >> >> ucAsserv.o: file format elf32-big >> ucAsserv.o >> architecture: UNKNOWN!, flags 0x00000011: >> HAS_RELOC, HAS_SYMS >> start address 0x00000000 >> >> Sections: >> Idx Name Size VMA LMA File off Algn >> 0 .text 00000058 00000000 00000000 00000034 2**2 >> CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE >> 1 ..data 00000000 00000000 00000000 0000008c 2**2 >> CONTENTS, ALLOC, LOAD, DATA >> 2 .bss 0000000c 00000000 00000000 0000008c 2**2 >> ALLOC >> 3 .modinfo 00000045 00000000 00000000 0000008c 2**0 >> CONTENTS, ALLOC, LOAD, READONLY, DATA >> 4 .rodata 00000019 00000000 00000000 000000d1 2**0 >> CONTENTS, ALLOC, LOAD, READONLY, DATA >> 5 .comment 000000a6 00000000 00000000 000000ea 2**0 >> CONTENTS, READONLY >> SYMBOL TABLE: >> 00000000 l df *ABS* 00000000 ucAsserv.c >> 00000000 l d .text 00000000 .text >> 00000000 l d .data 00000000 .data >> 00000000 l d .bss 00000000 .bss >> 00000000 l .text 00000000 gcc2_compiled. >> 00000000 l d .modinfo 00000000 .modinfo >> 00000000 l O .modinfo 00000021 __module_kernel_version >> 00000000 l d .rodata 00000000 .rodata >> 00000008 l O .bss 00000004 VitL >> 00000004 l O .bss 00000004 global_left_encoder >> 00000000 l O .bss 00000004 global_right_encoder >> 00000039 l O .modinfo 0000000c __module_license >> 00000000 l d .comment 00000000 .comment >> 00000000 g F .text 00000050 init_module >> 00000000 *UND* 00000000 printk >> 00000050 g F .text 00000008 cleanup_module >> 00000021 g O .modinfo 00000018 __module_author >> >> >> RELOCATION RECORDS FOR [.text]: >> OFFSET TYPE VALUE >> 00000006 UNKNOWN .bss+0x00000008 >> 0000000c UNKNOWN .bss+0x00000004 >> 00000012 UNKNOWN .bss >> 00000018 UNKNOWN .rodata >> 0000001e UNKNOWN printk >> 00000026 UNKNOWN .bss+0x00000004 >> 0000002e UNKNOWN .bss >> 00000034 UNKNOWN .bss+0x00000008 >> 0000003a UNKNOWN .rodata+0x00000009 >> 00000040 UNKNOWN printk >> >> >> Contents of section .text: >> 0000 4e560000 42b90000 000042b9 00000000 NV..B.....B..... >> 0010 42b90000 00004879 00000000 4eb90000 B.....Hy....N... >> 0020 0000588f 20390000 00004c39 08000000 ..X. 9....L9.... >> 0030 000023c0 00000000 48790000 00004eb9 ..#.....Hy....N. >> 0040 00000000 588f4280 60000002 4e5e4e75 ....X.B.`...N^Nu >> 0050 4e560000 4e5e4e75 NV..N^Nu Contents of >> section .modinfo: >> 0000 6b65726e 656c5f76 65727369 6f6e3d32 kernel_version=2 >> 0010 2e342e33 312d7563 302d414e 492d3130 .4.31-uc0-ANI-10 >> 0020 00617574 686f723d 53746570 68616e65 .author=Stephane >> 0030 20476572 6d61696e 006c6963 656e7365 Germain.license >> 0040 3d47504c 00 =GPL. Contents of >> section .rodata: >> 0000 3c363e42 75673a0a 003c363e 4e657665 <6>Bug:..<6>Neve >> 0010 72205265 6163680a 00 r Reach.. Contents of >> section .comment: >> 0000 00474343 3a202847 4e552920 322e3935 .GCC: (GNU) 2.95 >> 0010 2e332032 30303130 33313520 2872656c .3 20010315 (rel >> 0020 65617365 2928436f 6c644669 72652070 ease)(ColdFire p >> 0030 61746368 6573202d 20323030 31303331 atches - 2001031 >> 0040 38206672 6f6d2068 7474703a 2f2f6669 8 from http://fi >> 0050 64646573 2e6e6574 2f636f6c 64666972 ddes.net/coldfir >> 0060 652f2928 75436c69 6e757820 58495020 e/)(uClinux XIP >> 0070 616e6420 73686172 6564206c 69622070 and shared lib p >> 0080 61746368 65732066 726f6d20 68747470 atches from http >> 0090 3a2f2f77 77772e73 6e617067 6561722e ://www.snapgear. >> 00a0 636f6d2f 2900 com/). >> >> >> >> >> >> Wolfgang Reissnegger a écrit : >>> Hi Stéphane, >>> >>> can you also generate an objdump of the module and post it? >>> >>> Stéphane wrote: >>>> Hmm, >>>> >>>> In Makefile: >>>> >>>> /********************/ >>>> >>>> INCLUDE := -isystem ../uClinux-dist-20060803/linux-2.4.x/include >>>> CFLAGS := -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE} >>>> CC := /opt/uClinux-m68k-elf/bin/m68k-elf-gcc >>>> ${TARGET}.o: ${TARGET}.c >>>> >>>> /************************/ >>>> >>>> and with -S : >>>> >>>> /*****************************************/ >>>> >>>> .file "ucAsserv.c" >>>> gcc2_compiled.: >>>> .section .modinfo,"a",@progbits >>>> .type __module_kernel_version,@object >>>> .size __module_kernel_version,33 >>>> __module_kernel_version: >>>> .string "kernel_version=2.4.31-uc0-ANI-10" >>>> .section .rodata >>>> .LC0: >>>> .string "<6>Bug:\n" >>>> .LC1: >>>> .string "<6>Never Reach\n" >>>> .text >>>> .align 2 >>>> .globl init_module >>>> .type init_module,@function >>>> init_module: >>>> link.w %a6,#0 >>>> clr.l VitL >>>> clr.l global_left_encoder >>>> clr.l global_right_encoder >>>> pea .LC0 >>>> jsr printk >>>> addq.l #4,%sp >>>> move.l global_left_encoder,%d0 >>>> muls.l global_right_encoder,%d0 >>>> move.l %d0,VitL >>>> pea .LC1 >>>> jsr printk >>>> addq.l #4,%sp >>>> clr.l %d0 >>>> jbra .L95 >>>> .align 2 >>>> .L95: >>>> unlk %a6 >>>> rts >>>> .Lfe1: >>>> .size init_module,.Lfe1-init_module >>>> .align 2 >>>> .globl cleanup_module >>>> .type cleanup_module,@function >>>> cleanup_module: >>>> link.w %a6,#0 >>>> .L96: >>>> unlk %a6 >>>> rts >>>> .Lfe2: >>>> .size cleanup_module,.Lfe2-cleanup_module >>>> .globl __module_author >>>> .section .modinfo >>>> .type __module_author,@object >>>> .size __module_author,24 >>>> __module_author: >>>> .string "author=Stephane Germain" >>>> .type __module_license,@object >>>> .size __module_license,12 >>>> __module_license: >>>> .string "license=GPL" >>>> .local global_right_encoder >>>> .comm global_right_encoder,4,2 >>>> .local global_left_encoder >>>> .comm global_left_encoder,4,2 >>>> .local VitL >>>> .comm VitL,4,2 >>>> .ident "GCC: (GNU) 2.95.3 20010315 (release)(ColdFire >>>> patches - >>>> 20010318 from >>>> http://fiddes.net/coldfire/)(uClinux XIP and shared lib patches from >>>> http://www.snapgear.com/)" >>>> >>>> /***************************************************/ >>>> >>>> >>>> I use the default toolchain >>>> >>>> /opt/uClinux-m68k-elf/bin/m68k-elf-gcc -v : >>>> Reading specs from >>>> /opt/uClinux-m68k-elf/lib/gcc-lib/m68k-elf/2.95.3/specs >>>> gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from >>>> http://fiddes.net/coldfire/)(uClinux XIP >>>> and shared lib patches from http://www.snapgear.com/) >>>> >>>> thanks >>>> >>>> >>>> Wolfgang Reissnegger a écrit : >>>>> Hi Stéphane, >>>>> >>>>> looks like you are compiling your code with compiler flags that >>>>> generate instructions that the processor does not support. That's why >>>>> you see the illegal instruction trap. >>>>> >>>>> The reason that it all works if the variables are local is probably >>>>> that you also use an optimization flag (e.g. -O3) that causes the >>>>> compiler to optimize the whole multiplication away in main because it >>>>> has no effect on the function's result and is local to the function. >>>>> >>>>> You should try to compile the code with gcc -S to generate assembler >>>>> output. Then you can identify the instruction that causes the >>>>> problem. >>>>> >>>>> Cheers, >>>>> Wolfgang >>>>> >>>>> Stéphane wrote: >>>>>> Hi, >>>>>> >>>>>> I have a bug that I can be resume as: >>>>>> >>>>>> /***************************/ >>>>>> #include <linux/module.h> // Needed by all modules >>>>>> #include <linux/kernel.h> // Needed for KERN_INFO >>>>>> >>>>>> static long global_right_encoder; >>>>>> static long global_left_encoder; >>>>>> static long VitL; >>>>>> >>>>>> int init_module(void) >>>>>> { >>>>>> VitL = 0; >>>>>> global_left_encoder = 0; >>>>>> global_right_encoder = 0; >>>>>> >>>>>> printk(KERN_INFO "Bug:\n"); >>>>>> VitL = global_left_encoder*global_right_encoder; >>>>>> printk(KERN_INFO "Never Reach\n"); >>>>>> return 0; >>>>>> } >>>>>> >>>>>> >>>>>> void cleanup_module(void) >>>>>> { >>>>>> } >>>>>> >>>>>> MODULE_AUTHOR("Stephane Germain"); >>>>>> MODULE_LICENSE("GPL"); >>>>>> /**********************************/ >>>>>> >>>>>> result: >>>>>> >>>>>> insmod xxx.o: >>>>>> SIGSEGV >>>>>> >>>>>> dmesg: >>>>>> Bug: >>>>>> *** ILLEGAL INSTRUCTION *** FORMAT=0 >>>>>> Current process id is 47 >>>>>> BAD KERNEL TRAP: 00000000 >>>>>> PC: [<000a8bec>] >>>>>> SR: 2014 SP: 007dbee8 a2: 10c16b34 >>>>>> d0: 00000000 d1: 00000991 d2: 00000000 d3: ffffffea >>>>>> d4: 00000060 d5: 00000008 a0: 0003dc8c a1: 0003dca8 >>>>>> Process insmod (pid: 47, stackpage=007db000) >>>>>> Frame format=0 >>>>>> Stack from 007dbf1c: >>>>>> 000a8c14 007d3000 007dbfc4 10c17856 007c5348 00102428 >>>>>> 007c5348 >>>>>> 000000e8 >>>>>> 00000002 00000001 007da000 00192e00 007c51c0 00190004 >>>>>> 00140560 >>>>>> 0015fae0 >>>>>> 007d3000 007d4000 00000060 0003dd58 000a8bc0 000000e8 >>>>>> 00000000 >>>>>> 00000000 >>>>>> 00000000 00000000 00000000 00000000 00000000 00000000 >>>>>> 00000000 >>>>>> 00000000 >>>>>> 00000000 00000000 00000000 00000000 00000000 00000000 >>>>>> 00000000 >>>>>> 00000000 >>>>>> 00000000 00000000 0019fdc8 10c127d2 00192e00 007c5348 >>>>>> 00102428 >>>>>> 007c5348 >>>>>> Call Trace: >>>>>> [<10c17856>] [<10c127d2>] >>>>>> Code: 4c39 0800 000a 8c3c 23c0 000a 8c44 4879 000a 8c1d >>>>>> >>>>>> /*****************************/ >>>>>> >>>>>> >>>>>> if the variables are local, all work! >>>>>> >>>>>> Somebody know something that I don't about that? >>>>>> >>>>>> Thanks >>>>>> >>>>>> Stephane Germain >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> uClinux-dev mailing list >>>>>> uClinux-dev@uclinux.org >>>>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>>>> This message was resent by uclinux-dev@uclinux.org >>>>>> To unsubscribe see: >>>>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>>>> _______________________________________________ >>>>> uClinux-dev mailing list >>>>> uClinux-dev@uclinux.org >>>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>>> This message was resent by uclinux-dev@uclinux.org >>>>> To unsubscribe see: >>>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>>>> >>>>> >>>> _______________________________________________ >>>> uClinux-dev mailing list >>>> uClinux-dev@uclinux.org >>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>> This message was resent by uclinux-dev@uclinux.org >>>> To unsubscribe see: >>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>> _______________________________________________ >>> uClinux-dev mailing list >>> uClinux-dev@uclinux.org >>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>> This message was resent by uclinux-dev@uclinux.org >>> To unsubscribe see: >>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>> >>> >> >> _______________________________________________ >> uClinux-dev mailing list >> uClinux-dev@uclinux.org >> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >> This message was resent by uclinux-dev@uclinux.org >> To unsubscribe see: >> http://mailman.uclinux.org/mailman/options/uclinux-dev > > _______________________________________________ > uClinux-dev mailing list > uClinux-dev@uclinux.org > http://mailman.uclinux.org/mailman/listinfo/uclinux-dev > This message was resent by uclinux-dev@uclinux.org > To unsubscribe see: > http://mailman.uclinux.org/mailman/options/uclinux-dev > > _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev