Mayank Kumar <[EMAIL PROTECTED]> writes: > For Movl [EMAIL PROTECTED](%ebx,%eax),%eax --------> mov > 0xffffbd14(%eax,%ebx,1),%eax > > I verified that data contained in .rdata section is all wrong in my case with > both my gcc3.3 compiler as well gcc4.3 compiler. > This is why the jump happens to the wrong code which lies outside the > function. > > Can you point me to the relevant section of gcc code which populates the > .rdata section or calculates these values to be populated in there ?
gcc emits the code you see in the .s file. In this case it is just code like ".long [EMAIL PROTECTED]", which certainly looks right to me. It is the assembler which determines the value to place in the .o file; for the GNU binutils, this happens in gas/config/tc-i386.h; look for the handling of got_reloc. It is the linker which computes the final value in the executable; for the GNU binutils search for GOTOFF in bfd/elf32-i386.c. Ian