jumps to middle of x86 instructions ?

Mithun R N Iyer mithun_rn@yahoo.co.in
Fri Apr 4 09:10:00 GMT 2008


Hi All: I see these weird jmps to middle of
instructions in a binary. 
 
This is on x86, ubuntu gcc version: 4.1.3 with -O2
optimization.

Can someone please let me know why such jumps are
generated ? I have seen such jmps in case of lock
prefix instructions but do not see any such
instructions here. 
There is no assembly code added in the sources.

The code snippet looks like:
0x0006c007 <strrchr+103>:       add    %al,(%eax)
0x0006c009 <strrchr+105>:       add   
%al,0xee8304ee(%ebx)
0x0006c00f <strrchr+111>:       add    $0x83,%al
0x0006c011 <strrchr+113>:       out    %al,(%dx)
........
0x0006c020 <strrchr+128>:       sub    $0x4,%esi
0x0006c023 <strrchr+131>:       sub    $0x4,%esi
0x0006c026 <strrchr+134>:       sub    $0x4,%esi
0x0006c029 <strrchr+137>:       test   $0xff0000,%edx
........
0x0006c06a <strrchr+202>:       jae    0x6c00a
<strrchr+106> --- jmp to middle of instn.

(gdb) x/16i 0x6c00a
0x6c00a <strrchr+106>:  sub    $0x4,%esi
0x6c00d <strrchr+109>:  sub    $0x4,%esi
0x6c010 <strrchr+112>:  sub    $0x4,%esi
0x6c013 <strrchr+115>:  test   $0xff000000,%edx
0x6c019 <strrchr+121>:  jne    0x6c029 <strrchr+137>
0x6c01b <strrchr+123>:  lea    0xf(%esi),%eax
0x6c01e <strrchr+126>:  jmp    0x6c040 <strrchr+160>
0x6c020 <strrchr+128>:  sub    $0x4,%esi
0x6c023 <strrchr+131>:  sub    $0x4,%esi
0x6c026 <strrchr+134>:  sub    $0x4,%esi
0x6c029 <strrchr+137>:  test   $0xff0000,%edx

Thanks and Regards,
Mithun


      5, 50, 500, 5000 - Store N number of mails in your inbox. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html



More information about the Gcc-help mailing list