GAS: Short Jumps

Christopher Howard christopher.howard@frigidcode.com
Thu Mar 15 07:14:00 GMT 2012


Hi. I've hope I've come to the correct mailing list: I have a small,
noobish question about GAS syntax. How does one write a short, relative
jump in GAS syntax, i.e., with an 8 bit operand and without using a
symbol? For example, we can do this:

code
----------
$ cat symboljmp.S
.text
	nop
	nop
	nop
	jmp .L0
	nop
	nop
	nop
	nop
.L0:
	nop
	nop
	nop
	nop
	
$ as symboljmp.S -o symboljmp.o
$ objdump symboljmp.o -d

symboljmp.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:	90                   	nop
   1:	90                   	nop
   2:	90                   	nop
   3:	eb 04                	jmp    0x9
   5:	90                   	nop
   6:	90                   	nop
   7:	90                   	nop
   8:	90                   	nop
   9:	90                   	nop
   a:	90                   	nop
   b:	90                   	nop
   c:	90                   	nop
----------

And it seems to be using a nice, tiny 8 bit operand pointing ahead 4
bytes. But if one does something like jmp 4(%eip) then one gets a huge 4
byte operand.

Same question goes for the conditional jumps (jne, etc.)

-- 
frigidcode.com
indicium.us

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20120315/22cd47ed/attachment.sig>


More information about the Binutils mailing list