@@ -11,13 +11,10 @@ const (
11
11
// arm/arm64
12
12
var (
13
13
armReplaceCallCode = []byte {0x04 , 0xF0 , 0x1F , 0xE5 } //LDR PC, [PC, #-4]
14
- // X16 and X17 are the IP0 and IP1 intra-procedure-call corruptible registers -
15
- // since Go only uses them for the stack prologue and epilogue calculations,
16
- // and we should already be clear of that by the time we hit a R_CALLARM64,
17
- // so we should be able to safely use them for far jumps
14
+ // register X27 reserved for liblink. see:^src/cmd/objfile/obj/arm64/a.out.go
18
15
arm64ReplaceCALLCode = []byte {
19
- 0x51 , 0x00 , 0x00 , 0x58 , // LDR X17 [PC+8] - read 64 bit address from PC+8 into X17
20
- 0x20 , 0x02 , 0x1f , 0xd6 , // BR X17 - jump to address in X17
16
+ 0x5B , 0x00 , 0x00 , 0x58 , // LDR X27 [PC+8] - read 64 bit address from PC+8 into X27
17
+ 0x60 , 0x03 , 0x1F , 0xD6 , // BR X27 - jump to address in X27
21
18
}
22
19
arm64Bcode = []byte {0x00 , 0x00 , 0x00 , 0x14 } // B [PC+0x0]
23
20
arm64LDRcode = []byte {0x00 , 0x00 , 0x40 , 0xF9 } // LDR XX [XX]
0 commit comments