Robert Sloan | 8ff0355 | 2017-06-14 12:40:58 -0700 | [diff] [blame] | 1 | .type foo, @function |
| 2 | .globl foo |
| 3 | foo: |
| 4 | movq $0, %rax |
| 5 | ret |
| 6 | |
| 7 | bar: |
| 8 | # References to globals must be rewritten to their local targets. |
| 9 | call foo |
| 10 | jmp foo |
| 11 | jbe foo |
| 12 | jne foo |
| 13 | |
| 14 | # Jumps to PLT symbols are rewritten through redirectors. |
| 15 | call memcpy@PLT |
| 16 | jmp memcpy@PLT |
| 17 | jbe memcpy@PLT |
| 18 | |
| 19 | # Jumps to local PLT symbols use their local targets. |
| 20 | call foo@PLT |
| 21 | jmp foo@PLT |
| 22 | jbe foo@PLT |
| 23 | |
| 24 | # Synthesized symbols are treated as local ones. |
| 25 | call OPENSSL_ia32cap_get@PLT |
| 26 | |
| 27 | # References to local labels are left as-is in the first file. |
| 28 | .Llocal_label: |
| 29 | jbe .Llocal_label |
| 30 | leaq .Llocal_label+2048(%rip), %r14 |
| 31 | leaq .Llocal_label+2048+1024(%rip), %r14 |
| 32 | |
| 33 | .section .rodata |
| 34 | .L1: |
| 35 | .quad 42 |
| 36 | .L2: |
| 37 | .quad .L2-.L1 |
Pete Bentley | 0c61efe | 2019-08-13 09:32:23 +0100 | [diff] [blame^] | 38 | .uleb128 .L2-.L1 |
| 39 | .sleb128 .L2-.L1 |
Robert Sloan | 8ff0355 | 2017-06-14 12:40:58 -0700 | [diff] [blame] | 40 | |
| 41 | # Local labels and their jumps are left alone. |
| 42 | .text |
| 43 | jmp 1f |
| 44 | 1: |
| 45 | jmp 1b |