| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | . $(dirnamescip-shell system . . dirname. $0)/common.inc |
| 3 | |
| 4 | # Skip if target is not x86-64 |
| 5 | echoscip-shell system . . echo. ret | ccscip-shell system . . cc. -c -o /dev/nullscip-shell filesystem . . `/dev/null`. -xassembler -Wa,-mrelax-relocations=yes - 2> /dev/nullscip-shell filesystem . . `/dev/null`. || skip |
| 6 | |
| 7 | catscip-shell system . . cat. <<EOF | $CC -o $t/a.o -c -x assembler -Wa,-mrelax-relocations=yes - || skip |
| 8 | .globl bar |
| 9 | bar: |
| 10 | mov foo@gotpcrel(%rip), %rax |
| 11 | mov foo@gotpcrel(%rip), %rcx |
| 12 | mov foo@gotpcrel(%rip), %rdx |
| 13 | mov foo@gotpcrel(%rip), %rbx |
| 14 | mov foo@gotpcrel(%rip), %rbp |
| 15 | mov foo@gotpcrel(%rip), %rsi |
| 16 | mov foo@gotpcrel(%rip), %rdi |
| 17 | mov foo@gotpcrel(%rip), %r8 |
| 18 | mov foo@gotpcrel(%rip), %r9 |
| 19 | mov foo@gotpcrel(%rip), %r10 |
| 20 | mov foo@gotpcrel(%rip), %r11 |
| 21 | mov foo@gotpcrel(%rip), %r12 |
| 22 | mov foo@gotpcrel(%rip), %r13 |
| 23 | mov foo@gotpcrel(%rip), %r14 |
| 24 | mov foo@gotpcrel(%rip), %r15 |
| 25 | mov foo@gotpcrel(%rip), %r16 |
| 26 | mov foo@gotpcrel(%rip), %r17 |
| 27 | mov foo@gotpcrel(%rip), %r18 |
| 28 | mov foo@gotpcrel(%rip), %r19 |
| 29 | mov foo@gotpcrel(%rip), %r20 |
| 30 | mov foo@gotpcrel(%rip), %r21 |
| 31 | mov foo@gotpcrel(%rip), %r22 |
| 32 | mov foo@gotpcrel(%rip), %r23 |
| 33 | mov foo@gotpcrel(%rip), %r24 |
| 34 | mov foo@gotpcrel(%rip), %r25 |
| 35 | mov foo@gotpcrel(%rip), %r26 |
| 36 | mov foo@gotpcrel(%rip), %r27 |
| 37 | mov foo@gotpcrel(%rip), %r28 |
| 38 | mov foo@gotpcrel(%rip), %r29 |
| 39 | mov foo@gotpcrel(%rip), %r30 |
| 40 | mov foo@gotpcrel(%rip), %r31 |
| 41 | |
| 42 | call *foo@gotpcrel(%rip) |
| 43 | jmp *foo@gotpcrel(%rip) |
| 44 | EOF |
| 45 | |
| 46 | catscip-shell system . . cat. <<EOF | $CC -o $t/b.o -c -xc - |
| 47 | void foo() {} |
| 48 | int main() {} |
| 49 | EOF |
| 50 | |
| 51 | $CC -B. -o $t/exe $t/a.o $t/b.o |
| 52 | $OBJDUMP -d $t/exe | sedscip-shell system . . sed. -n '/<bar>:/,/<.*>:/pscip-shell filesystem . . `/<bar>:/,/<.*>:/p`.' > $t/log |
| 53 | |
| 54 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rax .*<foo>' $t/log |
| 55 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rcx .*<foo>' $t/log |
| 56 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rdx .*<foo>' $t/log |
| 57 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rbx .*<foo>' $t/log |
| 58 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rbp .*<foo>' $t/log |
| 59 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rsi .*<foo>' $t/log |
| 60 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%rdi .*<foo>' $t/log |
| 61 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r8 .*<foo>' $t/log |
| 62 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r9 .*<foo>' $t/log |
| 63 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r10 .*<foo>' $t/log |
| 64 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r11 .*<foo>' $t/log |
| 65 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r12 .*<foo>' $t/log |
| 66 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r13 .*<foo>' $t/log |
| 67 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r14 .*<foo>' $t/log |
| 68 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r15 .*<foo>' $t/log |
| 69 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r16 .*<foo>' $t/log |
| 70 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r17 .*<foo>' $t/log |
| 71 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r18 .*<foo>' $t/log |
| 72 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r19 .*<foo>' $t/log |
| 73 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r20 .*<foo>' $t/log |
| 74 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r21 .*<foo>' $t/log |
| 75 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r22 .*<foo>' $t/log |
| 76 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r23 .*<foo>' $t/log |
| 77 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r24 .*<foo>' $t/log |
| 78 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r25 .*<foo>' $t/log |
| 79 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r26 .*<foo>' $t/log |
| 80 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r27 .*<foo>' $t/log |
| 81 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r28 .*<foo>' $t/log |
| 82 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r29 .*<foo>' $t/log |
| 83 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r30 .*<foo>' $t/log |
| 84 | grepscip-shell system . . grep. -E 'lea \s*0x.+\(%rip\),%r31 .*<foo>' $t/log |
| 85 | |
| 86 | grepscip-shell system . . grep. -E 'call.*<foo>' $t/log |
| 87 | grepscip-shell system . . grep. -E 'jmp.*<foo>' $t/log |