1 2 call _foo 3 # r_type= X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 4 # E8 00 00 00 00 5 6 call _foo+4 7 # r_type=X86_64_RELOC_BRANCH, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 8 # E8 04 00 00 00 9 10 # TODO: movq _foo@GOTPCREL(%rip), %rax 11 # r_type=X86_64_RELOC_GOT_LOAD, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 12 # 48 8B 05 00 00 00 00 13 14 # TODO: pushq _foo@GOTPCREL(%rip) 15 # r_type=X86_64_RELOC_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 16 # FF 35 00 00 00 00 17 18 movl _foo(%rip), %eax 19 # r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 20 # 8B 05 00 00 00 00 21 22 movl _foo+4(%rip), %eax 23 # r_type= X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 24 # 8B 05 04 00 00 00 25 26 movb $0x12, _foo(%rip) 27 # r_type= X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 28 # C6 05 FF FF FF FF 12 29 30 movl $0x12345678, _foo(%rip) 31 # r_type= X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo 32 # C7 05 FC FF FF FF 78 56 34 12 33 34 .quad _foo 35 # r_type=X86_64_RELOC_UNSIGNED,r_length=3, r_extern=1,r_pcrel=0, r_symbolnum=_foo 36 # 00 00 00 00 00 00 00 00 37 38 .quad _foo+4 39 # r_type=X86_64_RELOC_UNSIGNED,r_length=3,r_extern=1,r_pcrel=0,r_symbolnum=_foo 40 # 04 00 00 00 00 00 00 00 41 42 # TODO: .quad _foo - _bar 43 # r_type=X86_64_RELOC_SUBTRACTOR,r_length=3,r_extern=1, r_pcrel=0,r_symbolnum=_bar 44 # r_type=X86_64_RELOC_UNSIGNED,r_length=3,r_extern=1, r_pcrel=0,r_symbolnum=_foo 45 # 00 00 00 00 00 00 00 00 46 47 # TODO: .quad _foo - _bar + 4 48 # r_type=X86_64_RELOC_SUBTRACTOR,r_length=3, r_extern=1,r_pcrel=0,r_symbolnum=_bar 49 # r_type=X86_64_RELOC_UNSIGNED,r_length=3, r_extern=1,r_pcrel=0,r_symbolnum=_foo 50 # 04 00 00 00 00 00 00 00 51 52 # TODO: .long _foo - _bar 53 # r_type=X86_64_RELOC_SUBTRACTOR,r_length=2,r_extern=1,r_pcrel=0,r_symbolnum=_bar 54 # r_type=X86_64_RELOC_UNSIGNED,r_length=2,r_extern=1,r_pcrel=0,r_symbolnum=_foo 55 # 00 00 00 00 56 57 lea L1(%rip), %rax 58 # r_type=X86_64_RELOC_SIGNED, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_prev 59 # 48 8d 05 12 00 00 00 60 # Assumes that _prev is the first nonlocal label 0x12 bytes before L1. 61 62 lea L0(%rip), %rax 63 # r_type= X86_64_RELOC_SIGNED, r_length=2, r_extern=0, r_pcrel=1, r_symbolnum=3 64 # 48 8d 05 56 00 00 00 65 # Assumes that L0 is in third section, and has an address of 0x00000056 66 # in .o file, and no previous nonlocal label. 67 68 .quad L1 69 # r_type=X86_64_RELOC_UNSIGNED,r_length=3,r_extern=1,r_pcrel=0, r_symbolnum= _prev 70 # 12 00 00 00 00 00 00 00 71 # Assumes that _prev is the first nonlocal label 0x12 bytes before L1. 72 73 .quad L0 74 # r_type=X86_64_RELOC_UNSIGNED,r_length=3, r_extern=0, r_pcrel=0, r_symbolnum= 3 75 # 56 00 00 00 00 00 00 00 76 # Assumes that L0 is in third section, and has address of 0x00000056 77 # in .o file, and no previous nonlocal label. 78 79 # TODO: .quad _foo - . 80 # r_type=X86_64_RELOC_SUBTRACTOR,r_length=3,r_extern=1,r_pcrel=0,r_symbolnum=_prev 81 # r_type=X86_64_RELOC_UNSIGNED,r_length=3,r_extern=1,r_pcrel=0,r_symbolnum=_foo 82 # EE FF FF FF FF FF FF FF 83 # Assumes that _prev is the first nonlocal label 0x12 bytes 84 # before this .quad 85 86 # TODO: .quad _foo - L1 87 # r_type=X86_64_RELOC_SUBTRACTOR,r_length=3,r_extern=1,r_pcrel=0,r_symbolnum=_prev 88 # r_type=X86_64_RELOC_UNSIGNED,r_length=3,r_extern=1,r_pcrel=0,r_symbolnum=_foo 89 # EE FF FF FF FF FF FF FF 90 # Assumes that _prev is the first nonlocal label 0x12 bytes before L1. 91 92 .quad L1 - _prev 93 # No relocations. This is an assembly time constant. 94 # 12 00 00 00 00 00 00 00 95 # Assumes that _prev is the first nonlocal label 0x12 bytes before L 96 97 .data 98 .org 0x56 99 L0: 100 _prev: 101 .quad 0, 0 102 .byte 0, 0 103 L1: 104