+++ /dev/null
-From: Stefano Zacchiroli <zack@debian.org>
-Date: Tue, 19 May 2009 17:22:39 +0200
-Subject: Pass --no-relax to ld on alpha
-
-Pass the --no-relax option to ld to fix a segfault in initialization
-code (bug#338437)
----
- configure | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/configure b/configure
-index e796599..d67672e 100755
---- a/configure
-+++ b/configure
-@@ -448,7 +448,8 @@ case "$bytecc,$target" in
- *gcc*,alpha*-*-linux*)
- if cc="$bytecc" sh ./hasgot -mieee; then
- bytecccompopts="-mieee $bytecccompopts";
-- fi;;
-+ fi
-+ bytecclinkopts="-Wl,--no-relax";;
- *,mips-*-irix6*)
- # Turn off warning "unused library"
- bytecclinkopts="-n32 -Wl,-woff,84";;
-@@ -982,6 +983,7 @@ nativeccrpath="$byteccrpath"
- case "$arch,$nativecc,$system,$model" in
- *,*,nextstep,*) nativecclinkopts="-posix";;
- *,*,rhapsody,*) if $arch64; then partialld="ld -r -arch ppc64"; fi;;
-+ alpha,gcc*,linux*,*) nativecclinkopts="-Wl,--no-relax";;
- amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
- amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
- power,gcc*,elf,ppc) partialld="ld -r -m elf32ppclinux";;
+++ /dev/null
-From: Stefano Zacchiroli <zack@debian.org>
-Date: Tue, 19 May 2009 17:23:34 +0200
-Subject: Call ld with proper flags
-
-Filter linkflags passed to ld by ocamlopt -pack and -output-obj
-to remove the "-Wl," parts, which are only used when ocamlopt calls
-gcc.
----
- configure | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure b/configure
-index d67672e..c0024a9 100755
---- a/configure
-+++ b/configure
-@@ -2049,7 +2049,7 @@ echo "DYNLINKOPTS=$dllib" >> Makefile
- echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
- echo "CC_PROFILE=$cc_profile" >> Makefile
- echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
--echo "PACKLD=$partialld $nativecclinkopts -o\\ " >> Makefile
-+echo "PACKLD=$partialld $(echo $nativecclinkopts|sed s/-Wl,//g) -o\\ " >> Makefile
- echo "IFLEXDIR=$iflexdir" >> Makefile
- echo "O=o" >> Makefile
- echo "A=a" >> Makefile
1 file changed, 5 insertions(+)
diff --git a/tools/ocamlmklib.ml b/tools/ocamlmklib.ml
-index e5dda65..cb9daca 100644
+index b5c0aee..b4e45d1 100644
--- a/tools/ocamlmklib.ml
+++ b/tools/ocamlmklib.ml
-@@ -43,6 +43,11 @@ and rpath = ref [] (* rpath options *)
+@@ -58,6 +58,11 @@ and rpath = ref [] (* rpath options *)
and debug = ref false (* -g option *)
and verbose = ref false
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
-index f69b874..374d063 100644
+index f8b8cf6..d2cdcab 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
-@@ -387,7 +387,7 @@ test_texi:
- stdlib_man/Pervasives.3o: $(OCAMLDOC) $(STDLIB_MLIS)
- $(MKDIR) stdlib_man
- $(OCAMLDOC_RUN) -man -d stdlib_man $(INCLUDES) \
-- -t "OCaml library" -man-mini $(STDLIB_MLIS)
-+ -t "OCaml library" -man-mini -man-section 3o $(STDLIB_MLIS)
+@@ -407,7 +407,7 @@ stdlib_man/Stdlib.3o: $(OCAMLDOC) $(DOC_ALL)
+ $(OCAMLDOC_RUN) -man -d stdlib_man -nostdlib \
+ -hide Stdlib -lib Stdlib $(DOC_ALL_INCLUDES) \
+ -pp "$(AWK) -v ocamldoc=true -f $(SRC)/stdlib/expand_module_aliases.awk" \
+- -t "OCaml library" -man-mini \
++ -t "OCaml library" -man-mini -man-section 3o \
+ $(DOC_ALL_TEXT:%=-text %) \
+ $(DOC_ALL_MLIS)
- stdlib_html/Pervasives.html: $(STDLIB_MLIS)
- $(MKDIR) stdlib_html
+++ /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 | 18 ++++++++++++++++--
- bytecomp/symtable.ml | 8 +++++---
- bytecomp/symtable.mli | 2 +-
- 3 files changed, 22 insertions(+), 6 deletions(-)
-
-diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
-index 8f82fc9..40a3351 100644
---- a/bytecomp/bytelink.ml
-+++ b/bytecomp/bytelink.ml
-@@ -449,6 +449,20 @@ 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";
-+ "caml_set_oo_id";
-+]
-+
- (* Output a bytecode executable as a C file *)
-
- let link_bytecode_as_c ppf tolink outfile =
-@@ -491,7 +505,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)\
-@@ -587,7 +601,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 d2936f4..d81ed51 100644
---- a/bytecomp/symtable.ml
-+++ b/bytecomp/symtable.ml
-@@ -112,15 +112,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 22dec58..a621ebe 100644
---- a/bytecomp/symtable.mli
-+++ b/bytecomp/symtable.mli
-@@ -26,7 +26,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
- val transl_const: Lambda.structured_constant -> Obj.t
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Tue, 11 Jul 2017 13:27:34 +0200
-Subject: Embed bytecode in C object when using -custom
-
-This patch fixes non-strippability of bytecode executables linked with
-custom runtime. The new behaviour is enabled when OCAML_CUSTOM_EMBED
-is set to "y", or when DEB_HOST_ARCH is non-empty.
-
-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
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678577
-Signed-off-by: Stephane Glondu <steph@glondu.net>
----
- bytecomp/bytelink.ml | 42 ++++++++++++++++++++++++---
- testsuite/tests/basic-manyargs/Makefile | 3 ++
- testsuite/tests/callback/Makefile | 3 ++
- testsuite/tests/embedded/Makefile | 4 +++
- testsuite/tests/gc-roots/Makefile | 3 ++
- testsuite/tests/lib-dynlink-bytecode/Makefile | 3 ++
- testsuite/tests/lib-marshal/Makefile | 3 ++
- testsuite/tests/regression/pr3612/Makefile | 3 ++
- testsuite/tests/runtime-C-exceptions/Makefile | 3 ++
- 9 files changed, 63 insertions(+), 4 deletions(-)
-
-diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
-index 40a3351..ae887c3 100644
---- a/bytecomp/bytelink.ml
-+++ b/bytecomp/bytelink.ml
-@@ -465,7 +465,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 *)
-@@ -507,7 +507,18 @@ 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),\
-@@ -521,7 +532,9 @@ let link_bytecode_as_c ppf tolink outfile =
- \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";
-@@ -560,6 +573,17 @@ let fix_exec_name name =
- if String.contains name '.' then name else name ^ ".exe"
- | _ -> name
-
-+(* Debian-specific -custom behaviour:
-+ - if DEB_HOST_ARCH is non-empty, it is activated by default
-+ - can be enabled/disabled by setting OCAML_CUSTOM_EMBED to y/n
-+*)
-+
-+let custom_embed =
-+ try Sys.getenv "OCAML_CUSTOM_EMBED" = "y"
-+ with Not_found ->
-+ try Sys.getenv "DEB_HOST_ARCH" <> ""
-+ with Not_found -> false
-+
- (* Main entry point (build a custom runtime if needed) *)
-
- let link ppf objfiles output_name =
-@@ -582,6 +606,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 custom_embed && 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
-@@ -631,7 +665,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
-diff --git a/testsuite/tests/basic-manyargs/Makefile b/testsuite/tests/basic-manyargs/Makefile
-index b387d6e..e75ba7d 100644
---- a/testsuite/tests/basic-manyargs/Makefile
-+++ b/testsuite/tests/basic-manyargs/Makefile
-@@ -18,5 +18,8 @@ BASEDIR=../..
- MAIN_MODULE=manyargs
- C_FILES=manyargsprim
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
-diff --git a/testsuite/tests/callback/Makefile b/testsuite/tests/callback/Makefile
-index d6615a1..8e1b4cb 100644
---- a/testsuite/tests/callback/Makefile
-+++ b/testsuite/tests/callback/Makefile
-@@ -19,6 +19,9 @@ CC=$(NATIVECC) -I $(CTOPDIR)/byterun
- COMPFLAGS=-I $(OTOPDIR)/otherlibs/unix
- LD_PATH=$(TOPDIR)/otherlibs/unix
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- .PHONY: default
- default:
- @case " $(OTHERLIBRARIES) " in \
-diff --git a/testsuite/tests/embedded/Makefile b/testsuite/tests/embedded/Makefile
-index 679c5b9..4d38cd8 100644
---- a/testsuite/tests/embedded/Makefile
-+++ b/testsuite/tests/embedded/Makefile
-@@ -16,6 +16,10 @@
- BASEDIR=../..
-
- .PHONY: default
-+
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- default:
- @$(MAKE) compile
- @$(MAKE) run
-diff --git a/testsuite/tests/gc-roots/Makefile b/testsuite/tests/gc-roots/Makefile
-index c8e24cc..7057e12 100644
---- a/testsuite/tests/gc-roots/Makefile
-+++ b/testsuite/tests/gc-roots/Makefile
-@@ -19,5 +19,8 @@ MAIN_MODULE=globroots
- C_FILES=globrootsprim
- ADD_COMPFLAGS=-w a
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
-diff --git a/testsuite/tests/lib-dynlink-bytecode/Makefile b/testsuite/tests/lib-dynlink-bytecode/Makefile
-index 1e56b16..62a0034 100644
---- a/testsuite/tests/lib-dynlink-bytecode/Makefile
-+++ b/testsuite/tests/lib-dynlink-bytecode/Makefile
-@@ -18,6 +18,9 @@ BASEDIR=../..
- COMPFLAGS=-I $(OTOPDIR)/otherlibs/dynlink
- LD_PATH=.:$(TOPDIR)/otherlibs/dynlink
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- .PHONY: default
- default:
- @if ! $(SUPPORTS_SHARED_LIBRARIES); then \
-diff --git a/testsuite/tests/lib-marshal/Makefile b/testsuite/tests/lib-marshal/Makefile
-index a79f6bd..d30d409 100644
---- a/testsuite/tests/lib-marshal/Makefile
-+++ b/testsuite/tests/lib-marshal/Makefile
-@@ -18,5 +18,8 @@ BASEDIR=../..
- MAIN_MODULE=intext
- C_FILES=intextaux
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
-diff --git a/testsuite/tests/regression/pr3612/Makefile b/testsuite/tests/regression/pr3612/Makefile
-index 866927b..6d0b361 100644
---- a/testsuite/tests/regression/pr3612/Makefile
-+++ b/testsuite/tests/regression/pr3612/Makefile
-@@ -16,6 +16,9 @@
- MAIN_MODULE=pr3612
- C_FILES=custom_finalize
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- BASEDIR=../../..
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
-diff --git a/testsuite/tests/runtime-C-exceptions/Makefile b/testsuite/tests/runtime-C-exceptions/Makefile
-index da534b7..e9598df 100644
---- a/testsuite/tests/runtime-C-exceptions/Makefile
-+++ b/testsuite/tests/runtime-C-exceptions/Makefile
-@@ -3,5 +3,8 @@ BASEDIR=../..
- MAIN_MODULE=test
- C_FILES=stub_test
-
-+# This test relies on the upstream behaviour of -custom
-+export OCAML_CUSTOM_EMBED=n
-+
- include $(BASEDIR)/makefiles/Makefile.one
- include $(BASEDIR)/makefiles/Makefile.common
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Wed, 13 Nov 2013 14:28:16 +0100
-Subject: Native backtraces don't work on powerpc and sparc
-
----
- testsuite/tests/backtrace/Makefile | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/testsuite/tests/backtrace/Makefile b/testsuite/tests/backtrace/Makefile
-index 5df19fc..9ad93c3 100644
---- a/testsuite/tests/backtrace/Makefile
-+++ b/testsuite/tests/backtrace/Makefile
-@@ -29,7 +29,10 @@ LOCATIONFILTER=grep -oE \
-
- default:
- @$(MAKE) byte
-- @if $(BYTECODE_ONLY); then $(MAKE) skip ; else $(MAKE) native; fi
-+ @case `dpkg-architecture -qDEB_BUILD_ARCH` in \
-+ sparc|powerpc*) : ;; \
-+ *) if $(BYTECODE_ONLY); then $(MAKE) skip ; else $(MAKE) native; fi ;; \
-+ esac
-
- .PHONY: byte
- byte:
+++ /dev/null
-From: Xavier Leroy <xavier.leroy@inria.fr>
-Date: Fri, 25 Jan 2019 13:47:44 +0100
-Subject: Drop a test-suite experiment committed by mistake
-
-This was failing on armhf because Debian GCC now enables PIE by default.
-
-Bug: https://caml.inria.fr/mantis/view.php?id=7642
-Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837359#80
----
- testsuite/tests/asmcomp/main.ml | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/testsuite/tests/asmcomp/main.ml b/testsuite/tests/asmcomp/main.ml
-index 284f7fb..6457ad2 100644
---- a/testsuite/tests/asmcomp/main.ml
-+++ b/testsuite/tests/asmcomp/main.ml
-@@ -6,7 +6,6 @@ let compile_file filename =
- let out_name = Filename.chop_extension filename ^ ".s" in
- Emitaux.output_channel := open_out out_name
- end; (* otherwise, stdout *)
-- Clflags.dlcode := false;
- Compilenv.reset ~source_provenance:(Timings.File filename) "test";
- Emit.begin_assembly();
- let ic = open_in filename in
+++ /dev/null
-From: Mark Shinwell <mshinwell@gmail.com>
-Date: Wed, 13 Sep 2017 10:23:16 +0100
-Subject: arm64-hide-symbols-for-stricter-binutils
-
- AArch64 GOT fixed
----
- Changes | 4 ++++
- asmcomp/arm64/emit.mlp | 15 +++++++++++++--
- asmcomp/arm64/selection.ml | 4 ++--
- 3 files changed, 19 insertions(+), 4 deletions(-)
-
-diff --git a/Changes b/Changes
-index cc59f63..4c0eac7 100644
---- a/Changes
-+++ b/Changes
-@@ -135,6 +135,10 @@ OCaml 4.05.0 (13 Jul 2017):
- (Hannes Mehnert, Guillaume Bury,
- review by Daniel Bünzli, Gabriel Scherer, Damien Doligez)
-
-+- GPR#1330: when generating dynamically-linkable code on AArch64, always
-+ reference symbols (even locally-defined ones) through the GOT.
-+ (Mark Shinwell, review by Xavier Leroy)
-+
- ### Standard library:
-
- - MPR#6975, GPR#902: Truncate function added to stdlib Buffer module
-diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
-index f75646e..729096c 100644
---- a/asmcomp/arm64/emit.mlp
-+++ b/asmcomp/arm64/emit.mlp
-@@ -114,6 +114,7 @@ let emit_addressing addr r =
- | Iindexed ofs ->
- `[{emit_reg r}, #{emit_int ofs}]`
- | Ibased(s, ofs) ->
-+ assert (not !Clflags.dlcode); (* see selection.ml *)
- `[{emit_reg r}, #:lo12:{emit_symbol_offset s ofs}]`
-
- (* Record live pointers at call points *)
-@@ -323,7 +324,7 @@ let emit_literals() =
- (* Emit code to load the address of a symbol *)
-
- let emit_load_symbol_addr dst s =
-- if (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit s then begin
-+ if not !Clflags.dlcode then begin
- ` adrp {emit_reg dst}, {emit_symbol s}\n`;
- ` add {emit_reg dst}, {emit_reg dst}, #:lo12:{emit_symbol s}\n`
- end else begin
-@@ -609,6 +610,7 @@ let emit_instr i =
- match addr with
- | Iindexed _ -> i.arg.(0)
- | Ibased(s, ofs) ->
-+ assert (not !Clflags.dlcode); (* see selection.ml *)
- ` adrp {emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
- reg_tmp1 in
- begin match size with
-@@ -636,6 +638,7 @@ let emit_instr i =
- match addr with
- | Iindexed _ -> i.arg.(1)
- | Ibased(s, ofs) ->
-+ assert (not !Clflags.dlcode);
- ` adrp {emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
- reg_tmp1 in
- begin match size with
-@@ -924,7 +927,15 @@ let fundecl fundecl =
-
- let emit_item = function
- | Cglobal_symbol s -> ` .globl {emit_symbol s}\n`;
-- | Cdefine_symbol s -> `{emit_symbol s}:\n`
-+ | Cdefine_symbol s ->
-+ if !Clflags.dlcode then begin
-+ (* GOT relocations against non-global symbols don't seem to work
-+ properly: GOT entries are not created for the symbols and the
-+ relocations evaluate to random other GOT entries. For the moment
-+ force all symbols to be global. *)
-+ ` .globl {emit_symbol s}\n`;
-+ end;
-+ `{emit_symbol s}:\n`
- | Cint8 n -> ` .byte {emit_int n}\n`
- | Cint16 n -> ` .short {emit_int n}\n`
- | Cint32 n -> ` .long {emit_nativeint n}\n`
-diff --git a/asmcomp/arm64/selection.ml b/asmcomp/arm64/selection.ml
-index d8ea7f8..b714d00 100644
---- a/asmcomp/arm64/selection.ml
-+++ b/asmcomp/arm64/selection.ml
-@@ -82,8 +82,8 @@ let inline_ops =
- [ "sqrt"; "caml_bswap16_direct"; "caml_int32_direct_bswap";
- "caml_int64_direct_bswap"; "caml_nativeint_direct_bswap" ]
-
--let use_direct_addressing symb =
-- (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit symb
-+let use_direct_addressing _symb =
-+ not !Clflags.dlcode
-
- (* Instruction selection *)
-
+++ /dev/null
-From: Stephane Glondu <steph@glondu.net>
-Date: Fri, 25 Jan 2019 14:34:23 +0100
-Subject: Integer overflows when unmarshaling a bigarray
-
-Malicious or corrupted marshaled data can result in a bigarray
-with impossibly large dimensions that cause overflow when computing
-the in-memory size of the bigarray. Disaster ensues when the data
-is read in a too small memory area. This commit checks for overflows
-when computing the in-memory size of the bigarray.
-
-This patch has been modified from upstream one to use caml_ba_multov
-instead of caml_umul_overflow which is unavailable in OCaml 4.05.0.
-
-Origin: https://github.com/ocaml/ocaml/pull/1718
-Bug: https://caml.inria.fr/mantis/view.php?id=7765
-Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895472
-Bug-CVE: CVE-2018-9838
----
- otherlibs/bigarray/bigarray_stubs.c | 26 +++++++++++++++++++-------
- 1 file changed, 19 insertions(+), 7 deletions(-)
-
-diff --git a/otherlibs/bigarray/bigarray_stubs.c b/otherlibs/bigarray/bigarray_stubs.c
-index cb38bef..995739d 100644
---- a/otherlibs/bigarray/bigarray_stubs.c
-+++ b/otherlibs/bigarray/bigarray_stubs.c
-@@ -966,22 +966,34 @@ static void caml_ba_deserialize_longarray(void * dest, intnat num_elts)
- uintnat caml_ba_deserialize(void * dst)
- {
- struct caml_ba_array * b = dst;
-- int i, elt_size;
-- uintnat num_elts;
-+ int i;
-+ uintnat num_elts, size;
-+ int overflow;
-
- /* Read back header information */
- b->num_dims = caml_deserialize_uint_4();
-+ if (b->num_dims < 0 || b->num_dims > CAML_BA_MAX_NUM_DIMS)
-+ caml_deserialize_error("input_value: wrong number of bigarray dimensions");
- b->flags = caml_deserialize_uint_4() | CAML_BA_MANAGED;
- b->proxy = NULL;
- for (i = 0; i < b->num_dims; i++) b->dim[i] = caml_deserialize_uint_4();
-- /* Compute total number of elements */
-- num_elts = caml_ba_num_elts(b);
-- /* Determine element size in bytes */
-+ /* Compute total number of elements. Watch out for overflows (MPR#7765). */
-+ num_elts = 1;
-+ for (i = 0; i < b->num_dims; i++) {
-+ overflow = 0;
-+ num_elts = caml_ba_multov(num_elts, b->dim[i], &overflow);
-+ if (overflow)
-+ caml_deserialize_error("input_value: size overflow for bigarray");
-+ }
-+ /* Determine array size in bytes. Watch out for overflows (MPR#7765). */
- if ((b->flags & CAML_BA_KIND_MASK) > CAML_BA_CHAR)
- caml_deserialize_error("input_value: bad bigarray kind");
-- elt_size = caml_ba_element_size[b->flags & CAML_BA_KIND_MASK];
-+ overflow = 0;
-+ size = caml_ba_multov(num_elts, caml_ba_element_size[b->flags & CAML_BA_KIND_MASK], &overflow);
-+ if (overflow)
-+ caml_deserialize_error("input_value: size overflow for bigarray");
- /* Allocate room for data */
-- b->data = malloc(elt_size * num_elts);
-+ b->data = malloc(size);
- if (b->data == NULL)
- caml_deserialize_error("input_value: out of memory for bigarray");
- /* Read data */
+++ /dev/null
-From: Torok Edwin <edwin@etorok.net>
-Date: Wed, 15 Jul 2015 16:33:23 +0300
-Subject: Use CCLINKFLAGS for linking all executables and shared libraries
-
-This allows packagers to set additional linker flags for executables and shared
-libraries created by OCaml, and for the OCaml tools themselves.
-OCaml code can be linked with various C stubs and C libraries that would
-benefit from using hardening link flags, such as -Wl,-z,relro.
-
-Origin: other
-Bug-Debian: https://bugs.debian.org/702349
-Forwarded: no
-Last-Update: <2015-07-15>
----
- configure | 2 ++
- tools/Makefile | 2 +-
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/configure b/configure
-index c0024a9..b8e0bcf 100755
---- a/configure
-+++ b/configure
-@@ -815,6 +815,8 @@ if test $with_sharedlibs = "yes"; then
- shared_libraries_supported=true;;
- esac
- fi
-+mksharedlib="$mksharedlib $CCLINKFLAGS"
-+mkexe="$mkexe $CCLINKFLAGS"
-
- if test -z "$mkmaindll"; then
- mkmaindll=$mksharedlib
-diff --git a/tools/Makefile b/tools/Makefile
-index 9a8cf65..2d19c65 100644
---- a/tools/Makefile
-+++ b/tools/Makefile
-@@ -316,7 +316,7 @@ endif
-
- objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
- $(BYTECC) $(CCOUT)objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
-- $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) objinfo_helper.c $(LIBBFD_LINK)
-+ $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) objinfo_helper.c $(LIBBFD_LINK) $(CCLINKFLAGS)
-
- OBJINFO=../compilerlibs/ocamlcommon.cma \
- ../compilerlibs/ocamlbytecomp.cma \
+++ /dev/null
-From: Johannes Schauer <josch@debian.org>
-Date: Thu, 22 Dec 2016 00:36:14 +0100
-Subject: Compute a stable name for preprocessed files
-
----
- driver/pparse.ml | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/driver/pparse.ml b/driver/pparse.ml
-index b00ded4..13d76bc 100644
---- a/driver/pparse.ml
-+++ b/driver/pparse.ml
-@@ -21,10 +21,19 @@ type error =
-
- exception Error of error
-
-+external open_desc: string -> open_flag list -> int -> int = "caml_sys_open"
-+external close_desc: int -> unit = "caml_sys_close"
-+
- (* Optionally preprocess a source file *)
-
- let call_external_preprocessor sourcefile pp =
-- let tmpfile = Filename.temp_file "ocamlpp" "" in
-+ (* do not use Filename.temp_file as the resulting temporary file name will be
-+ * recorded in the debug output of the resulting binary and thus make the
-+ * output random and unreproducible *)
-+ let temp_dir = Filename.get_temp_dir_name () in
-+ let hash = Digest.to_hex (Digest.string (sourcefile^pp)) in
-+ let tmpfile = Filename.concat temp_dir ("ocamlpp"^hash) in
-+ close_desc(open_desc tmpfile [Open_wronly; Open_creat; Open_excl] 0o600);
- let comm = Printf.sprintf "%s %s > %s"
- pp (Filename.quote sourcefile) tmpfile
- in
-0001-Pass-no-relax-to-ld-on-alpha.patch
-0002-Call-ld-with-proper-flags.patch
0003-Don-t-use-rpath.patch
0004-Put-manpages-in-section-3o-instead-of-3.patch
-0005-Avoid-multiple-declarations-in-generated-.c-files-in.patch
-0006-Embed-bytecode-in-C-object-when-using-custom.patch
-0008-Native-backtraces-don-t-work-on-powerpc-and-sparc.patch
-0010-XL-001-tests.asmcomp.patch
-0011-arm64-hide-symbols-for-stricter-binutils.patch
-0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch
-0014-Compute-a-stable-name-for-preprocessed-files.patch
-0012-Integer-overflows-when-unmarshaling-a-bigarray.patch