---------- Forwarded Message ---------- Subject: no bss cause strange values in insmod and ELF Date: Wed, 9 May 2001 09:47:05 +0300 From: Shay Deloya <shay@jungo.com> To: linux-mips@oss.sgi.com Continuing my previous problem... I have created a module with no bss , and compiled it with kernel 2.2. Comparing this module with same code that has bss and acts OK. Inserting the module with modutiles 2.2.2/ busybox insmod causes a relocation overflow message , the reasons are: 1.in function obj_relocate: corrupted intsym->secidx value (not the needed index in the ELF) for some .text segments, other segments get their index value OK. the ELF file seems to be OK. 2. in function arch_apply_relocation: the wrong index (secidx=1006a1e8) cause R_MIPS_26 symbols (jump commands) to have the value of obj_reloc_overflow and then causes relocation overflow. Does anyone knows why same module that has a variable in bss acts fine and the one without bss causes Relocation overflow in MIPS ? (in x86 there is no problem). Searching the code I see there is no initialization of the secidx , is it a problem of wrong reading of ELF files by insmod ? Attached the two ELF files , and obj_relocate values. Thanks, Shay Deloya ______________________________________ Software Developer Jungo - R&D email: shay@jungo.com web: http://www.jungo.com Phone: 1-877-514-0537(USA) +972-9-8859365(Worldwide) ext. 221 Fax: 1-877-514-0538(USA) +972-9-8859366(Worldwide) ------------------------------------------------------- -- Shay Deloya ______________________________________ Software Developer Jungo - R&D email: shayd@jungo.com web: http://www.jungo.com Phone: 1-877-514-0537(USA) +972-9-8859365(Worldwide) ext. 221 Fax: 1-877-514-0538(USA) +972-9-8859366(Worldwide)
ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: MIPS R3000 big-endian Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 4728 (bytes into file) Flags: 0x10000001, noreorder, mips2 Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 15 Section header string table index: 12 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000040 0005c0 00 AX 0 0 16 [ 2] .rel.text REL 00000000 001854 000518 08 13 1 4 [ 3] .data PROGBITS 00000000 000600 000050 00 WA 0 0 16 [ 4] .rel.data REL 00000000 001d6c 000038 08 13 3 4 [ 5] .bss NOBITS 00000000 000650 000000 00 WA 0 0 16 [ 6] .reginfo MIPS_REGINFO 00000000 000650 000018 01 A 0 0 4 [ 7] .mdebug MIPS_DEBUG 00000000 000668 000848 01 0 0 4 [ 8] .note NOTE 00000000 000eb0 000014 00 0 0 1 [ 9] .modinfo PROGBITS 00000000 000ec4 00001c 00 0 0 4 [10] .rodata PROGBITS 00000000 000ee0 0002f0 00 A 0 0 16 [11] .comment PROGBITS 00000000 0011d0 000035 00 0 0 1 [12] .shstrtab STRTAB 00000000 001205 000071 00 0 0 1 [13] .symtab SYMTAB 00000000 0014d0 000240 10 14 a 4 [14] .strtab STRTAB 00000000 001710 000141 00 0 0 1 There are no program headers in this file. There is no dynamic segment in this file. Relocation section '.rel.text' at offset 0x1854 contains 163 entries: Offset Info Type Symbol's Value Symbol's Name 00000008 00205 R_MIPS_HI16 00000000 .text 0000000c 00206 R_MIPS_LO16 00000000 .text 00000028 00305 R_MIPS_HI16 00000000 .data 0000002c 00306 R_MIPS_LO16 00000000 .data 00000038 00305 R_MIPS_HI16 00000000 .data 0000003c 00306 R_MIPS_LO16 00000000 .data 00000048 00405 R_MIPS_HI16 00000000 .rodata 0000004c 00406 R_MIPS_LO16 00000000 .rodata 00000050 01c05 R_MIPS_HI16 00000000 printk 00000054 01c06 R_MIPS_LO16 00000000 printk 00000060 01d05 R_MIPS_HI16 00000000 __this_module 00000064 01d06 R_MIPS_LO16 00000000 __this_module 00000094 00204 R_MIPS_26 00000000 .text 0000009c 01d05 R_MIPS_HI16 00000000 __this_module 000000a0 01d06 R_MIPS_LO16 00000000 __this_module 000000ac 00405 R_MIPS_HI16 00000000 .rodata 000000b0 00406 R_MIPS_LO16 00000000 .rodata 000000b4 01c05 R_MIPS_HI16 00000000 printk 000000b8 01c06 R_MIPS_LO16 00000000 printk 000000c8 01e05 R_MIPS_HI16 00000000 atm_dev_deregister 000000cc 01e06 R_MIPS_LO16 00000000 atm_dev_deregister 000000d8 01f05 R_MIPS_HI16 00000000 kfree 000000dc 01f06 R_MIPS_LO16 00000000 kfree 000000e8 00305 R_MIPS_HI16 00000000 .data 000000ec 00306 R_MIPS_LO16 00000000 .data 000000f8 00405 R_MIPS_HI16 00000000 .rodata 000000fc 00406 R_MIPS_LO16 00000000 .rodata 00000100 01c05 R_MIPS_HI16 00000000 printk 00000104 01c06 R_MIPS_LO16 00000000 printk 00000120 00305 R_MIPS_HI16 00000000 .data 00000124 00306 R_MIPS_LO16 00000000 .data 0000013c 00405 R_MIPS_HI16 00000000 .rodata 00000140 00406 R_MIPS_LO16 00000000 .rodata 00000144 01c05 R_MIPS_HI16 00000000 printk 00000148 01c06 R_MIPS_LO16 00000000 printk 00000158 02005 R_MIPS_HI16 00000000 kmalloc 0000015c 02006 R_MIPS_LO16 00000000 kmalloc 00000174 00405 R_MIPS_HI16 00000000 .rodata 00000178 00406 R_MIPS_LO16 00000000 .rodata 0000017c 01c05 R_MIPS_HI16 00000000 printk 00000180 01c06 R_MIPS_LO16 00000000 printk 0000018c 00204 R_MIPS_26 00000000 .text 00000194 00405 R_MIPS_HI16 00000000 .rodata 00000198 00406 R_MIPS_LO16 00000000 .rodata 000001a0 00305 R_MIPS_HI16 00000000 .data 000001a4 00306 R_MIPS_LO16 00000000 .data 000001a8 02105 R_MIPS_HI16 00000000 atm_dev_register 000001ac 02106 R_MIPS_LO16 00000000 atm_dev_register 000001c8 00205 R_MIPS_HI16 00000000 .text 000001cc 00206 R_MIPS_LO16 00000000 .text 000001d4 02305 R_MIPS_HI16 00000000 request_irq 000001d8 02306 R_MIPS_LO16 00000000 request_irq 000001ec 00405 R_MIPS_HI16 00000000 .rodata 000001f0 00406 R_MIPS_LO16 00000000 .rodata 000001f4 01c05 R_MIPS_HI16 00000000 printk 000001f8 01c06 R_MIPS_LO16 00000000 printk 00000204 00204 R_MIPS_26 00000000 .text 0000020c 00305 R_MIPS_HI16 00000000 .data 00000210 00306 R_MIPS_LO16 00000000 .data 00000214 00305 R_MIPS_HI16 00000000 .data 00000218 00306 R_MIPS_LO16 00000000 .data 00000224 00405 R_MIPS_HI16 00000000 .rodata 00000228 00406 R_MIPS_LO16 00000000 .rodata 0000022c 01c05 R_MIPS_HI16 00000000 printk 00000230 01c06 R_MIPS_LO16 00000000 printk 00000254 00305 R_MIPS_HI16 00000000 .data 00000258 00306 R_MIPS_LO16 00000000 .data 00000268 00405 R_MIPS_HI16 00000000 .rodata 0000026c 00406 R_MIPS_LO16 00000000 .rodata 00000270 01c05 R_MIPS_HI16 00000000 printk 00000274 01c06 R_MIPS_LO16 00000000 printk 00000280 00305 R_MIPS_HI16 00000000 .data 00000284 00306 R_MIPS_LO16 00000000 .data 00000290 00405 R_MIPS_HI16 00000000 .rodata 00000294 00406 R_MIPS_LO16 00000000 .rodata 00000298 01c05 R_MIPS_HI16 00000000 printk 0000029c 01c06 R_MIPS_LO16 00000000 printk 000002b8 00305 R_MIPS_HI16 00000000 .data 000002bc 00306 R_MIPS_LO16 00000000 .data 000002cc 00405 R_MIPS_HI16 00000000 .rodata 000002d0 00406 R_MIPS_LO16 00000000 .rodata 000002d4 01c05 R_MIPS_HI16 00000000 printk 000002d8 01c06 R_MIPS_LO16 00000000 printk 000002e4 00305 R_MIPS_HI16 00000000 .data 000002e8 00306 R_MIPS_LO16 00000000 .data 000002f4 00405 R_MIPS_HI16 00000000 .rodata 000002f8 00406 R_MIPS_LO16 00000000 .rodata 000002fc 01c05 R_MIPS_HI16 00000000 printk 00000300 01c06 R_MIPS_LO16 00000000 printk 00000318 00305 R_MIPS_HI16 00000000 .data 0000031c 00306 R_MIPS_LO16 00000000 .data 0000032c 00405 R_MIPS_HI16 00000000 .rodata 00000330 00406 R_MIPS_LO16 00000000 .rodata 00000334 01c05 R_MIPS_HI16 00000000 printk 00000338 01c06 R_MIPS_LO16 00000000 printk 00000348 01d05 R_MIPS_HI16 00000000 __this_module 0000034c 01d06 R_MIPS_LO16 00000000 __this_module 00000368 00305 R_MIPS_HI16 00000000 .data 0000036c 00306 R_MIPS_LO16 00000000 .data 0000037c 00405 R_MIPS_HI16 00000000 .rodata 00000380 00406 R_MIPS_LO16 00000000 .rodata 00000384 01c05 R_MIPS_HI16 00000000 printk 00000388 01c06 R_MIPS_LO16 00000000 printk 000003a4 00305 R_MIPS_HI16 00000000 .data 000003a8 00306 R_MIPS_LO16 00000000 .data 000003b8 00405 R_MIPS_HI16 00000000 .rodata 000003bc 00406 R_MIPS_LO16 00000000 .rodata 000003c0 01c05 R_MIPS_HI16 00000000 printk 000003c4 01c06 R_MIPS_LO16 00000000 printk 000003d4 01d05 R_MIPS_HI16 00000000 __this_module 000003d8 01d06 R_MIPS_LO16 00000000 __this_module 000003f4 00305 R_MIPS_HI16 00000000 .data 000003f8 00306 R_MIPS_LO16 00000000 .data 00000408 00405 R_MIPS_HI16 00000000 .rodata 0000040c 00406 R_MIPS_LO16 00000000 .rodata 00000410 01c05 R_MIPS_HI16 00000000 printk 00000414 01c06 R_MIPS_LO16 00000000 printk 0000042c 00305 R_MIPS_HI16 00000000 .data 00000430 00306 R_MIPS_LO16 00000000 .data 00000440 00405 R_MIPS_HI16 00000000 .rodata 00000444 00406 R_MIPS_LO16 00000000 .rodata 00000448 01c05 R_MIPS_HI16 00000000 printk 0000044c 01c06 R_MIPS_LO16 00000000 printk 00000458 00305 R_MIPS_HI16 00000000 .data 0000045c 00306 R_MIPS_LO16 00000000 .data 00000468 00405 R_MIPS_HI16 00000000 .rodata 0000046c 00406 R_MIPS_LO16 00000000 .rodata 00000470 01c05 R_MIPS_HI16 00000000 printk 00000474 01c06 R_MIPS_LO16 00000000 printk 00000490 00305 R_MIPS_HI16 00000000 .data 00000494 00306 R_MIPS_LO16 00000000 .data 000004a4 00405 R_MIPS_HI16 00000000 .rodata 000004a8 00406 R_MIPS_LO16 00000000 .rodata 000004ac 01c05 R_MIPS_HI16 00000000 printk 000004b0 01c06 R_MIPS_LO16 00000000 printk 000004bc 00305 R_MIPS_HI16 00000000 .data 000004c0 00306 R_MIPS_LO16 00000000 .data 000004cc 00405 R_MIPS_HI16 00000000 .rodata 000004d0 00406 R_MIPS_LO16 00000000 .rodata 000004d4 01c05 R_MIPS_HI16 00000000 printk 000004d8 01c06 R_MIPS_LO16 00000000 printk 000004f4 00305 R_MIPS_HI16 00000000 .data 000004f8 00306 R_MIPS_LO16 00000000 .data 0000050c 00405 R_MIPS_HI16 00000000 .rodata 00000510 00406 R_MIPS_LO16 00000000 .rodata 00000514 01c05 R_MIPS_HI16 00000000 printk 00000518 01c06 R_MIPS_LO16 00000000 printk 00000524 00305 R_MIPS_HI16 00000000 .data 00000528 00306 R_MIPS_LO16 00000000 .data 00000534 00405 R_MIPS_HI16 00000000 .rodata 0000053c 00406 R_MIPS_LO16 00000000 .rodata 00000550 00305 R_MIPS_HI16 00000000 .data 00000554 00306 R_MIPS_LO16 00000000 .data 00000564 00405 R_MIPS_HI16 00000000 .rodata 00000568 00406 R_MIPS_LO16 00000000 .rodata 0000056c 01c05 R_MIPS_HI16 00000000 printk 00000570 01c06 R_MIPS_LO16 00000000 printk 0000057c 00305 R_MIPS_HI16 00000000 .data 00000580 00306 R_MIPS_LO16 00000000 .data 0000058c 00405 R_MIPS_HI16 00000000 .rodata 00000590 00406 R_MIPS_LO16 00000000 .rodata 00000594 01c05 R_MIPS_HI16 00000000 printk 00000598 01c06 R_MIPS_LO16 00000000 printk Relocation section '.rel.data' at offset 0x1d6c contains 7 entries: Offset Info Type Symbol's Value Symbol's Name 00000008 00202 R_MIPS_32 00000000 .text 0000000c 00202 R_MIPS_32 00000000 .text 00000010 00202 R_MIPS_32 00000000 .text 0000001c 00202 R_MIPS_32 00000000 .text 00000028 00202 R_MIPS_32 00000000 .text 0000002c 00202 R_MIPS_32 00000000 .text 0000003c 00202 R_MIPS_32 00000000 .text Symbol table '.symtab' contains 36 entries: Num: Value Size Type Bind Ot Ndx Name 0: 0 0 NOTYPE LOCAL 0 UND 1: 0 0 SECTION LOCAL 0 9 2: 0 0 SECTION LOCAL 0 1 text 3: 0 0 SECTION LOCAL 0 3 data 4: 0 0 SECTION LOCAL 0 10 rodata 5: 0 0 SECTION LOCAL 0 5 bss 6: 0 0 SECTION LOCAL 0 6 7: 0 0 SECTION LOCAL 0 7 8: 0 0 SECTION LOCAL 0 8 9: 0 0 SECTION LOCAL 0 11 10: 0 0 NOTYPE LOCAL 0 1 gcc2_compiled. 11: 0 0 NOTYPE LOCAL 0 1 __gnu_compiled_c 12: 0 28 OBJECT GLOBAL 0 9 __module_kernel_version 13: 0 4 OBJECT LOCAL 0 10 _bonito 14: 0 4 OBJECT LOCAL 0 3 display_string 15: 4 60 OBJECT LOCAL 0 3 atm_ops 16: 318 140 FUNC LOCAL 0 1 idd_open 17: 3a4 136 FUNC LOCAL 0 1 idd_close 18: 490 100 FUNC LOCAL 0 1 idd_ioctl 19: 254 100 FUNC LOCAL 0 1 idd_send 20: 4f4 92 FUNC LOCAL 0 1 idd_phy_put 21: 550 100 FUNC LOCAL 0 1 idd_phy_get 22: 42c 100 FUNC LOCAL 0 1 idd_proc_read 23: 40 4 OBJECT GLOBAL 0 3 the_card 24: 44 4 OBJECT GLOBAL 0 3 dbg_lvl 25: 0 40 FUNC GLOBAL 0 1 init_module 26: 120 308 FUNC LOCAL 0 1 idd_init_card 27: 28 248 FUNC GLOBAL 0 1 cleanup_module 28: 0 0 OBJECT GLOBAL 0 UND printk 29: 0 0 OBJECT GLOBAL 0 UND __this_module 30: 0 0 OBJECT GLOBAL 0 UND atm_dev_deregister 31: 0 0 OBJECT GLOBAL 0 UND kfree 32: 0 0 OBJECT GLOBAL 0 UND kmalloc 33: 0 0 OBJECT GLOBAL 0 UND atm_dev_register 34: 2b8 96 FUNC LOCAL 0 1 idd_irq_handler 35: 0 0 OBJECT GLOBAL 0 UND request_irq No version information found in this file.
Values of intsym in obj_relocate , just before the call to obj_symbol_final_value function ========================================================================================== NO BSS Relocation overflow ========================== obj_relocate: baseaddr=c0015000 relocation all sections with this addr obj_relocate: section=.symtab relend=268866256 obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1006a1e8 obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1006a1e8 obj_relocate: intsym->name=.data,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=.data,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=.data,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=.data,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=.rodata,symndx=4 intsym->secidx=a obj_relocate: intsym->name=.rodata,symndx=4 intsym->secidx=a obj_relocate: intsym->name=printk,symndx=28 intsym->secidx=10000 obj_relocate: intsym->name=printk,symndx=28 intsym->secidx=10000 obj_relocate: intsym->name=__this_module,symndx=29 intsym->secidx=f obj_relocate: intsym->name=__this_module,symndx=29 intsym->secidx=f obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1006a1e8 With BSS good execution ======================= obj_relocate: section=.symtab relend=268866256 obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1 obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1 obj_relocate: intsym->name=,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=,symndx=3 intsym->secidx=3 obj_relocate: intsym->name=.rodata,symndx=4 intsym->secidx=a obj_relocate: intsym->name=.rodata,symndx=4 intsym->secidx=a obj_relocate: intsym->name=printk,symndx=27 intsym->secidx=10000 obj_relocate: intsym->name=printk,symndx=27 intsym->secidx=10000 obj_relocate: intsym->name=__this_module,symndx=28 intsym->secidx=f obj_relocate: intsym->name=__this_module,symndx=28 intsym->secidx=f obj_relocate: intsym->name=.text,symndx=2 intsym->secidx=1