forked from ocaml-flambda/flambda-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx86_binary_emitter.mli
65 lines (48 loc) · 1.9 KB
/
x86_binary_emitter.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(***********************************************************************)
(* *)
(* OCaml *)
(* *)
(* Copyright 2014, OCamlPro. All rights reserved. *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1 *)
(* *)
(***********************************************************************)
(*
Contributors:
* Fabrice LE FESSANT (INRIA/OCamlPro)
*)
open X86_ast
module String = Misc.Stdlib.String
type section = { sec_name : string; mutable sec_instrs : asm_line array }
type data_size = B8 | B16 | B32 | B64
type symbol_binding = Sy_local | Sy_global | Sy_weak
type symbol = {
sy_name : string;
mutable sy_type : string option;
mutable sy_size : int option;
mutable sy_binding : symbol_binding;
mutable sy_protected : bool;
mutable sy_sec : section;
mutable sy_pos : int option;
mutable sy_num : int option; (* position in .symtab *)
}
module Relocation : sig
module Kind : sig
type t =
(* 32 bits offset usually in data section *)
| REL32 of string * int64
| DIR32 of string * int64
| DIR64 of string * int64
end
type t = { offset_from_section_beginning : int; kind : Kind.t }
end
module StringMap : Map.S with type key = string
type buffer
val size : buffer -> int
val relocations : buffer -> Relocation.t list
val assemble_section : arch -> section -> buffer
val get_symbol : buffer -> StringMap.key -> symbol
val contents_mut : buffer -> bytes
val contents : buffer -> string
val add_patch : offset:int -> size:data_size -> data:int64 -> buffer -> unit
val labels : buffer -> symbol String.Tbl.t