| Attached Files | 0001-Add-nocmx-compile-option-to-ignore-cmx-files.patch [^] (5,087 bytes) 2012-12-19 11:43 [Show Content] [Hide Content]From c95dbc3a49e38cb35f665cdd429431183498ad29 Mon Sep 17 00:00:00 2001
From: Pierre Chambart <pierre.chambart@ocamlpro.org>
Date: Wed, 19 Dec 2012 11:37:52 +0100
Subject: [PATCH] Add -nocmx compile option to ignore cmx files.
---
asmcomp/compilenv.ml | 1 +
driver/main_args.ml | 9 +++++++++
driver/main_args.mli | 2 ++
driver/optmain.ml | 1 +
tools/ocamloptp.ml | 1 +
utils/clflags.ml | 2 +-
utils/clflags.mli | 1 +
7 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/asmcomp/compilenv.ml b/asmcomp/compilenv.ml
index 5f2bcdd..9598094 100644
--- a/asmcomp/compilenv.ml
+++ b/asmcomp/compilenv.ml
@@ -123,6 +123,7 @@ let get_global_info global_ident =
with Not_found ->
let (infos, crc) =
try
+ if !Clflags.nocmx then raise Not_found;
let filename =
find_in_path_uncap !load_path (modname ^ ".cmx") in
let (ui, crc) = read_unit_info filename in
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 3f3e063..0008fc2 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -398,6 +398,10 @@ let mk_dstartup f =
"-dstartup", Arg.Unit f, " (undocumented)"
;;
+let mk_nocmx f =
+ "-nocmx", Arg.Unit f, " Do not use informations provided by cmx files"
+;;
+
let mk__ f =
"-", Arg.String f,
"<file> Treat <file> as a file name (even if it starts with `-')"
@@ -563,6 +567,7 @@ module type Optcomp_options = sig
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dstartup : unit -> unit
+ val _nocmx : unit -> unit
val anonymous : string -> unit
end;;
@@ -610,6 +615,7 @@ module type Opttop_options = sig
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dstartup : unit -> unit
+ val _nocmx : unit -> unit
val anonymous : string -> unit
end;;
@@ -748,6 +754,7 @@ struct
mk_no_app_funct F._no_app_funct;
mk_noassert F._noassert;
mk_noautolink_opt F._noautolink;
+ mk_nocmx F._nocmx;
mk_nodynlink F._nodynlink;
mk_nolabels F._nolabels;
mk_nostdlib F._nostdlib;
@@ -793,6 +800,7 @@ struct
mk_dscheduling F._dscheduling;
mk_dlinear F._dlinear;
mk_dstartup F._dstartup;
+ mk_dstartup F._dstartup;
mk__ F.anonymous;
]
@@ -808,6 +816,7 @@ module Make_opttop_options (F : Opttop_options) = struct
mk_labels F._labels;
mk_no_app_funct F._no_app_funct;
mk_noassert F._noassert;
+ mk_nocmx F._nocmx;
mk_nolabels F._nolabels;
mk_noprompt F._noprompt;
mk_nopromptcont F._nopromptcont;
diff --git a/driver/main_args.mli b/driver/main_args.mli
index 80e659e..99bf86b 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -172,6 +172,7 @@ module type Optcomp_options = sig
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dstartup : unit -> unit
+ val _nocmx : unit -> unit
val anonymous : string -> unit
end;;
@@ -219,6 +220,7 @@ module type Opttop_options = sig
val _dscheduling : unit -> unit
val _dlinear : unit -> unit
val _dstartup : unit -> unit
+ val _nocmx : unit -> unit
val anonymous : string -> unit
end;;
diff --git a/driver/optmain.ml b/driver/optmain.ml
index 84d6fd0..932413e 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -167,6 +167,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _dscheduling = set dump_scheduling
let _dlinear = set dump_linear
let _dstartup = set keep_startup_file
+ let _nocmx = set nocmx
let anonymous = anonymous
end);;
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
index 57f7085..3ca65f5 100644
--- a/tools/ocamloptp.ml
+++ b/tools/ocamloptp.ml
@@ -111,6 +111,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _dscheduling = option "-dscheduling"
let _dlinear = option "-dlinear"
let _dstartup = option "-dstartup"
+ let _nocmx = option "-nocmx"
let anonymous = process_file
end);;
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 30644c2..e3239bb 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -64,6 +64,7 @@ and dump_instr = ref false (* -dinstr *)
let keep_asm_file = ref false (* -S *)
let optimize_for_speed = ref true (* -compact *)
+and nocmx = ref false (* -nocmx *)
and dump_cmm = ref false (* -dcmm *)
let dump_selection = ref false (* -dsel *)
@@ -79,7 +80,6 @@ let dump_scheduling = ref false (* -dscheduling *)
let dump_linear = ref false (* -dlinear *)
let keep_startup_file = ref false (* -dstartup *)
let dump_combine = ref false (* -dcombine *)
-
let native_code = ref false (* set to true under ocamlopt *)
let inline_threshold = ref 10
diff --git a/utils/clflags.mli b/utils/clflags.mli
index 5164197..6d5a4e6 100644
--- a/utils/clflags.mli
+++ b/utils/clflags.mli
@@ -81,3 +81,4 @@ val std_include_dir : unit -> string list
val shared : bool ref
val dlcode : bool ref
val runtime_variant : string ref
+val nocmx : bool ref
--
1.7.10.4
|