This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GAS: Short Jumps


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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]