On Sat, 2005-06-11 at 15:02 +0800, yaofangbing 45175 wrote: > Hi Ranmana: > > > The linker does not know 6 words are relocated. The linker only knows > > that there are 6 relocations to be performed. > > there has only one relocation about this, > other R_MIPS_HI16 and R_MIPS_LO16 relocation is for procedure call. Its for the parameters you have. The parameters are stored in rodata and you need to create relocs to load them into the correpsonding registers. You cannot move a 32 bit quantity straight off and hence you need to use the R_MIPS_HI_16 and R_MIPS_LO16 Also on the mips there is a 26 bit relative call instruction .So the R_MIPS_26 relocation is for the actual function getting called . Since vos_printf is an external function you need to find its address right ? So that relocation is created for it. Does it clear your doubt now ? cheers Ramana > > Following is whole disasemble code. > > 0: 2484ffff addiu $a0,$a0,-1 > 4: 27bdffd8 addiu $sp,$sp,-40 > 8: 2c820006 sltiu $v0,$a0,6 > c: 1040002c beqz $v0,c0 <testFunc+0xc0> > 10: ffbf0020 sd $ra,32($sp) > 14: 00041080 sll $v0,$a0,0x2 > 18: 3c030000 lui $v1,0x0 > 18: R_MIPS_HI16 .rodata+0x78 > 1c: 0062182d daddu $v1,$v1,$v0 > 20: 8c630078 lw $v1,120($v1) > 20: R_MIPS_LO16 .rodata+0x78 > 24: 00600008 jr $v1 > ... > 30: 3c040000 lui $a0,0x0 > 30: R_MIPS_HI16 .rodata > 34: 0c000000 jal 0 <testFunc> > 34: R_MIPS_26 vos_printf > 38: 64840000 daddiu $a0,$a0,0 > 38: R_MIPS_LO16 .rodata > 3c: 08000034 j d0 <testFunc+0xd0> > 3c: R_MIPS_26 .text+0xd0 > 40: dfbf0020 ld $ra,32($sp) > 44: 00000000 nop > 48: 3c040000 lui $a0,0x0 > 48: R_MIPS_HI16 .rodata+0x10 > 4c: 0c000000 jal 0 <testFunc> > 4c: R_MIPS_26 vos_printf > 50: 64840010 daddiu $a0,$a0,16 > 50: R_MIPS_LO16 .rodata+0x10 > 54: 08000034 j d0 <testFunc+0xd0> > 54: R_MIPS_26 .text+0xd0 > 58: dfbf0020 ld $ra,32($sp) > 5c: 00000000 nop > 60: 3c040000 lui $a0,0x0 > 60: R_MIPS_HI16 .rodata+0x20 > 64: 0c000000 jal 0 <testFunc> > 64: R_MIPS_26 vos_printf > 68: 64840020 daddiu $a0,$a0,32 > 68: R_MIPS_LO16 .rodata+0x20 > 6c: 08000034 j d0 <testFunc+0xd0> > 6c: R_MIPS_26 .text+0xd0 > 70: dfbf0020 ld $ra,32($sp) > 74: 00000000 nop > 78: 3c040000 lui $a0,0x0 > 78: R_MIPS_HI16 .rodata+0x30 > 7c: 0c000000 jal 0 <testFunc> > 7c: R_MIPS_26 vos_printf > 80: 64840030 daddiu $a0,$a0,48 > 80: R_MIPS_LO16 .rodata+0x30 > 84: 08000034 j d0 <testFunc+0xd0> > 84: R_MIPS_26 .text+0xd0 > 88: dfbf0020 ld $ra,32($sp) > 8c: 00000000 nop > 90: 3c040000 lui $a0,0x0 > 90: R_MIPS_HI16 .rodata+0x40 > 94: 0c000000 jal 0 <testFunc> > 94: R_MIPS_26 vos_printf > 98: 64840040 daddiu $a0,$a0,64 > 98: R_MIPS_LO16 .rodata+0x40 > 9c: 08000034 j d0 <testFunc+0xd0> > 9c: R_MIPS_26 .text+0xd0 > a0: dfbf0020 ld $ra,32($sp) > a4: 00000000 nop > a8: 3c040000 lui $a0,0x0 > a8: R_MIPS_HI16 .rodata+0x50 > ac: 0c000000 jal 0 <testFunc> > ac: R_MIPS_26 vos_printf > b0: 64840050 daddiu $a0,$a0,80 > b0: R_MIPS_LO16 .rodata+0x50 > b4: 08000034 j d0 <testFunc+0xd0> > b4: R_MIPS_26 .text+0xd0 > b8: dfbf0020 ld $ra,32($sp) > bc: 00000000 nop > c0: 3c040000 lui $a0,0x0 > c0: R_MIPS_HI16 .rodata+0x60 > c4: 0c000000 jal 0 <testFunc> > c4: R_MIPS_26 vos_printf > c8: 64840060 daddiu $a0,$a0,96 > c8: R_MIPS_LO16 .rodata+0x60 > cc: dfbf0020 ld $ra,32($sp) > d0: 0000102d move $v0,$zero > d4: 03e00008 jr $ra > d8: 27bd0028 addiu $sp,$sp,40 > dc: 00000000 nop > > can you explain it? > > > thanks, > -Abel > > > >