summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2011-03-17 16:18:05 +0000
committerDamien Doligez <damien.doligez-inria.fr>2011-03-17 16:18:05 +0000
commita53ce2df70be41722d1b1054d1b06af4560d691f (patch)
tree2429cd9b45cb7cae7e0d3dd2826de05b6d1079ed
parent80384c6d8401cdd897e7ff4c75a7a7b1a12b5585 (diff)
downloadocaml-a53ce2df70be41722d1b1054d1b06af4560d691f.tar.gz
add option -runtime-variant
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10982 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Changes6
-rw-r--r--INSTALL4
-rw-r--r--asmcomp/asmlink.ml2
-rw-r--r--asmrun/Makefile18
-rwxr-xr-xboot/ocamlcbin1103803 -> 1104756 bytes
-rwxr-xr-xboot/ocamldepbin308381 -> 308936 bytes
-rwxr-xr-xboot/ocamllexbin169516 -> 170048 bytes
-rw-r--r--bytecomp/bytelink.ml8
-rwxr-xr-xbyterun/Makefile.common17
-rwxr-xr-xconfigure9
-rw-r--r--driver/main.ml1
-rw-r--r--driver/main_args.ml9
-rw-r--r--driver/main_args.mli2
-rw-r--r--driver/optmain.ml1
-rw-r--r--man/ocamlc.m10
-rw-r--r--man/ocamlopt.m10
-rw-r--r--stdlib/Makefile10
-rw-r--r--stdlib/Makefile.nt9
-rwxr-xr-xstdlib/Makefile.shared14
-rw-r--r--stdlib/camlheaderd1
-rw-r--r--stdlib/headernt.c2
-rw-r--r--tools/ocamlcp.ml1
-rw-r--r--utils/clflags.ml4
-rw-r--r--utils/clflags.mli1
24 files changed, 124 insertions, 15 deletions
diff --git a/Changes b/Changes
index 7c35b12741..2ff91021d6 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+Objective Caml 3.13.0:
+----------------------
+
+- Warning 28 is now enabled by default.
+
+
Objective Caml 3.12.0:
----------------------
diff --git a/INSTALL b/INSTALL
index dd479b41e2..6c4f146dbe 100644
--- a/INSTALL
+++ b/INSTALL
@@ -119,6 +119,10 @@ The "configure" script accepts the following options:
run-time system manually written in assembly language.
This assembler must preprocess its input with the C preprocessor.
+-with-debug-runtime
+ Compile and install the debug version of the runtimes, useful
+ for debugging C stubs and other low-level code.
+
-verbose
Verbose output of the configuration tests. Use it if the outcome
of configure is not what you were expecting.
diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
index 8b8cbc0a48..2f6966a24c 100644
--- a/asmcomp/asmlink.ml
+++ b/asmcomp/asmlink.ml
@@ -101,7 +101,7 @@ let runtime_lib () =
let libname =
if !Clflags.gprofile
then "libasmrunp" ^ ext_lib
- else "libasmrun" ^ ext_lib in
+ else "libasmrun" ^ !Clflags.runtime_variant ^ ext_lib in
try
if !Clflags.nopervasives then []
else [ find_in_path !load_path libname ]
diff --git a/asmrun/Makefile b/asmrun/Makefile
index de8427a4d9..a66fc2740b 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -34,13 +34,19 @@ OBJS=$(COBJS) $(ASMOBJS)
DOBJS=$(COBJS:.o=.d.o) $(ASMOBJS)
POBJS=$(COBJS:.o=.p.o) $(ASMOBJS:.o=.p.o)
-all: libasmrun.a all-$(PROFILING)
+all: libasmrun.a all-$(RUNTIMED) all-$(PROFILING)
libasmrun.a: $(OBJS)
rm -f libasmrun.a
ar rc libasmrun.a $(OBJS)
$(RANLIB) libasmrun.a
+all-noruntimed:
+.PHONY: all-noruntimed
+
+all-runtimed: libasmrund.a
+.PHONY: all-runtimed
+
libasmrund.a: $(DOBJS)
rm -f libasmrund.a
ar rc libasmrund.a $(DOBJS)
@@ -55,12 +61,20 @@ libasmrunp.a: $(POBJS)
ar rc libasmrunp.a $(POBJS)
$(RANLIB) libasmrunp.a
-install: install-default install-$(PROFILING)
+install: install-default install-$(RUNTIMED) install-$(PROFILING)
install-default:
cp libasmrun.a $(LIBDIR)/libasmrun.a
cd $(LIBDIR); $(RANLIB) libasmrun.a
+install-noruntimed:
+.PHONY: install-noruntimed
+
+install-runtimed:
+ cp libasmrund.a $(LIBDIR)/libasmrund.a
+ cd $(LIBDIR); $(RANLIB) libasmrund.a
+.PHONY: install-runtimed
+
install-noprof:
rm -f $(LIBDIR)/libasmrunp.a; ln -s libasmrun.a $(LIBDIR)/libasmrunp.a
diff --git a/boot/ocamlc b/boot/ocamlc
index e95cb3a90c..52ad23de10 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamldep b/boot/ocamldep
index dd86388bf6..90e59f67ed 100755
--- a/boot/ocamldep
+++ b/boot/ocamldep
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index 3b4799a1e4..6f065d5a5f 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
index ede7bb9770..b4accdc9e5 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -276,7 +276,7 @@ let link_bytecode tolink exec_name standalone =
try
let header =
if String.length !Clflags.use_runtime > 0
- then "camlheader_ur" else "camlheader" in
+ then "camlheader_ur" else "camlheader" ^ !Clflags.runtime_variant in
let inchan = open_in_bin (find_in_path !load_path header) in
copy_file inchan outchan;
close_in inchan
@@ -466,8 +466,9 @@ void caml_startup(char ** argv)\n\
(* Build a custom runtime *)
let build_custom_runtime prim_name exec_name =
+ let runtime_lib = "-lcamlrun" ^ !Clflags.runtime_variant in
Ccomp.call_linker Ccomp.Exe exec_name
- ([prim_name] @ List.rev !Clflags.ccobjs @ ["-lcamlrun"])
+ ([prim_name] @ List.rev !Clflags.ccobjs @ [runtime_lib])
(Clflags.std_include_flag "-I" ^ " " ^ Config.bytecomp_c_libraries)
let append_bytecode_and_cleanup bytecode_name exec_name prim_name =
@@ -546,8 +547,9 @@ let link objfiles output_name =
if not (Filename.check_suffix output_name Config.ext_obj) then begin
temps := obj_file :: !temps;
if not (
+ let runtime_lib = "-lcamlrun" ^ !Clflags.runtime_variant in
Ccomp.call_linker Ccomp.MainDll output_name
- ([obj_file] @ List.rev !Clflags.ccobjs @ ["-lcamlrun"])
+ ([obj_file] @ List.rev !Clflags.ccobjs @ [runtime_lib])
Config.bytecomp_c_libraries
) then raise (Error Custom_runtime);
end
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
index cc75ccede5..d290368105 100755
--- a/byterun/Makefile.common
+++ b/byterun/Makefile.common
@@ -37,9 +37,15 @@ PUBLIC_INCLUDES=\
memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h
-all:: ocamlrun$(EXE) ld.conf libcamlrun.$(A)
+all:: ocamlrun$(EXE) ld.conf libcamlrun.$(A) all-$(RUNTIMED)
.PHONY: all
+all-noruntimed:
+.PHONY: all-noruntimed
+
+all-runtimed: ocamlrund$(EXE) libcamlrund.$(A)
+.PHONY: all-runtimed
+
ld.conf: ../config/Makefile
echo "$(STUBLIBDIR)" > ld.conf
echo "$(LIBDIR)" >> ld.conf
@@ -55,6 +61,15 @@ install::
cp ld.conf $(LIBDIR)/ld.conf
.PHONY: install
+install:: install-$(RUNTIMED)
+
+install-noruntimed:
+.PHONY: install-noruntimed
+
+install-runtimed:
+ cp ocamlrund$(EXE) $(BINDIR)/ocamlrund$(EXE)
+ cp libcamlrund.$(A) $(LIBDIR)/libcamlrund.$(A)
+.PHONY: install-runtimed
primitives : $(PRIMS)
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
diff --git a/configure b/configure
index 56a209ce37..0335a24630 100755
--- a/configure
+++ b/configure
@@ -39,6 +39,7 @@ tk_x11=yes
dl_defs=''
verbose=no
withcurses=yes
+debugruntime=noruntimed
withsharedlibs=yes
gcc_warnings="-Wall"
partialld="ld -r"
@@ -109,6 +110,8 @@ while : ; do
dllib="$2"; shift;;
-verbose|--verbose)
verbose=yes;;
+ -with-debug-runtime|--with-debug-runtime)
+ debugruntime=runtimed;;
*) echo "Unknown option \"$1\"." 1>&2; exit 2;;
esac
shift
@@ -1649,6 +1652,7 @@ echo "CMXS=$cmxs" >> Makefile
echo "MKEXE=$mkexe" >> Makefile
echo "MKDLL=$mksharedlib" >> Makefile
echo "MKMAINDLL=$mkmaindll" >> Makefile
+echo "RUNTIMED=${debugruntime}" >>Makefile
rm -f tst hasgot.c
rm -f ../m.h ../s.h ../Makefile
@@ -1707,6 +1711,11 @@ else
echo "Source-level replay debugger: not supported"
fi
+if test "$debugruntime" = "runtimed"; then
+ echo "Debug runtime will be compiled and installed"
+fi
+
+
echo "Additional libraries supported:"
echo " $otherlibraries"
diff --git a/driver/main.ml b/driver/main.ml
index 09aa89655e..58d3b8e50c 100644
--- a/driver/main.ml
+++ b/driver/main.ml
@@ -119,6 +119,7 @@ module Options = Main_args.Make_bytecomp_options (struct
let _pp s = preprocessor := Some s
let _principal = set principal
let _rectypes = set recursive_types
+ let _runtime_variant s = runtime_variant := s
let _strict_sequence = set strict_sequence
let _thread = set use_threads
let _vmthread = set use_vmthreads
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 279a46328e..e50504fe58 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -204,6 +204,11 @@ let mk_rectypes f =
"-rectypes", Arg.Unit f, " Allow arbitrary recursive types"
;;
+let mk_runtime_variant f =
+ "-runtime-variant", Arg.String f,
+ "<str> Use the <str> variant of the run-time system"
+;;
+
let mk_S f =
"-S", Arg.Unit f, " Keep intermediate assembly file"
;;
@@ -402,6 +407,7 @@ module type Bytecomp_options = sig
val _pp : string -> unit
val _principal : unit -> unit
val _rectypes : unit -> unit
+ val _runtime_variant : string -> unit
val _strict_sequence : unit -> unit
val _thread : unit -> unit
val _vmthread : unit -> unit
@@ -485,6 +491,7 @@ module type Optcomp_options = sig
val _pp : string -> unit
val _principal : unit -> unit
val _rectypes : unit -> unit
+ val _runtime_variant : string -> unit
val _strict_sequence : unit -> unit
val _shared : unit -> unit
val _S : unit -> unit
@@ -604,6 +611,7 @@ struct
mk_pp F._pp;
mk_principal F._principal;
mk_rectypes F._rectypes;
+ mk_runtime_variant F._runtime_variant;
mk_strict_sequence F._strict_sequence;
mk_thread F._thread;
mk_unsafe F._unsafe;
@@ -695,6 +703,7 @@ struct
mk_pp F._pp;
mk_principal F._principal;
mk_rectypes F._rectypes;
+ mk_runtime_variant F._runtime_variant;
mk_S F._S;
mk_strict_sequence F._strict_sequence;
mk_shared F._shared;
diff --git a/driver/main_args.mli b/driver/main_args.mli
index 1c4abf5097..8a4fbc3791 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -44,6 +44,7 @@ module type Bytecomp_options =
val _pp : string -> unit
val _principal : unit -> unit
val _rectypes : unit -> unit
+ val _runtime_variant : string -> unit
val _strict_sequence : unit -> unit
val _thread : unit -> unit
val _vmthread : unit -> unit
@@ -128,6 +129,7 @@ module type Optcomp_options = sig
val _pp : string -> unit
val _principal : unit -> unit
val _rectypes : unit -> unit
+ val _runtime_variant : string -> unit
val _strict_sequence : unit -> unit
val _shared : unit -> unit
val _S : unit -> unit
diff --git a/driver/optmain.ml b/driver/optmain.ml
index 1c7352c527..c76f56a8a0 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -128,6 +128,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _pp s = preprocessor := Some s
let _principal = set principal
let _rectypes = set recursive_types
+ let _runtime_variant s = runtime_variant := s
let _strict_sequence = set strict_sequence
let _shared () = shared := true; dlcode := true
let _S = set keep_asm_file
diff --git a/man/ocamlc.m b/man/ocamlc.m
index e4715bbadb..490d05296b 100644
--- a/man/ocamlc.m
+++ b/man/ocamlc.m
@@ -444,6 +444,16 @@ only recursive types where the recursion goes through an object type
are supported. Note that once you have created an interface using this
flag, you must use it again for all dependencies.
.TP
+.BI \-runtime\-variant \ suffix
+Add
+.I suffix
+to the name of the runtime library that will be used by the program.
+If OCaml was configured with option
+.BR \-with\-debug\-runtime ,
+then the
+.B d
+suffix is supported and gives a debug version of the runtime.
+.TP
.B \-thread
Compile or link multithreaded programs, in combination with the
system "threads" library described in
diff --git a/man/ocamlopt.m b/man/ocamlopt.m
index c021fab6e8..e3f408917d 100644
--- a/man/ocamlopt.m
+++ b/man/ocamlopt.m
@@ -397,6 +397,16 @@ types are derived in a principal way. All programs accepted in
mode are also accepted in default mode with equivalent
types, but different binary signatures.
.TP
+.BI \-runtime\-variant \ suffix
+Add
+.I suffix
+to the name of the runtime library that will be used by the program.
+If OCaml was configured with option
+.BR \-with\-debug\-runtime ,
+then the
+.B d
+suffix is supported and gives a debug version of the runtime.
+.TP
.B \-rectypes
Allow arbitrary recursive types during type-checking. By default,
only recursive types where the recursion goes through an object type
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 874dcf6f9e..59a2e18fb1 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -42,9 +42,10 @@ installopt-prof:
stdlib.p.cmxa: $(OBJS:.cmo=.p.cmx)
$(CAMLOPT) -a -o stdlib.p.cmxa $(OBJS:.cmo=.p.cmx)
-camlheader camlheader_ur: header.c ../config/Makefile
+camlheader camlheaderd camlheader_ur: header.c ../config/Makefile
if $(SHARPBANGSCRIPTS); then \
echo '#!$(BINDIR)/ocamlrun' > camlheader && \
+ echo '#!$(BINDIR)/ocamlrund' > camlheaderd && \
echo '#!' | tr -d '\012' > camlheader_ur; \
else \
$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) \
@@ -52,7 +53,12 @@ camlheader camlheader_ur: header.c ../config/Makefile
header.c -o tmpheader$(EXE) && \
strip tmpheader$(EXE) && \
mv tmpheader$(EXE) camlheader && \
- cp camlheader camlheader_ur; \
+ cp camlheader camlheader_ur && \
+ $(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) \
+ -DRUNTIME_NAME='"$(BINDIR)/ocamlrund"' \
+ header.c -o tmpheader$(EXE) && \
+ strip tmpheader$(EXE) && \
+ mv tmpheader$(EXE) camlheaderd; \
fi
.PHONY: all allopt allopt-noprof allopt-prof install installopt
diff --git a/stdlib/Makefile.nt b/stdlib/Makefile.nt
index 995a0c3fd6..b21f0a375c 100644
--- a/stdlib/Makefile.nt
+++ b/stdlib/Makefile.nt
@@ -21,11 +21,18 @@ installopt:
cp stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx $(LIBDIR)
camlheader camlheader_ur: headernt.c ../config/Makefile
- $(BYTECC) $(BYTECCCOMPOPTS) -c -I../byterun headernt.c
+ $(BYTECC) $(BYTECCCOMPOPTS) -c -I../byterun \
+ -DRUNTIME_NAME='"ocamlrun"' headernt.c
$(MKEXE) -o tmpheader.exe headernt.$(O) $(EXTRALIBS)
rm -f camlheader.exe
mv tmpheader.exe camlheader
cp camlheader camlheader_ur
+camlheaderd: headernt.c ../config/Makefile
+ $(BYTECC) $(BYTECCCOMPOPTS) -c -I../byterun \
+ -DRUNTIME_NAME='"ocamlrund"' headernt.c
+ $(MKEXE) -o tmpheader.exe headernt.$(O) $(EXTRALIBS)
+ mv tmpheader.exe camlheaderd
+
# TODO: do not call flexlink to build tmpheader.exe (we don't need
# the export table)
diff --git a/stdlib/Makefile.shared b/stdlib/Makefile.shared
index 64087dc9c3..d1b1812785 100755
--- a/stdlib/Makefile.shared
+++ b/stdlib/Makefile.shared
@@ -40,8 +40,16 @@ OTHERS=array.cmo list.cmo char.cmo string.cmo sys.cmo \
all: stdlib.cma std_exit.cmo camlheader camlheader_ur
-install:
- cp stdlib.cma std_exit.cmo *.cmi *.mli *.ml camlheader camlheader_ur $(LIBDIR)
+install: install-$(RUNTIMED)
+ cp stdlib.cma std_exit.cmo *.cmi *.mli *.ml camlheader camlheader_ur \
+ $(LIBDIR)
+
+install-noruntimed:
+.PHONY: install-noruntimed
+
+install-runtimed: camlheaderd
+ cp camlheaderd $(LIBDIR)
+.PHONY: install-runtimed
stdlib.cma: $(OBJS)
$(CAMLC) -a -o stdlib.cma $(OBJS)
@@ -56,7 +64,7 @@ clean::
rm -f sys.ml
clean::
- rm -f camlheader camlheader_ur
+ rm -f camlheader camlheader_ur camlheaderd
.SUFFIXES: .mli .ml .cmi .cmo .cmx .p.cmx
diff --git a/stdlib/camlheaderd b/stdlib/camlheaderd
new file mode 100644
index 0000000000..4a26863e57
--- /dev/null
+++ b/stdlib/camlheaderd
@@ -0,0 +1 @@
+#!/usr/local/ocaml/trunk/bin/ocamlrund
diff --git a/stdlib/headernt.c b/stdlib/headernt.c
index c8d23ee256..77f368afd9 100644
--- a/stdlib/headernt.c
+++ b/stdlib/headernt.c
@@ -26,7 +26,7 @@
#pragma comment(lib , "kernel32")
#endif
-char * default_runtime_name = "ocamlrun";
+char * default_runtime_name = RUNTIME_NAME;
static
#if _MSC_VER >= 1200
diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
index a86ae352fc..0218a14fba 100644
--- a/tools/ocamlcp.ml
+++ b/tools/ocamlcp.ml
@@ -73,6 +73,7 @@ module Options = Main_args.Make_bytecomp_options (struct
let _pp s = incompatible "-pp"
let _principal = option "-principal"
let _rectypes = option "-rectypes"
+ let _runtime_variant s = option_with_arg "-runtime-variant" s
let _strict_sequence = option "-strict-sequence"
let _thread () = option "-thread" ()
let _vmthread () = option "-vmthread" ()
diff --git a/utils/clflags.ml b/utils/clflags.ml
index 1074d3628c..b289744770 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -46,7 +46,7 @@ and principal = ref false (* -principal *)
and recursive_types = ref false (* -rectypes *)
and strict_sequence = ref false (* -strict-sequence *)
and applicative_functors = ref true (* -no-app-funct *)
-and make_runtime = ref false (* -make_runtime *)
+and make_runtime = ref false (* -make-runtime *)
and gprofile = ref false (* -p *)
and c_compiler = ref (None: string option) (* -cc *)
and no_auto_link = ref false (* -noautolink *)
@@ -92,3 +92,5 @@ let std_include_dir () =
let shared = ref false (* -shared *)
let dlcode = ref true (* not -nodynlink *)
+
+let runtime_variant = ref "";; (* -runtime-variant *)
diff --git a/utils/clflags.mli b/utils/clflags.mli
index d5357ef396..c3a3966b58 100644
--- a/utils/clflags.mli
+++ b/utils/clflags.mli
@@ -76,3 +76,4 @@ val std_include_flag : string -> string
val std_include_dir : unit -> string list
val shared : bool ref
val dlcode : bool ref
+val runtime_variant : string ref