@@ -295,12 +295,14 @@ async def parse(self):
295
295
if padding :
296
296
disassembly .append (f"{ offset :x} : { ' ' .join (padding * ['00' ])} " )
297
297
offset += padding
298
- for symbol , offset in self .got .items ():
298
+ for symbol , got_offset in self .got .items ():
299
299
if symbol in self .body_symbols :
300
300
addend = self .body_symbols [symbol ]
301
301
symbol = "_JIT_BASE"
302
+ else :
303
+ addend = 0
302
304
# XXX: ABS_32 on 32-bit platforms?
303
- holes .append (Hole ("R_X86_64_64" , symbol , offset , 0 ))
305
+ holes .append (Hole ("R_X86_64_64" , symbol , got + got_offset , addend ))
304
306
disassembly .append (f"{ offset :x} : &{ symbol } " )
305
307
offset += 8
306
308
self .body .extend ([0 ] * 8 * len (self .got ))
@@ -403,7 +405,7 @@ def _handle_relocation(self, base: int, relocation: RelocationType) -> Hole | No
403
405
"Addend" : addend ,
404
406
}:
405
407
offset += base
406
- value = len (self .body )
408
+ value = len (self .body ) - offset
407
409
self .write_u32 (offset , value + addend )
408
410
return None
409
411
case {
@@ -413,7 +415,7 @@ def _handle_relocation(self, base: int, relocation: RelocationType) -> Hole | No
413
415
"Addend" : addend ,
414
416
}:
415
417
offset += base
416
- value = len ( self . body ) + self ._got_lookup (symbol ) - offset
418
+ value = self ._got_lookup (symbol ) - offset
417
419
self .write_u32 (offset , value + addend )
418
420
return None
419
421
case {
0 commit comments