1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
.text
.globl _start
_start:
# original PCREL_OPT definition, with second insn immediately after first
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0
lbz 3,0(9)
# but we now allow an offset to the second insn
pld 22,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
nop
0: lhz 4,0(22)
# in fact, it can even be before the "first" insn
0: lha 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0b-(.-8)
bne 0b
# and of course, other local labels work
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,.L1-(.-8)
.L1: lwz 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lwa 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: ld 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lq 14,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lfs 1,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lfd 1,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxsd 30,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxssp 31,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxv 63,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxv 0,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stb 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: sth 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stw 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: std 3,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stq 14,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stfd 1,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stfs 2,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxsd 30,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxssp 31,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxv 63,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxv 0,0(9)
#offsets are allowed too
pld 9,sym@got@pcrel
0:
lbz 3,0x1234(9)
.reloc 0b-8,R_PPC64_PCREL_OPT,(.-4)-(0b-8)
#and prefix insns as the second insn
pld 9,sym@got@pcrel
0:
plq 4,0x12345678(9)
.reloc 0b-8,R_PPC64_PCREL_OPT,(.-8)-(0b-8)
# This should not optimize
.extern i
.type i,@object
pld 9,i@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: ld 0,0(9)
# and this should edit from GOT indirect to GOT relative
# ie. change the pld to paddi, leaving the lbz as is.
pld 7,sym@got@pcrel
lbz 6,0(7)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxvp 62,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: lxvp 0,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxvp 62,0(9)
pld 9,sym@got@pcrel
.reloc .-8,R_PPC64_PCREL_OPT,0f-(.-8)
0: stxvp 0,0(9)
.data
sym: .space 32
|