Gnu Assembler IP-Relative jmp issue
Slobodan Milosevic
zehdabodega@yahoo.com.br
Sun Dec 10 19:11:00 GMT 2006
Hi mates, i'm having problems trying to use the
IP-relative jmp (x86) instruction with gas. Here's the
code
----arq.s----
1 .section .text
2 .globl _start
3 _start:
4 jmp 0x0e
5
6 movl $100, %ebx
7 jmp INT
8
9 movl $200, %ebx
10 jmp INT
11
12 INT:
13 movl $1, %eax
14 int $0x80
---end of arq.s---
I assembled it with:
as -o arq.o arq.s
And linked it with
ld -o arq arq.o
Then i tried to execute it and got a segfault.
disassembling the program with gdb i got:
(gdb) disassemble _start
Dump of assembler code for function _start:
0x08048074 <_start+0>: jmp 0x4 <-- PROBLEM
0x08048079 <_start+5>: mov $0x64,%ebx
0x0804807e <_start+10>: jmp 0x8048087 <INT>
0x08048080 <_start+12>: mov $0xc8,%ebx
0x08048085 <_start+17>: jmp 0x8048087 <INT>
End of assembler dump.
Why gas is replacing 0x0e with 0x4? According to
intel's manual when you use jmp + a 8bit operand, it
should be an ip relative jmp (and gas is messing up
with the operand value).
Do you guys know how to fix it?
Cheers, José da Bodega.
__________________________________________________
Fale com seus amigos de graça com o novo Yahoo! Messenger
http://br.messenger.yahoo.com/
More information about the Binutils
mailing list