File tree 7 files changed +5
-13
lines changed
7 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,9 @@ let to_x86_directive (dir : ND.Directive.t) : X86_ast.asm_line list =
80
80
| Const { constant; comment } ->
81
81
comment_lines comment @ [to_x86_constant_with_width constant]
82
82
| Direct_assignment (s , c ) ->
83
- [X86_ast. Direct_assignment (s, to_x86_constant c)]
83
+ (* We use [.set s c] for direct assignments, since it evaluates [c]
84
+ directly. The alternative, [s = c], is sensitive to relocations. *)
85
+ [X86_ast. Set (s, to_x86_constant c)]
84
86
| File { file_num = None ; _ } ->
85
87
Misc. fatal_error " file directive must always carry a number on x86"
86
88
| File { file_num = Some file_num ; filename } ->
Original file line number Diff line number Diff line change @@ -259,7 +259,5 @@ type asm_line =
259
259
| Type of string * string
260
260
| Reloc of reloc
261
261
262
- (* MacOS only *)
263
- | Direct_assignment of string * constant
264
262
265
263
type asm_program = asm_line list
Original file line number Diff line number Diff line change @@ -1731,7 +1731,7 @@ let assemble_line b loc ins =
1731
1731
offset = ConstSub (ConstThis , Const 4L );
1732
1732
} when String.Tbl. mem local_labels wrap_label ->
1733
1733
record_local_reloc b ~offset: (- 4 ) (RelocCall wrap_label)
1734
- | Reloc _ | Sleb128 _ | Uleb128 _ | Direct_assignment _ ->
1734
+ | Reloc _ | Sleb128 _ | Uleb128 _ ->
1735
1735
X86_gas. generate_asm Out_channel. stderr [ins];
1736
1736
Misc. fatal_errorf " x86_binary_emitter: unsupported instruction"
1737
1737
with e ->
Original file line number Diff line number Diff line change @@ -121,8 +121,6 @@ module D = struct
121
121
122
122
let data () = section [" .data" ] None []
123
123
124
- let direct_assignment var const = directive (Direct_assignment (var, const))
125
-
126
124
let extrn s ptr = directive (External (s, ptr))
127
125
128
126
let file ~file_num ~file_name = directive (File (file_num, file_name))
Original file line number Diff line number Diff line change @@ -121,8 +121,6 @@ module D : sig
121
121
122
122
val data : unit -> unit
123
123
124
- val direct_assignment : string -> constant -> unit
125
-
126
124
val extrn : string -> data_type -> unit
127
125
128
126
val file : file_num :int -> file_name :string -> unit
Original file line number Diff line number Diff line change @@ -343,10 +343,6 @@ let print_line b = function
343
343
cst expr
344
344
(* masm only *)
345
345
| External _ | Mode386 | Model _ -> assert false
346
- (* MacOS only *)
347
- | Direct_assignment (var , c ) ->
348
- assert (List. mem Config. system [" macosx" ; " darwin" ]);
349
- bprintf b " \t %s = %a" var cst c
350
346
351
347
let generate_asm oc lines =
352
348
let b = Buffer. create 10000 in
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ let print_line b = function
269
269
| Cfi_def_cfa_register _ | Cfi_def_cfa_offset _ | Cfi_offset _
270
270
| Cfi_remember_state | Cfi_restore_state | File _ | Indirect_symbol _ | Loc _
271
271
| Private_extern _ | Set _ | Size _ | Type _ | Hidden _ | Weak _ | Reloc _
272
- | Direct_assignment _ | Protected _ ->
272
+ | Protected _ ->
273
273
assert false
274
274
275
275
let generate_asm oc lines =
You can’t perform that action at this time.
0 commit comments