blob: d6cb65ea3d618610483a9cd41a92b9299abd3edb (
plain)
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
|
(* *********************************************************************)
(* *)
(* The Compcert verified compiler *)
(* *)
(* Xavier Leroy, INRIA Paris-Rocquencourt *)
(* Bernhard Schommer, AbsInt Angewandte Informatik GmbH *)
(* *)
(* Copyright Institut National de Recherche en Informatique et en *)
(* Automatique. All rights reserved. This file is distributed *)
(* under the terms of the INRIA Non-Commercial License Agreement. *)
(* *)
(* *********************************************************************)
open Clflags
open Commandline
open Driveraux
(* From asm to object file *)
let assemble ifile ofile =
let cmd,opts = match Configuration.asm with
| name::opts -> name,opts
| [] -> assert false (* Should be catched in Configuration *) in
let opts = List.concat [
opts;
["-o"; ofile];
List.rev !assembler_options;
[ifile]
] in
let opts = responsefile opts (fun a -> if gnu_system then ["@"^a] else ["@"^a]) in
let cmd = cmd::opts in
let exc = command cmd in
if exc <> 0 then begin
safe_remove ofile;
command_error "assembler" exc;
exit 2
end
let assembler_actions =
[ Prefix "-Wa,", Self (fun s -> if gnu_system then
assembler_options := s :: !assembler_options
else
assembler_options := List.rev_append (explode_comma_option s) !assembler_options);
Exact "-Xassembler", String (fun s -> if gnu_system then
assembler_options := s::"-Xassembler":: !assembler_options
else
assembler_options := s::!assembler_options );]
let assembler_help =
"Assembling options:\n\
\ -Wa,<opt> Pass option <opt> to the assembler\n\
\ -Xassembler <opt> Pass <opt> as an option to the assembler\n"
|