File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
llvm/lib/ExecutionEngine/Orc Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,11 @@ void OrcAArch64::writeIndirectStubsBlock(
165
165
//
166
166
// .section __orc_stubs
167
167
// stub1:
168
- // ldr x0 , ptr1 ; PC-rel load of ptr1
169
- // br x0 ; Jump to resolver
168
+ // ldr x16 , ptr1 ; PC-rel load of ptr1
169
+ // br x16 ; Jump to resolver
170
170
// stub2:
171
- // ldr x0 , ptr2 ; PC-rel load of ptr2
172
- // br x0 ; Jump to resolver
171
+ // ldr x16 , ptr2 ; PC-rel load of ptr2
172
+ // br x16 ; Jump to resolver
173
173
//
174
174
// ...
175
175
//
@@ -188,8 +188,10 @@ void OrcAArch64::writeIndirectStubsBlock(
188
188
" PointersBlock is out of range" );
189
189
uint64_t PtrDisplacement =
190
190
PointersBlockTargetAddress - StubsBlockTargetAddress;
191
+ assert ((PtrDisplacement % 8 == 0 ) &&
192
+ " Displacement to pointer is not a multiple of 8" );
191
193
uint64_t *Stub = reinterpret_cast <uint64_t *>(StubsBlockWorkingMem);
192
- uint64_t PtrOffsetField = PtrDisplacement << 3 ;
194
+ uint64_t PtrOffsetField = (( PtrDisplacement >> 2 ) & 0x7ffff ) << 5 ;
193
195
194
196
for (unsigned I = 0 ; I < NumStubs; ++I)
195
197
Stub[I] = 0xd61f020058000010 | PtrOffsetField;
You can’t perform that action at this time.
0 commit comments