aboutsummaryrefslogtreecommitdiffstats
path: root/driver/Assembler.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-06-24 13:57:27 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2016-06-24 13:57:27 +0200
commit410a5db3d48e84f2157c2c4f4bc29056c0e174b9 (patch)
tree800974ebbe73921f27c0c563e56eb0c899efd7f5 /driver/Assembler.ml
parent01354123b9df5d3cbb9d43298eea94ddda30acdf (diff)
downloadcompcert-kvx-410a5db3d48e84f2157c2c4f4bc29056c0e174b9.tar.gz
compcert-kvx-410a5db3d48e84f2157c2c4f4bc29056c0e174b9.zip
Moved assembler and linker into own files.
The function to call the assembler and the linker are now in own files like the preprocessor. Bug 19197
Diffstat (limited to 'driver/Assembler.ml')
-rw-r--r--driver/Assembler.ml47
1 files changed, 47 insertions, 0 deletions
diff --git a/driver/Assembler.ml b/driver/Assembler.ml
new file mode 100644
index 00000000..52fb17d8
--- /dev/null
+++ b/driver/Assembler.ml
@@ -0,0 +1,47 @@
+(* *********************************************************************)
+(* *)
+(* 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 = List.concat [
+ Configuration.asm;
+ ["-o"; ofile];
+ List.rev !assembler_options;
+ [ifile]
+ ] 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"