File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -1023,8 +1023,8 @@ let emit_SHR b dst src = emit_shift 5 b dst src
1023
1023
1024
1024
let emit_SAR b dst src = emit_shift 7 b dst src
1025
1025
1026
- let record_local_reloc b local_reloc =
1027
- local_relocs := (Buffer. length b.buf, local_reloc) :: ! local_relocs
1026
+ let record_local_reloc b ?( offset = 0 ) local_reloc =
1027
+ local_relocs := (Buffer. length b.buf + offset , local_reloc) :: ! local_relocs
1028
1028
1029
1029
let emit_reloc_jump near_opcodes far_opcodes b loc symbol =
1030
1030
if String.Tbl. mem local_labels symbol then
@@ -1682,7 +1682,15 @@ let assemble_line b loc ins =
1682
1682
for _ = 1 to n do
1683
1683
buf_int8 b 0
1684
1684
done
1685
- | Hidden _ | Weak _ | Reloc _ | NewLine | Sleb128 _ | Uleb128 _ | Direct_assignment _ -> ()
1685
+ | Hidden _ | Weak _ | NewLine -> ()
1686
+ | Reloc { name = R_X86_64_PLT32 ;
1687
+ expr = ConstSub (ConstLabel wrap_label, Const 4L );
1688
+ offset = ConstSub (ConstThis , Const 4L );
1689
+ } when String.Tbl. mem local_labels wrap_label ->
1690
+ record_local_reloc b ~offset: (- 4 ) (RelocCall wrap_label)
1691
+ | Reloc _ | Sleb128 _ | Uleb128 _ | Direct_assignment _ ->
1692
+ X86_gas. generate_asm Out_channel. stderr [ins];
1693
+ Misc. fatal_errorf " x86_binary_emitter: unsupported instruction"
1686
1694
with e ->
1687
1695
Printf. eprintf " Exception %s:\n %!" (Printexc. to_string e);
1688
1696
(*
You can’t perform that action at this time.
0 commit comments