@@ -687,12 +687,25 @@ def _handle_relocation(
687
687
"Offset" : int (offset ),
688
688
"PCRel" : 1 ,
689
689
"Symbol" : {"Value" : str (symbol )},
690
- "Type" : {"Value" : "X86_64_RELOC_GOT_LOAD" },
690
+ "Type" : {"Value" : "X86_64_RELOC_BRANCH" | "X86_64_RELOC_SIGNED" },
691
+ }:
692
+ offset += base
693
+
8000
where = slice (offset , offset + 4 )
694
+ what = int .from_bytes (self .body [where ], sys .byteorder )
695
+ addend = what
696
+ self .body [where ] = [0 ] * 4
697
+ symbol = symbol .removeprefix (self .SYMBOL_PREFIX )
698
+ return Hole (HoleKind .REL_32 , symbol , offset , addend - 4 )
699
+ case {
700
+ "Length" : 2 ,
701
+ "Offset" : int (offset ),
702
+ "PCRel" : 1 ,
703
+ "Symbol" : {"Value" : str (symbol )},
704
+ "Type" : {"Value" : "X86_64_RELOC_GOT" | "X86_64_RELOC_GOT_LOAD" },
691
705
}:
692
706
offset += base
693
707
where = slice (offset , offset + 4 )
694
708
what = int .from_bytes (self .body [where ], "little" , signed = False )
695
- assert not what , what
696
709
addend = what
697
710
self .body [where ] = [0 ] * 4
698
711
symbol = remove_prefix (symbol , self .SYMBOL_PREFIX )
@@ -707,20 +720,19 @@ def _handle_relocation(
707
720
self .body [where ] = addend .to_bytes (4 , sys .byteorder )
708
721
return None
709
722
case {
710
- "Length" : 3 ,
723
+ "Length" : 2 ,
711
724
"Offset" : int (offset ),
712
- "PCRel" : 0 ,
725
+ "PCRel" : 1 ,
713
726
"Section" : {"Value" : str (section )},
714
- "Type" : {"Value" : "X86_64_RELOC_UNSIGNED " },
727
+ "Type" : {"Value" : "X86_64_RELOC_SIGNED " },
715
728
}:
716
729
offset += base
717
- where = slice (offset , offset + 8 )
730
+ where = slice (offset , offset + 4 )
718
731
what = int .from_bytes (self .body [where ], sys .byteorder )
719
- # assert not what, what
720
732
addend = what
721
- self .body [where ] = [0 ] * 8
722
- section = remove_prefix ( section , self .SYMBOL_PREFIX )
723
- return Hole (HoleKind .ABS_64 , section , offset , addend )
733
+ self .body [where ] = [0 ] * 4
734
+ section = section . removeprefix ( self .SYMBOL_PREFIX )
735
+ return Hole (HoleKind .REL_32 , section , offset , addend - 4 )
724
736
case {
725
737
"Length" : 3 ,
726
738
"Offset" : int (offset ),
@@ -731,7 +743,6 @@ def _handle_relocation(
731
743
offset += base
732
744
where = slice (offset , offset + 8 )
733
745
what = int .from_bytes (self .body [where ], sys .byteorder )
734
- # assert not what, what
735
746
addend = what
736
747
self .body [where ] = [0 ] * 8
737
748
symbol = remove_prefix (symbol , self .SYMBOL_PREFIX )
@@ -1219,7 +1230,7 @@ def main(host: str) -> None:
1219
1230
(aarch64_apple_darwin , False , [f"-I{ ROOT } " ]),
1220
1231
(aarch64_unknown_linux_gnu , False , [f"-I{ ROOT } " , "-fno-pic" , "-mcmodel=large" ]),
1221
1232
(i686_pc_windows_msvc , True , [f"-I{ PC } " , "-fno-pic" , "-mcmodel=large" ]),
1222
- (x86_64_apple_darwin , True , [f"-I{ ROOT } " , "-fno-pic" , "-mcmodel=large" ]),
1233
+ (x86_64_apple_darwin , True , [f"-I{ ROOT } " ]),
1223
1234
(x86_64_pc_windows_msvc , True , [f"-I{ PC } " , "-fno-pic" , "-mcmodel=large" ]),
1224
1235
(x86_64_unknown_linux_gnu , True , [f"-I{ ROOT } " ]),
1225
1236
]:
0 commit comments