1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
-index 72f4240..cbb6491 100755
+index e08bbce..c95424e 100755
--- a/configure
+++ b/configure
@@ -299,7 +299,8 @@ case "$bytecc,$host" in
cc,mips-*-irix6*)
# Add -n32 flag to ensure compatibility with native-code compiler
bytecccompopts="-n32"
-@@ -733,6 +734,7 @@ case "$arch,$nativecc,$system,$host_type" in
+@@ -734,6 +735,7 @@ case "$arch,$nativecc,$system,$host_type" in
nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
*,*,rhapsody,*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
if $arch64; then partialld="ld -r -arch ppc64"; fi;;
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
-index cbb6491..afca5b0 100755
+index c95424e..20f7977 100755
--- a/configure
+++ b/configure
-@@ -1615,7 +1615,7 @@ echo "DEBUGGER=$debugger" >> Makefile
+@@ -1619,7 +1619,7 @@ echo "DEBUGGER=$debugger" >> Makefile
echo "CC_PROFILE=$cc_profile" >> Makefile
echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
echo "PARTIALLD=$partialld" >> Makefile
1 file changed, 5 insertions(+)
diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp
-index f114b13..d3f359d 100644
+index b6c236e..b491fdd 100644
--- a/tools/ocamlmklib.mlp
+++ b/tools/ocamlmklib.mlp
-@@ -37,6 +37,11 @@ and output_c = ref "" (* Output name for C part of library *)
+@@ -38,6 +38,11 @@ and output_c = ref "" (* Output name for C part of library *)
and rpath = ref [] (* rpath options *)
and verbose = ref false
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
-index b9dd690..679973b 100644
+index 74c82d3..1ef43b3 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
-@@ -342,7 +342,7 @@ test_texi: dummy
+@@ -344,7 +344,7 @@ test_texi: dummy
stdlib_man/Pervasives.3o: $(STDLIB_MLIS)
$(MKDIR) stdlib_man
$(OCAMLDOC_RUN) -man -d stdlib_man $(INCLUDES) \
--- /dev/null
+From: Stephane Glondu <steph@glondu.net>
+Date: Thu, 21 Apr 2011 18:39:31 +0200
+Subject: Avoid multiple declarations in generated .c files in -output-obj
+
+In -output-obj mode, <caml/mlvalues.h> (which contains some
+primitives) is included in the generated .c file, leading to errors
+when compiling with g++ (multiple declarations).
+
+There are probably better implementations (in particular, in this one,
+care must be taken when changing the list of primitives available in
+mlvalues.h), but this is a small and (not too) intrusive patch.
+
+Bug: http://caml.inria.fr/mantis/view.php?id=5254
+Signed-off-by: Stephane Glondu <steph@glondu.net>
+---
+ bytecomp/bytelink.ml | 17 +++++++++++++++--
+ bytecomp/symtable.ml | 8 +++++---
+ bytecomp/symtable.mli | 2 +-
+ 3 files changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
+index f40e425..bb14de6 100644
+--- a/bytecomp/bytelink.ml
++++ b/bytecomp/bytelink.ml
+@@ -408,6 +408,19 @@ let output_cds_file outfile =
+ remove_file outfile;
+ raise x
+
++(* List of primitives declared in caml/mlvalues.h, to avoid duplicate
++ declarations in generated .c files *)
++
++let mlvalues_primitives = [
++ "caml_get_public_method";
++ "caml_hash_variant";
++ "caml_string_length";
++ "caml_Double_val";
++ "caml_Store_double_val";
++ "caml_Int64_val";
++ "caml_atom_table";
++]
++
+ (* Output a bytecode executable as a C file *)
+
+ let link_bytecode_as_c ppf tolink outfile =
+@@ -450,7 +463,7 @@ let link_bytecode_as_c ppf tolink outfile =
+ (Marshal.to_string sections []);
+ output_string outchan "\n};\n\n";
+ (* The table of primitives *)
+- Symtable.output_primitive_table outchan;
++ Symtable.output_primitive_table outchan mlvalues_primitives;
+ (* The entry point *)
+ output_string outchan "\
+ \nvoid caml_startup(char ** argv)\
+@@ -530,7 +543,7 @@ let link ppf objfiles output_name =
+ #else\n\
+ typedef long value;\n\
+ #endif\n";
+- Symtable.output_primitive_table poc;
++ Symtable.output_primitive_table poc [];
+ output_string poc "\
+ #ifdef __cplusplus\n\
+ }\n\
+diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml
+index 7ab4bfd..3f4495e 100644
+--- a/bytecomp/symtable.ml
++++ b/bytecomp/symtable.ml
+@@ -115,15 +115,17 @@ let output_primitive_names outchan =
+
+ open Printf
+
+-let output_primitive_table outchan =
++let output_primitive_table outchan blacklist =
+ let prim = all_primitives() in
+ for i = 0 to Array.length prim - 1 do
+- fprintf outchan "extern value %s();\n" prim.(i)
++ let p = prim.(i) in
++ if not (List.mem p blacklist) then
++ fprintf outchan "extern value %s();\n" p
+ done;
+ fprintf outchan "typedef value (*primitive)();\n";
+ fprintf outchan "primitive caml_builtin_cprim[] = {\n";
+ for i = 0 to Array.length prim - 1 do
+- fprintf outchan " %s,\n" prim.(i)
++ fprintf outchan " (primitive)%s,\n" prim.(i)
+ done;
+ fprintf outchan " (primitive) 0 };\n";
+ fprintf outchan "const char * caml_names_of_builtin_cprim[] = {\n";
+diff --git a/bytecomp/symtable.mli b/bytecomp/symtable.mli
+index b4268f4..22dfebc 100644
+--- a/bytecomp/symtable.mli
++++ b/bytecomp/symtable.mli
+@@ -24,7 +24,7 @@ val require_primitive: string -> unit
+ val initial_global_table: unit -> Obj.t array
+ val output_global_map: out_channel -> unit
+ val output_primitive_names: out_channel -> unit
+-val output_primitive_table: out_channel -> unit
++val output_primitive_table: out_channel -> string list -> unit
+ val data_global_map: unit -> Obj.t
+ val data_primitive_names: unit -> string
+
+--
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Thu, 21 Jun 2012 13:35:22 +0200
-Subject: Natdynlink works on powerpc, hurd-i386 and sparc
-
-Rationale: ssreflect used to work with natdynlink there with ocaml
-3.11.2 / coq 8.2...
-
-Note: on my test machine for sparc (64-bit kernel, 32-bit userland),
-$host is sparc64-unknown-linux-gnu.
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5255
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- configure | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/configure b/configure
-index afca5b0..663eae1 100755
---- a/configure
-+++ b/configure
-@@ -630,6 +630,7 @@ if test $withsharedlibs = "yes"; then
- case "$host" in
- *-*-cygwin*) natdynlink=true;;
- i[3456]86-*-linux*) natdynlink=true;;
-+ i[3456]86-*-gnu*) natdynlink=true;;
- x86_64-*-linux*) natdynlink=true;;
- i[3456]86-*-darwin[89].*) natdynlink=true;;
- i[3456]86-*-darwin*)
-@@ -637,8 +638,8 @@ if test $withsharedlibs = "yes"; then
- natdynlink=true
- fi;;
- x86_64-*-darwin*) natdynlink=true;;
-- powerpc64-*-linux*) natdynlink=true;;
-- sparc-*-linux*) natdynlink=true;;
-+ powerpc*-*-linux*) natdynlink=true;;
-+ sparc*-*-linux*) natdynlink=true;;
- i686-*-kfreebsd*) natdynlink=true;;
- x86_64-*-kfreebsd*) natdynlink=true;;
- i[345]86-*-freebsd*) natdynlink=true;;
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Thu, 21 Apr 2011 18:39:57 +0200
-Subject: Declare primitive name table as const char *
-
-This avoids lots of warnings when compiling with g++...
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5131
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- bytecomp/symtable.ml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml
-index 872a4bb..60c884e 100644
---- a/bytecomp/symtable.ml
-+++ b/bytecomp/symtable.ml
-@@ -126,7 +126,7 @@ let output_primitive_table outchan =
- fprintf outchan " %s,\n" prim.(i)
- done;
- fprintf outchan " (primitive) 0 };\n";
-- fprintf outchan "char * caml_names_of_builtin_cprim[] = {\n";
-+ fprintf outchan "const char * caml_names_of_builtin_cprim[] = {\n";
- for i = 0 to Array.length prim - 1 do
- fprintf outchan " \"%s\",\n" prim.(i)
- done;
---
--- /dev/null
+From: Stephane Glondu <steph@glondu.net>
+Date: Tue, 19 Jun 2012 09:57:08 +0200
+Subject: Embed bytecode in C object when using -custom
+
+This patch fixes non-strippability of bytecode executables linked with
+custom runtime. Having "c" in OCAML_COMPAT environment variable
+restores the original behaviour.
+
+Forwarded: not-needed
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627761
+Signed-off-by: Stephane Glondu <steph@glondu.net>
+---
+ bytecomp/bytelink.ml | 36 ++++++++++++++++++++++++++++++----
+ testsuite/tests/embedded/Makefile | 3 +++
+ testsuite/tests/lib-marshal/Makefile | 3 +++
+ 3 files changed, 38 insertions(+), 4 deletions(-)
+
+diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
+index bb14de6..ec02825 100644
+--- a/bytecomp/bytelink.ml
++++ b/bytecomp/bytelink.ml
+@@ -423,7 +423,7 @@ let mlvalues_primitives = [
+
+ (* Output a bytecode executable as a C file *)
+
+-let link_bytecode_as_c ppf tolink outfile =
++let link_bytecode_as_c ppf tolink outfile with_main =
+ let outchan = open_out outfile in
+ begin try
+ (* The bytecode *)
+@@ -465,14 +465,27 @@ let link_bytecode_as_c ppf tolink outfile =
+ (* The table of primitives *)
+ Symtable.output_primitive_table outchan mlvalues_primitives;
+ (* The entry point *)
+- output_string outchan "\
++ if with_main then begin
++ output_string outchan "\
++\nint main(int argc, char **argv)\
++\n{\
++\n caml_startup_code(caml_code, sizeof(caml_code),\
++\n caml_data, sizeof(caml_data),\
++\n caml_sections, sizeof(caml_sections),\
++\n argv);\
++\n return 0; /* not reached */\
++\n}\n"
++ end else begin
++ output_string outchan "\
+ \nvoid caml_startup(char ** argv)\
+ \n{\
+ \n caml_startup_code(caml_code, sizeof(caml_code),\
+ \n caml_data, sizeof(caml_data),\
+ \n caml_sections, sizeof(caml_sections),\
+ \n argv);\
+-\n}\
++\n}\n"
++ end;
++ output_string outchan "\
+ \n#ifdef __cplusplus\
+ \n}\
+ \n#endif\n";
+@@ -511,6 +524,11 @@ let fix_exec_name name =
+ if String.contains name '.' then name else name ^ ".exe"
+ | _ -> name
+
++(* Legacy custom behaviour (Debian-specific) *)
++
++let legacy_custom =
++ try String.contains (Sys.getenv "OCAML_COMPAT") 'c' with Not_found -> false
++
+ (* Main entry point (build a custom runtime if needed) *)
+
+ let link ppf objfiles output_name =
+@@ -524,6 +542,16 @@ let link ppf objfiles output_name =
+ Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *)
+ if not !Clflags.custom_runtime then
+ link_bytecode ppf tolink output_name true
++ else if not legacy_custom && not !Clflags.output_c_object && not !Clflags.make_runtime then
++ let c_file = Filename.temp_file "camlobj" ".c" in
++ try
++ link_bytecode_as_c ppf tolink c_file true;
++ let exec_name = fix_exec_name output_name in
++ if not (build_custom_runtime c_file exec_name)
++ then raise(Error Custom_runtime);
++ with x ->
++ remove_file c_file;
++ raise x
+ else if not !Clflags.output_c_object then begin
+ let bytecode_name = Filename.temp_file "camlcode" "" in
+ let prim_name = Filename.temp_file "camlprim" ".c" in
+@@ -566,7 +594,7 @@ let link ppf objfiles output_name =
+ if Sys.file_exists c_file then raise(Error(File_exists c_file));
+ let temps = ref [] in
+ try
+- link_bytecode_as_c ppf tolink c_file;
++ link_bytecode_as_c ppf tolink c_file false;
+ if not (Filename.check_suffix output_name ".c") then begin
+ temps := c_file :: !temps;
+ if Ccomp.compile_file c_file <> 0 then raise(Error Custom_runtime);
+diff --git a/testsuite/tests/embedded/Makefile b/testsuite/tests/embedded/Makefile
+index ed33143..0d1e4ca 100644
+--- a/testsuite/tests/embedded/Makefile
++++ b/testsuite/tests/embedded/Makefile
+@@ -1,5 +1,8 @@
+ BASEDIR=../..
+
++# This test relies on the upstream behaviour of -custom
++export OCAML_COMPAT=c
++
+ default: compile run
+
+ compile:
+diff --git a/testsuite/tests/lib-marshal/Makefile b/testsuite/tests/lib-marshal/Makefile
+index 1f78273..4878507 100644
+--- a/testsuite/tests/lib-marshal/Makefile
++++ b/testsuite/tests/lib-marshal/Makefile
+@@ -3,5 +3,8 @@ BASEDIR=../..
+ MAIN_MODULE=intext
+ C_FILES=intextaux
+
++# This test relies on the upstream behaviour of -custom
++export OCAML_COMPAT=c
++
+ include $(BASEDIR)/makefiles/Makefile.one
+ include $(BASEDIR)/makefiles/Makefile.common
+--
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Thu, 21 Apr 2011 18:39:31 +0200
-Subject: Avoid multiple declarations in generated .c files in -output-obj
-
-In -output-obj mode, <caml/mlvalues.h> (which contains some
-primitives) is included in the generated .c file, leading to errors
-when compiling with g++ (multiple declarations).
-
-There are probably better implementations (in particular, in this one,
-care must be taken when changing the list of primitives available in
-mlvalues.h), but this is a small and (not too) intrusive patch.
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5254
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- bytecomp/bytelink.ml | 17 +++++++++++++++--
- bytecomp/symtable.ml | 8 +++++---
- bytecomp/symtable.mli | 2 +-
- 3 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
-index f40e425..bb14de6 100644
---- a/bytecomp/bytelink.ml
-+++ b/bytecomp/bytelink.ml
-@@ -408,6 +408,19 @@ let output_cds_file outfile =
- remove_file outfile;
- raise x
-
-+(* List of primitives declared in caml/mlvalues.h, to avoid duplicate
-+ declarations in generated .c files *)
-+
-+let mlvalues_primitives = [
-+ "caml_get_public_method";
-+ "caml_hash_variant";
-+ "caml_string_length";
-+ "caml_Double_val";
-+ "caml_Store_double_val";
-+ "caml_Int64_val";
-+ "caml_atom_table";
-+]
-+
- (* Output a bytecode executable as a C file *)
-
- let link_bytecode_as_c ppf tolink outfile =
-@@ -450,7 +463,7 @@ let link_bytecode_as_c ppf tolink outfile =
- (Marshal.to_string sections []);
- output_string outchan "\n};\n\n";
- (* The table of primitives *)
-- Symtable.output_primitive_table outchan;
-+ Symtable.output_primitive_table outchan mlvalues_primitives;
- (* The entry point *)
- output_string outchan "\
- \nvoid caml_startup(char ** argv)\
-@@ -530,7 +543,7 @@ let link ppf objfiles output_name =
- #else\n\
- typedef long value;\n\
- #endif\n";
-- Symtable.output_primitive_table poc;
-+ Symtable.output_primitive_table poc [];
- output_string poc "\
- #ifdef __cplusplus\n\
- }\n\
-diff --git a/bytecomp/symtable.ml b/bytecomp/symtable.ml
-index 60c884e..08af10f 100644
---- a/bytecomp/symtable.ml
-+++ b/bytecomp/symtable.ml
-@@ -115,15 +115,17 @@ let output_primitive_names outchan =
-
- open Printf
-
--let output_primitive_table outchan =
-+let output_primitive_table outchan blacklist =
- let prim = all_primitives() in
- for i = 0 to Array.length prim - 1 do
-- fprintf outchan "extern value %s();\n" prim.(i)
-+ let p = prim.(i) in
-+ if not (List.mem p blacklist) then
-+ fprintf outchan "extern value %s();\n" p
- done;
- fprintf outchan "typedef value (*primitive)();\n";
- fprintf outchan "primitive caml_builtin_cprim[] = {\n";
- for i = 0 to Array.length prim - 1 do
-- fprintf outchan " %s,\n" prim.(i)
-+ fprintf outchan " (primitive)%s,\n" prim.(i)
- done;
- fprintf outchan " (primitive) 0 };\n";
- fprintf outchan "const char * caml_names_of_builtin_cprim[] = {\n";
-diff --git a/bytecomp/symtable.mli b/bytecomp/symtable.mli
-index b4268f4..22dfebc 100644
---- a/bytecomp/symtable.mli
-+++ b/bytecomp/symtable.mli
-@@ -24,7 +24,7 @@ val require_primitive: string -> unit
- val initial_global_table: unit -> Obj.t array
- val output_global_map: out_channel -> unit
- val output_primitive_names: out_channel -> unit
--val output_primitive_table: out_channel -> unit
-+val output_primitive_table: out_channel -> string list -> unit
- val data_global_map: unit -> Obj.t
- val data_primitive_names: unit -> string
-
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Tue, 24 May 2011 12:16:20 +0200
-Subject: Properly initialize executable name in caml_startup_code
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5279
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627756
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- byterun/startup.c | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/byterun/startup.c b/byterun/startup.c
-index 5f35e87..6d7d2a6 100644
---- a/byterun/startup.c
-+++ b/byterun/startup.c
-@@ -443,6 +443,10 @@ CAMLexport void caml_startup_code(
- {
- value res;
- char* cds_file;
-+ char * exe_name;
-+#ifdef __linux__
-+ static char proc_self_exe[256];
-+#endif
-
- caml_init_ieee_floats();
- caml_init_custom_operations();
-@@ -455,6 +459,11 @@ CAMLexport void caml_startup_code(
- strcpy(caml_cds_file, cds_file);
- }
- parse_camlrunparam();
-+ exe_name = argv[0];
-+#ifdef __linux__
-+ if (caml_executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0)
-+ exe_name = proc_self_exe;
-+#endif
- caml_external_raise = NULL;
- /* Initialize the abstract machine */
- caml_init_gc (minor_heap_init, heap_size_init, heap_chunk_init,
-@@ -489,7 +498,7 @@ CAMLexport void caml_startup_code(
- caml_section_table_size = section_table_size;
- /* Initialize system libraries */
- caml_init_exceptions();
-- caml_sys_init("", argv);
-+ caml_sys_init(exe_name, argv);
- /* Execute the program */
- caml_debugger(PROGRAM_START);
- res = caml_interprete(caml_start_code, caml_code_size);
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Tue, 19 Jun 2012 09:57:08 +0200
-Subject: Embed bytecode in C object when using -custom
-
-This patch fixes non-strippability of bytecode executables linked with
-custom runtime. Having "c" in OCAML_COMPAT environment variable
-restores the original behaviour.
-
-Forwarded: not-needed
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627761
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- bytecomp/bytelink.ml | 36 ++++++++++++++++++++++++++++++----
- testsuite/tests/embedded/Makefile | 3 +++
- testsuite/tests/lib-marshal/Makefile | 3 +++
- 3 files changed, 38 insertions(+), 4 deletions(-)
-
-diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
-index bb14de6..ec02825 100644
---- a/bytecomp/bytelink.ml
-+++ b/bytecomp/bytelink.ml
-@@ -423,7 +423,7 @@ let mlvalues_primitives = [
-
- (* Output a bytecode executable as a C file *)
-
--let link_bytecode_as_c ppf tolink outfile =
-+let link_bytecode_as_c ppf tolink outfile with_main =
- let outchan = open_out outfile in
- begin try
- (* The bytecode *)
-@@ -465,14 +465,27 @@ let link_bytecode_as_c ppf tolink outfile =
- (* The table of primitives *)
- Symtable.output_primitive_table outchan mlvalues_primitives;
- (* The entry point *)
-- output_string outchan "\
-+ if with_main then begin
-+ output_string outchan "\
-+\nint main(int argc, char **argv)\
-+\n{\
-+\n caml_startup_code(caml_code, sizeof(caml_code),\
-+\n caml_data, sizeof(caml_data),\
-+\n caml_sections, sizeof(caml_sections),\
-+\n argv);\
-+\n return 0; /* not reached */\
-+\n}\n"
-+ end else begin
-+ output_string outchan "\
- \nvoid caml_startup(char ** argv)\
- \n{\
- \n caml_startup_code(caml_code, sizeof(caml_code),\
- \n caml_data, sizeof(caml_data),\
- \n caml_sections, sizeof(caml_sections),\
- \n argv);\
--\n}\
-+\n}\n"
-+ end;
-+ output_string outchan "\
- \n#ifdef __cplusplus\
- \n}\
- \n#endif\n";
-@@ -511,6 +524,11 @@ let fix_exec_name name =
- if String.contains name '.' then name else name ^ ".exe"
- | _ -> name
-
-+(* Legacy custom behaviour (Debian-specific) *)
-+
-+let legacy_custom =
-+ try String.contains (Sys.getenv "OCAML_COMPAT") 'c' with Not_found -> false
-+
- (* Main entry point (build a custom runtime if needed) *)
-
- let link ppf objfiles output_name =
-@@ -524,6 +542,16 @@ let link ppf objfiles output_name =
- Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *)
- if not !Clflags.custom_runtime then
- link_bytecode ppf tolink output_name true
-+ else if not legacy_custom && not !Clflags.output_c_object && not !Clflags.make_runtime then
-+ let c_file = Filename.temp_file "camlobj" ".c" in
-+ try
-+ link_bytecode_as_c ppf tolink c_file true;
-+ let exec_name = fix_exec_name output_name in
-+ if not (build_custom_runtime c_file exec_name)
-+ then raise(Error Custom_runtime);
-+ with x ->
-+ remove_file c_file;
-+ raise x
- else if not !Clflags.output_c_object then begin
- let bytecode_name = Filename.temp_file "camlcode" "" in
- let prim_name = Filename.temp_file "camlprim" ".c" in
-@@ -566,7 +594,7 @@ let link ppf objfiles output_name =
- if Sys.file_exists c_file then raise(Error(File_exists c_file));
- let temps = ref [] in
- try
-- link_bytecode_as_c ppf tolink c_file;
-+ link_bytecode_as_c ppf tolink c_file false;
- if not (Filename.check_suffix output_name ".c") then begin
- temps := c_file :: !temps;
- if Ccomp.compile_file c_file <> 0 then raise(Error Custom_runtime);
-diff --git a/testsuite/tests/embedded/Makefile b/testsuite/tests/embedded/Makefile
-index ed33143..0d1e4ca 100644
---- a/testsuite/tests/embedded/Makefile
-+++ b/testsuite/tests/embedded/Makefile
-@@ -1,5 +1,8 @@
- BASEDIR=../..
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_COMPAT=c
-+
- default: compile run
-
- compile:
-diff --git a/testsuite/tests/lib-marshal/Makefile b/testsuite/tests/lib-marshal/Makefile
-index 1f78273..4878507 100644
---- a/testsuite/tests/lib-marshal/Makefile
-+++ b/testsuite/tests/lib-marshal/Makefile
-@@ -3,5 +3,8 @@ BASEDIR=../..
- MAIN_MODULE=intext
- C_FILES=intextaux
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_COMPAT=c
-+
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
---
+++ /dev/null
-From: Pino Toscano <pino@debian.org>
-Date: Tue, 27 Mar 2012 11:41:02 +0200
-Subject: Fix symbol mangling in asmcomp tests on *-i386 and sparc
-
-Based on a patch by Pino Toscano <pino@debian.org>.
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5661
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=661716
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- testsuite/tests/asmcomp/i386.S | 3 ++-
- testsuite/tests/asmcomp/sparc.S | 2 +-
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/testsuite/tests/asmcomp/i386.S b/testsuite/tests/asmcomp/i386.S
-index fdda4de..c2510c8 100644
---- a/testsuite/tests/asmcomp/i386.S
-+++ b/testsuite/tests/asmcomp/i386.S
-@@ -15,7 +15,8 @@
- /* Linux with ELF binaries does not prefix identifiers with _.
- Linux with a.out binaries, FreeBSD, and NextStep do. */
-
--#ifdef SYS_linux_elf
-+#if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \
-+ || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_gnu)
- #define G(x) x
- #define FUNCTION_ALIGN 16
- #else
-diff --git a/testsuite/tests/asmcomp/sparc.S b/testsuite/tests/asmcomp/sparc.S
-index 7d17548..aeacaaf 100644
---- a/testsuite/tests/asmcomp/sparc.S
-+++ b/testsuite/tests/asmcomp/sparc.S
-@@ -12,7 +12,7 @@
-
- /* $Id: sparc.S 11156 2011-07-27 14:17:02Z doligez $ */
-
--#ifndef SYS_solaris
-+#if defined(SYS_solaris) || defined(SYS_elf)
- #define Call_gen_code _call_gen_code
- #define Caml_c_call _caml_c_call
- #else
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Wed, 20 Jun 2012 13:50:25 +0200
-Subject: Fix testsuite on bytecode architectures
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5661
-
----
- testsuite/makefiles/Makefile.one | 3 ++-
- testsuite/tests/lib-scanf-2/Makefile | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/testsuite/makefiles/Makefile.one b/testsuite/makefiles/Makefile.one
-index 7b25216..edb6ead 100644
---- a/testsuite/makefiles/Makefile.one
-+++ b/testsuite/makefiles/Makefile.one
-@@ -20,7 +20,7 @@ ADD_CFLAGS+=$(CUSTOM_FLAG)
-
- default: compile run
-
--compile: $(ML_FILES) $(CMO_FILES) $(CMX_FILES) $(MAIN_MODULE).cmo $(MAIN_MODULE).cmx
-+compile: $(ML_FILES) $(CMO_FILES) $(MAIN_MODULE).cmo
- @for file in $(C_FILES); do \
- $(NATIVECC) $(NATIVECCCOMPOPTS) -c -I$(TOPDIR)/byterun $$file.c; \
- done;
-@@ -28,6 +28,7 @@ compile: $(ML_FILES) $(CMO_FILES) $(CMX_FILES) $(MAIN_MODULE).cmo $(MAIN_MODULE)
- @$(OCAMLC) $(ADD_COMPFLAGS) $(ADD_CFLAGS) -o program.byte $(O_FILES) $(CMA_FILES) $(CMO_FILES) $(ADD_CMO_FILES) $(MAIN_MODULE).cmo
- @if [ -z "$(BYTECODE_ONLY)" ]; then \
- rm -f program.native program.native.exe; \
-+ $(MAKE) $(CMX_FILES) $(MAIN_MODULE).cmx; \
- $(OCAMLOPT) $(ADD_COMPFLAGS) -o program.native $(O_FILES) $(CMXA_FILES) $(CMX_FILES) $(ADD_CMX_FILES) $(MAIN_MODULE).cmx; \
- fi
-
-diff --git a/testsuite/tests/lib-scanf-2/Makefile b/testsuite/tests/lib-scanf-2/Makefile
-index 216b396..7362fad 100644
---- a/testsuite/tests/lib-scanf-2/Makefile
-+++ b/testsuite/tests/lib-scanf-2/Makefile
-@@ -2,10 +2,11 @@ BASEDIR=../..
-
- default: compile run
-
--compile: tscanf2_io.cmo tscanf2_io.cmx
-+compile: tscanf2_io.cmo
- @$(OCAMLC) unix.cma tscanf2_io.cmo -o master.byte tscanf2_master.ml
- @$(OCAMLC) tscanf2_io.cmo -o slave.byte tscanf2_slave.ml
- @if [ -z "$(BYTECODE_ONLY)" ]; then \
-+ $(MAKE) tscanf2_io.cmx; \
- $(OCAMLOPT) unix.cmxa tscanf2_io.cmx -o master.native tscanf2_master.ml; \
- $(OCAMLOPT) tscanf2_io.cmx -o slave.native tscanf2_slave.ml; \
- fi
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Wed, 20 Jun 2012 21:58:35 +0200
-Subject: ocamlopt fix on powerpc
-
-Origin: http://caml.inria.fr/cgi-bin/viewvc.cgi?view=revision&revision=12583
----
- asmcomp/power/arch.ml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/asmcomp/power/arch.ml b/asmcomp/power/arch.ml
-index 696073e..239390c 100644
---- a/asmcomp/power/arch.ml
-+++ b/asmcomp/power/arch.ml
-@@ -48,7 +48,7 @@ let size_float = 8
-
- (* Behavior of division *)
-
--let division_crashes_on_overflow = false
-+let division_crashes_on_overflow = true
-
- (* Operations on addressing modes *)
-
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Wed, 20 Jun 2012 22:00:46 +0200
-Subject: Move power.o rule in asmcomp test after definition of $(SYSTEM)
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5661
-
----
- testsuite/tests/asmcomp/Makefile | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/testsuite/tests/asmcomp/Makefile b/testsuite/tests/asmcomp/Makefile
-index fb1af49..c4d1aa0 100644
---- a/testsuite/tests/asmcomp/Makefile
-+++ b/testsuite/tests/asmcomp/Makefile
-@@ -141,11 +141,11 @@ clean: defaultclean
- @rm -f parsecmm.ml parsecmm.mli lexcmm.ml
- @rm -f $(CASES:=.s)
-
--power.o: power-$(SYSTEM).o
-- @cp power-$(SYSTEM).o power.o
--
- promote:
-
- include $(BASEDIR)/makefiles/Makefile.common
-
-+power.o: power-$(SYSTEM).o
-+ @cp power-$(SYSTEM).o power.o
-+
- arch: $(ARCH).o
---
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Sat, 21 Jul 2012 13:42:31 +0200
-Subject: Fix i18n bug in thread tests
-
-Suggested by Damien Doligez.
-
-Bug: http://caml.inria.fr/mantis/view.php?id=5648
----
- testsuite/tests/lib-threads/test1.checker | 2 +-
- testsuite/tests/lib-threads/test4.checker | 2 +-
- testsuite/tests/lib-threads/test5.checker | 2 +-
- testsuite/tests/lib-threads/test6.checker | 2 +-
- testsuite/tests/lib-threads/testA.checker | 2 +-
- testsuite/tests/lib-threads/testexit.checker | 2 +-
- 6 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/testsuite/tests/lib-threads/test1.checker b/testsuite/tests/lib-threads/test1.checker
-index cbfe7ce..1d10457 100644
---- a/testsuite/tests/lib-threads/test1.checker
-+++ b/testsuite/tests/lib-threads/test1.checker
-@@ -1 +1 @@
--sort test1.result | diff -q test1.reference -
-+LC_ALL=C sort test1.result | diff -q test1.reference -
-diff --git a/testsuite/tests/lib-threads/test4.checker b/testsuite/tests/lib-threads/test4.checker
-index ae27a0d..b8661a9 100644
---- a/testsuite/tests/lib-threads/test4.checker
-+++ b/testsuite/tests/lib-threads/test4.checker
-@@ -1 +1 @@
--sort -u test4.result | diff -q test4.reference -
-+LC_ALL=C sort -u test4.result | diff -q test4.reference -
-diff --git a/testsuite/tests/lib-threads/test5.checker b/testsuite/tests/lib-threads/test5.checker
-index 030fcc9..e991875 100644
---- a/testsuite/tests/lib-threads/test5.checker
-+++ b/testsuite/tests/lib-threads/test5.checker
-@@ -1 +1 @@
--sort -u test5.result | diff -q test5.reference -
-+LC_ALL=C sort -u test5.result | diff -q test5.reference -
-diff --git a/testsuite/tests/lib-threads/test6.checker b/testsuite/tests/lib-threads/test6.checker
-index 40ab24f..d2e9930 100644
---- a/testsuite/tests/lib-threads/test6.checker
-+++ b/testsuite/tests/lib-threads/test6.checker
-@@ -1 +1 @@
--sort -u test6.result | diff -q test6.reference -
-+LC_ALL=C sort -u test6.result | diff -q test6.reference -
-diff --git a/testsuite/tests/lib-threads/testA.checker b/testsuite/tests/lib-threads/testA.checker
-index 4c30940..9f5d00a 100644
---- a/testsuite/tests/lib-threads/testA.checker
-+++ b/testsuite/tests/lib-threads/testA.checker
-@@ -1 +1 @@
--sort testA.result | diff -q testA.reference -
-+LC_ALL=C sort testA.result | diff -q testA.reference -
-diff --git a/testsuite/tests/lib-threads/testexit.checker b/testsuite/tests/lib-threads/testexit.checker
-index 5834e5d..c1182d6 100644
---- a/testsuite/tests/lib-threads/testexit.checker
-+++ b/testsuite/tests/lib-threads/testexit.checker
-@@ -1 +1 @@
--sort testexit.result | diff -q testexit.reference -
-+LC_ALL=C sort testexit.result | diff -q testexit.reference -
---
0004-Put-manpages-in-section-3o-instead-of-3.patch
0005-Patch-config.sh-for-installation.patch
0006-Install-ocamlbuild-as-a-link-on-either-.native-or-.b.patch
-0007-Natdynlink-works-on-powerpc-hurd-i386-and-sparc.patch
-0008-Declare-primitive-name-table-as-const-char.patch
-0009-Avoid-multiple-declarations-in-generated-.c-files-in.patch
-0010-Properly-initialize-executable-name-in-caml_startup_.patch
-0011-Embed-bytecode-in-C-object-when-using-custom.patch
-0012-Fix-symbol-mangling-in-asmcomp-tests-on-i386-and-spa.patch
-0013-Fix-testsuite-on-bytecode-architectures.patch
-0014-ocamlopt-fix-on-powerpc.patch
-0015-Move-power.o-rule-in-asmcomp-test-after-definition-o.patch
-0016-Fix-i18n-bug-in-thread-tests.patch
+0007-Avoid-multiple-declarations-in-generated-.c-files-in.patch
+0008-Embed-bytecode-in-C-object-when-using-custom.patch