This preview shows page 1. Sign up to view the full content.
Unformatted text preview: t encodings for jumps, but some of the most commonly used ones are PC-relative. That is, they encode the difference between the address of the target instruction and the address of the instruction immediately following the jump. These offsets can be encoded using one, two, or four bytes. A second encoding method is to give an “absolute” address, using four bytes to directly specify the target. The assembler and linker select the appropriate encodings of the jump destinations. As an example, the following fragment of assembly code was generated by compiling a ﬁle silly.c. It contains two jumps: the jle instruction on line 1 jumps forward to a higher address, while the jg instruction on line 8 jumps back to a lower one.
1 2 3 4 5 6 7 8 9 10 jle .L4 .p2align 4,,7 .L5: movl %edx,%eax sarl $1,%eax subl %eax,%edx testl %edx,%edx jg .L5 .L4: movl %edx,%eax If <, goto dest2 Aligns next instruction to multiple of 8 dest1: If >, goto dest1 dest2: Note that line 2 is a directive to the assembler...
View Full Document