aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-09-11 19:34:09 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2017-09-11 19:34:09 +0200
commit4d099ef842684d3eeccff22f9d4019c7d1d70ee1 (patch)
treece1a054c03d31ca5005b238dcb5a6b6bb3598d2f
parent5fbc0af7e902bacafb5c77a0f523eb4b36198dea (diff)
downloadcompcert-kvx-4d099ef842684d3eeccff22f9d4019c7d1d70ee1.tar.gz
compcert-kvx-4d099ef842684d3eeccff22f9d4019c7d1d70ee1.zip
Resurrect the Cygwin x86-32 port
It got lost during the addition of the x86-64 port in release 3.0.
-rw-r--r--Changelog3
-rw-r--r--x86/TargetPrinter.ml59
2 files changed, 60 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index f4470193..f87d392f 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,9 @@
Code generation and optimization:
- ARM in Thumb mode: simpler instruction sequence for branch through jump table.
+Usability:
+- Resurrected support for the Cygwin x86-32 port, which got lost at release 3.0.
+
Bug fixing:
- Issue #P25: make sure sizeof(long double) = sizeof(double) in all contexts.
diff --git a/x86/TargetPrinter.ml b/x86/TargetPrinter.ml
index f61d7686..eb719060 100644
--- a/x86/TargetPrinter.ml
+++ b/x86/TargetPrinter.ml
@@ -233,6 +233,61 @@ module MacOS_System : SYSTEM =
end
+(* Printer functions for Cygwin *)
+module Cygwin_System : SYSTEM =
+ struct
+
+ let raw_symbol oc s =
+ fprintf oc "_%s" s
+
+ let symbol oc symb =
+ raw_symbol oc (extern_atom symb)
+
+ let label oc lbl =
+ fprintf oc "L%d" lbl
+
+ let name_of_section = function
+ | Section_text -> ".text"
+ | Section_data i | Section_small_data i ->
+ if i then ".data" else "COMM"
+ | Section_const i | Section_small_const i ->
+ if i then ".section .rdata,\"dr\"" else "COMM"
+ | Section_string -> ".section .rdata,\"dr\""
+ | Section_literal -> ".section .rdata,\"dr\""
+ | Section_jumptable -> ".text"
+ | Section_user(s, wr, ex) ->
+ sprintf ".section \"%s\", \"%s\"\n"
+ s (if ex then "xr" else if wr then "d" else "dr")
+ | Section_debug_info _ -> ".section .debug_info,\"dr\""
+ | Section_debug_loc -> ".section .debug_loc,\"dr\""
+ | Section_debug_line _ -> ".section .debug_line,\"dr\""
+ | Section_debug_abbrev -> ".section .debug_abbrev,\"dr\""
+ | Section_debug_ranges -> ".section .debug_ranges,\"dr\""
+ | Section_debug_str-> assert false (* Should not be used *)
+
+ let stack_alignment = 8 (* minimum is 4, 8 is better for perfs *)
+
+ let print_align oc n =
+ fprintf oc " .align %d\n" n
+
+ let print_mov_rs oc rd id =
+ fprintf oc " movl $%a, %a\n" symbol id ireg rd
+
+ let print_fun_info _ _ = ()
+
+ let print_var_info _ _ = ()
+
+ let print_epilogue _ = ()
+
+ let print_comm_decl oc name sz al =
+ fprintf oc " .comm %a, %s, %d\n" symbol name (Z.to_string sz) al
+
+ let print_lcomm_decl oc name sz al =
+ fprintf oc " .local %a\n" symbol name;
+ print_comm_decl oc name sz al
+
+ end
+
module Target(System: SYSTEM):TARGET =
struct
@@ -880,8 +935,8 @@ end
let sel_target () =
let module S = (val (match Configuration.system with
+ | "linux" | "bsd" -> (module ELF_System:SYSTEM)
| "macosx" -> (module MacOS_System:SYSTEM)
- | "linux"
- | "bsd" -> (module ELF_System:SYSTEM)
+ | "cygwin" -> (module Cygwin_System:SYSTEM)
| _ -> invalid_arg ("System " ^ Configuration.system ^ " not supported") ):SYSTEM) in
(module Target(S):TARGET)