From ce44e9bd6a6da56f92012ada984970427f15347c Mon Sep 17 00:00:00 2001 From: Stephane Glondu Date: Thu, 3 Sep 2020 15:06:02 +0200 Subject: [PATCH] Refresh patches * Avoid-duplicate-definitions-of-common-global-variabl: merged upstream * Reimplement-custom-without-hacks: removed for now; it will be reimplemented with the new -output-complete-exe feature. --- debian/patches/0003-Don-t-use-rpath.patch | 2 +- ...-manpages-in-section-3o-instead-of-3.patch | 4 +- ...info-do-not-die-in-custom-executable.patch | 4 +- ...definitions-of-common-global-variabl.patch | 41 ---- ...le-DT_TEXTREL-warnings-on-Linux-i386.patch | 10 +- ...008-Reimplement-custom-without-hacks.patch | 230 ------------------ ...for-linking-all-executables-and-shar.patch | 20 +- debian/patches/series | 2 - 8 files changed, 20 insertions(+), 293 deletions(-) delete mode 100644 debian/patches/0007-Avoid-duplicate-definitions-of-common-global-variabl.patch delete mode 100644 debian/patches/0008-Reimplement-custom-without-hacks.patch diff --git a/debian/patches/0003-Don-t-use-rpath.patch b/debian/patches/0003-Don-t-use-rpath.patch index 1f547354..7bc167d5 100644 --- a/debian/patches/0003-Don-t-use-rpath.patch +++ b/debian/patches/0003-Don-t-use-rpath.patch @@ -7,7 +7,7 @@ Subject: Don't use rpath 1 file changed, 5 insertions(+) diff --git a/tools/ocamlmklib.ml b/tools/ocamlmklib.ml -index b5c0aee..b4e45d1 100644 +index d5bb84c..ab3ca2b 100644 --- a/tools/ocamlmklib.ml +++ b/tools/ocamlmklib.ml @@ -58,6 +58,11 @@ and rpath = ref [] (* rpath options *) diff --git a/debian/patches/0004-Put-manpages-in-section-3o-instead-of-3.patch b/debian/patches/0004-Put-manpages-in-section-3o-instead-of-3.patch index 6cc46b28..8588c8d6 100644 --- a/debian/patches/0004-Put-manpages-in-section-3o-instead-of-3.patch +++ b/debian/patches/0004-Put-manpages-in-section-3o-instead-of-3.patch @@ -7,10 +7,10 @@ Subject: Put manpages in section 3o instead of 3 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile -index f8b8cf6..d2cdcab 100644 +index 6b7093b..026d409 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile -@@ -407,7 +407,7 @@ stdlib_man/Stdlib.3o: $(OCAMLDOC) $(DOC_ALL) +@@ -416,7 +416,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" \ diff --git a/debian/patches/0006-read_main_debug_info-do-not-die-in-custom-executable.patch b/debian/patches/0006-read_main_debug_info-do-not-die-in-custom-executable.patch index 586ddbe6..a9c21783 100644 --- a/debian/patches/0006-read_main_debug_info-do-not-die-in-custom-executable.patch +++ b/debian/patches/0006-read_main_debug_info-do-not-die-in-custom-executable.patch @@ -10,10 +10,10 @@ build of ppxlib. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/backtrace_byt.c b/runtime/backtrace_byt.c -index 8ea94ee..d82816c 100644 +index 28fe44c..88e10fc 100644 --- a/runtime/backtrace_byt.c +++ b/runtime/backtrace_byt.c -@@ -342,7 +342,7 @@ static void read_main_debug_info(struct debug_info *di) +@@ -378,7 +378,7 @@ static void read_main_debug_info(struct debug_info *di) fd = caml_attempt_open(&exec_name, &trail, 1); if (fd < 0){ diff --git a/debian/patches/0007-Avoid-duplicate-definitions-of-common-global-variabl.patch b/debian/patches/0007-Avoid-duplicate-definitions-of-common-global-variabl.patch deleted file mode 100644 index bbbc283d..00000000 --- a/debian/patches/0007-Avoid-duplicate-definitions-of-common-global-variabl.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Xavier Leroy -Date: Thu, 12 Dec 2019 16:41:17 +0100 -Subject: Avoid duplicate definitions of "common" global variables - -The variables are caml_debug_info and caml_atom_table. -The multiple definitions look like a cut-and-paste error. -They cause problems with C compilers that don't follow the "common" model. - -Bug: https://github.com/ocaml/ocaml/issues/9144 -Bug-Debian: https://bugs.debian.org/957623 ---- - runtime/backtrace.c | 3 --- - runtime/startup_nat.c | 1 - - 2 files changed, 4 deletions(-) - -diff --git a/runtime/backtrace.c b/runtime/backtrace.c -index a3c2c08..ddf7af1 100644 ---- a/runtime/backtrace.c -+++ b/runtime/backtrace.c -@@ -27,9 +27,6 @@ - #include "caml/backtrace_prim.h" - #include "caml/fail.h" - --/* The table of debug information fragments */ --struct ext_table caml_debug_info; -- - CAMLexport int32_t caml_backtrace_active = 0; - CAMLexport int32_t caml_backtrace_pos = 0; - CAMLexport backtrace_slot * caml_backtrace_buffer = NULL; -diff --git a/runtime/startup_nat.c b/runtime/startup_nat.c -index 43b85e3..5b20036 100644 ---- a/runtime/startup_nat.c -+++ b/runtime/startup_nat.c -@@ -44,7 +44,6 @@ - #endif - - extern int caml_parser_trace; --CAMLexport header_t caml_atom_table[256]; - char * caml_code_area_start, * caml_code_area_end; - struct ext_table caml_code_fragments_table; - diff --git a/debian/patches/0008-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch b/debian/patches/0008-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch index 856e72f2..9c306374 100644 --- a/debian/patches/0008-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch +++ b/debian/patches/0008-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch @@ -8,12 +8,12 @@ Bug: https://github.com/ocaml/ocaml/issues/9800 1 file changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac -index 82172d7..0f22211 100644 +index 069fe96..ab1e188 100644 --- a/configure.ac +++ b/configure.ac -@@ -952,6 +952,16 @@ AS_CASE(["$arch,$system"], - [power,netbsd], [profiling=true], - [profiling=false]) +@@ -1018,6 +1018,16 @@ AS_CASE([$arch], + [common_cflags="-no-pie $common_cflags"], + [])]) +# Disable DT_TEXTREL warnings on Linux i386 +# See https://github.com/ocaml/ocaml/issues/9800 @@ -27,4 +27,4 @@ index 82172d7..0f22211 100644 + # Assembler - AS_CASE([$host], + AS_IF([test -n "$host_alias"], [toolpref="${host_alias}-"], [toolpref=""]) diff --git a/debian/patches/0008-Reimplement-custom-without-hacks.patch b/debian/patches/0008-Reimplement-custom-without-hacks.patch deleted file mode 100644 index 194a0bc4..00000000 --- a/debian/patches/0008-Reimplement-custom-without-hacks.patch +++ /dev/null @@ -1,230 +0,0 @@ -From: Stephane Glondu -Date: Sun, 18 Aug 2019 08:04:51 +0200 -Subject: Reimplement -custom without hacks - -Origin: https://github.com/ocaml/ocaml/pull/8872 ---- - bytecomp/bytelink.ml | 32 +++++++++-- - ocamltest/Makefile | 3 +- - testsuite/tests/embedded/ocamltests | 1 - - testsuite/tests/lib-dynlink-bytecode/main.ml | 2 +- - testsuite/tests/lib-threads/ocamltests | 1 - - tools/cmpbyt.ml | 85 +++++++++++++++------------- - 6 files changed, 77 insertions(+), 47 deletions(-) - delete mode 100644 testsuite/tests/embedded/ocamltests - -diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml -index 0b964e6..40b2850 100644 ---- a/bytecomp/bytelink.ml -+++ b/bytecomp/bytelink.ml -@@ -438,7 +438,7 @@ let output_cds_file outfile = - - (* Output a bytecode executable as a C file *) - --let link_bytecode_as_c tolink outfile = -+let link_bytecode_as_c tolink outfile with_main = - let outchan = open_out outfile in - Misc.try_finally - ~always:(fun () -> close_out outchan) -@@ -481,7 +481,19 @@ let link_bytecode_as_c tolink outfile = - (* The table of primitives *) - Symtable.output_primitive_table outchan; - (* The entry point *) -- output_string outchan "\ -+ if with_main then begin -+ output_string outchan "\ -+\nint main(int argc, char_os **argv)\ -+\n{\ -+\n caml_startup_code(caml_code, sizeof(caml_code),\ -+\n caml_data, sizeof(caml_data),\ -+\n caml_sections, sizeof(caml_sections),\ -+\n /* pooling */ 0,\ -+\n argv);\ -+\n return 0; /* not reached */\ -+\n}\n" -+ end else begin -+ output_string outchan "\ - \nvoid caml_startup(char_os ** argv)\ - \n{\ - \n caml_startup_code(caml_code, sizeof(caml_code),\ -@@ -516,7 +528,9 @@ let link_bytecode_as_c tolink outfile = - \n caml_sections, sizeof(caml_sections),\ - \n /* pooling */ 1,\ - \n argv);\ --\n}\ -+\n}\n" -+ end; -+ output_string outchan "\ - \n#ifdef __cplusplus\ - \n}\ - \n#endif\n"; -@@ -575,6 +589,16 @@ let link objfiles output_name = - Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *) - if not !Clflags.custom_runtime then - link_bytecode tolink output_name true -+ else if not !Clflags.output_c_object && not !Clflags.make_runtime then -+ let c_file = Filename.temp_file "camlobj" ".c" in -+ Misc.try_finally -+ ~always:(fun () -> remove_file c_file) -+ (fun () -> -+ link_bytecode_as_c 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) -+ ) - else if not !Clflags.output_c_object then begin - let bytecode_name = Filename.temp_file "camlcode" "" in - let prim_name = -@@ -637,7 +661,7 @@ let link objfiles output_name = - Misc.try_finally - ~always:(fun () -> List.iter remove_file !temps) - (fun () -> -- link_bytecode_as_c tolink c_file; -+ link_bytecode_as_c tolink c_file false; - if not (Filename.check_suffix output_name ".c") then begin - temps := c_file :: !temps; - if Ccomp.compile_file ~output:obj_file ?stable_name c_file <> 0 then -diff --git a/ocamltest/Makefile b/ocamltest/Makefile -index f226e55..7c7edf4 100644 ---- a/ocamltest/Makefile -+++ b/ocamltest/Makefile -@@ -198,7 +198,8 @@ allopt: ocamltest.opt$(EXE) - opt.opt: allopt - - ocamltest$(EXE): $(bytecode_modules) -- $(ocamlc_cmd) -custom ocamlcommon.cma ocamlbytecomp.cma -o $@ $^ -+ $(ocamlc_cmd) -ccopt "-I $(ROOTDIR)/runtime" -custom \ -+ ocamlcommon.cma ocamlbytecomp.cma -o $@ $^ - - %.cmo: %.ml - $(ocamlc) -c $< -diff --git a/testsuite/tests/embedded/ocamltests b/testsuite/tests/embedded/ocamltests -deleted file mode 100644 -index b03fb35..0000000 ---- a/testsuite/tests/embedded/ocamltests -+++ /dev/null -@@ -1 +0,0 @@ --cmcaml.ml -diff --git a/testsuite/tests/lib-dynlink-bytecode/main.ml b/testsuite/tests/lib-dynlink-bytecode/main.ml -index 558dc69..15892fa 100644 ---- a/testsuite/tests/lib-dynlink-bytecode/main.ml -+++ b/testsuite/tests/lib-dynlink-bytecode/main.ml -@@ -45,7 +45,7 @@ reference = "${test_source_directory}/static.reference" - - ******** ocamlc.byte - program = "${test_build_directory}/custom.exe" --flags = "-custom -linkall -I ." -+flags = "-ccopt '-I ${ocamlsrcdir}/runtime' -custom -linkall -I ." - all_modules = "registry.cmo plug2.cma plug1.cma" - use_runtime = "false" - ********* run -diff --git a/testsuite/tests/lib-threads/ocamltests b/testsuite/tests/lib-threads/ocamltests -index 1df74eb..76ec72d 100644 ---- a/testsuite/tests/lib-threads/ocamltests -+++ b/testsuite/tests/lib-threads/ocamltests -@@ -10,7 +10,6 @@ pr7638.ml - prodcons.ml - prodcons2.ml - sieve.ml --signal.ml - sockets.ml - swapchan.ml - tls.ml -diff --git a/tools/cmpbyt.ml b/tools/cmpbyt.ml -index 983234f..71bbe1e 100644 ---- a/tools/cmpbyt.ml -+++ b/tools/cmpbyt.ml -@@ -35,47 +35,54 @@ let skip_section name = - - let cmpbyt file1 file2 = - let ic1 = open_in_bin file1 in -- let (toc1, pos1) = readtoc ic1 in - let ic2 = open_in_bin file2 in -- let (toc2, pos2) = readtoc ic2 in -- seek_in ic1 pos1; -- seek_in ic2 pos2; -- let rec cmpsections t1 t2 = -- match t1, t2 with -- | [], [] -> -- true -- | (name1, len1) :: t1, t2 when skip_section name1 -> -- seek_in ic1 (pos_in ic1 + len1); -- cmpsections t1 t2 -- | t1, (name2, len2) :: t2 when skip_section name2 -> -- seek_in ic2 (pos_in ic2 + len2); -- cmpsections t1 t2 -- | [], _ -> -- eprintf "%s has more sections than %s\n" file2 file1; -- false -- | _, [] -> -- eprintf "%s has more sections than %s\n" file1 file2; -- false -- | (name1, len1) :: t1, (name2, len2) :: t2 -> -- if name1 <> name2 then begin -- eprintf "Section mismatch: %s (in %s) / %s (in %s)\n" -- name1 file1 name2 file2; -- false -- end else if len1 <> len2 then begin -- eprintf "Length of section %s differ: %d (in %s) / %d (in %s)\n" -- name1 len1 file1 len2 file2; -- false -- end else begin -- match cmpbytes ic1 ic2 len1 0 with -- | Differ ofs -> -- eprintf "Files %s and %s differ: section %s, offset %d\n" -- file1 file2 name1 ofs; -- false -- | Same -> -- cmpsections t1 t2 -- end -+ let len1 = in_channel_length ic1 in -+ let len2 = in_channel_length ic2 in -+ let res = -+ if len1 = len2 && cmpbytes ic1 ic2 len1 0 = Same then -+ true -+ else -+ let (toc1, pos1) = readtoc ic1 in -+ let (toc2, pos2) = readtoc ic2 in -+ seek_in ic1 pos1; -+ seek_in ic2 pos2; -+ let rec cmpsections t1 t2 = -+ match t1, t2 with -+ | [], [] -> -+ true -+ | (name1, len1) :: t1, t2 when skip_section name1 -> -+ seek_in ic1 (pos_in ic1 + len1); -+ cmpsections t1 t2 -+ | t1, (name2, len2) :: t2 when skip_section name2 -> -+ seek_in ic2 (pos_in ic2 + len2); -+ cmpsections t1 t2 -+ | [], _ -> -+ eprintf "%s has more sections than %s\n" file2 file1; -+ false -+ | _, [] -> -+ eprintf "%s has more sections than %s\n" file1 file2; -+ false -+ | (name1, len1) :: t1, (name2, len2) :: t2 -> -+ if name1 <> name2 then begin -+ eprintf "Section mismatch: %s (in %s) / %s (in %s)\n" -+ name1 file1 name2 file2; -+ false -+ end else if len1 <> len2 then begin -+ eprintf "Length of section %s differ: %d (in %s) / %d (in %s)\n" -+ name1 len1 file1 len2 file2; -+ false -+ end else begin -+ match cmpbytes ic1 ic2 len1 0 with -+ | Differ ofs -> -+ eprintf "Files %s and %s differ: section %s, offset %d\n" -+ file1 file2 name1 ofs; -+ false -+ | Same -> -+ cmpsections t1 t2 -+ end -+ in -+ cmpsections toc1 toc2 - in -- let res = cmpsections toc1 toc2 in - close_in ic1; close_in ic2; - res - diff --git a/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch b/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch index af639f37..9a9d1a39 100644 --- a/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch +++ b/debian/patches/0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch @@ -17,10 +17,10 @@ Last-Update: <2019-07-22> 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index f5d8a26..82172d7 100644 +index aa5f26f..069fe96 100644 --- a/configure.ac +++ b/configure.ac -@@ -767,6 +767,9 @@ AS_IF([test x"$enable_shared" != "xno"], +@@ -831,6 +831,9 @@ AS_IF([test x"$enable_shared" != "xno"], natdynlinkopts="-Wl,-E" shared_libraries_supported=true])]) @@ -31,15 +31,15 @@ index f5d8a26..82172d7 100644 # Configure native dynlink diff --git a/tools/Makefile b/tools/Makefile -index ee0e0be..b6d74d5 100644 +index dbad0b7..b4adcff 100644 --- a/tools/Makefile +++ b/tools/Makefile -@@ -323,7 +323,7 @@ endif +@@ -276,7 +276,7 @@ DEF_SYMBOL_PREFIX = '-Dsymbol_prefix="_"' + endif - objinfo_helper$(EXE): objinfo_helper.c $(ROOTDIR)/runtime/caml/s.h - $(CC) $(OC_CFLAGS) $(OC_CPPFLAGS) -I$(ROOTDIR)/runtime $(OUTPUTEXE)$@ \ -- $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) $< $(LIBBFD_LINK) -+ $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) $< $(LIBBFD_LINK) $(CCLINKFLAGS) + objinfo_helper$(EXE): objinfo_helper.$(O) +- $(CC) $(BFD_LDFLAGS) $(OC_CFLAGS) $(OUTPUTEXE)$@ $< $(BFD_LDLIBS) ++ $(CC) $(BFD_LDFLAGS) $(OC_CFLAGS) $(OUTPUTEXE)$@ $< $(BFD_LDLIBS) $(CCLINKFLAGS) + + objinfo_helper.$(O): $(ROOTDIR)/runtime/caml/s.h - OBJINFO=$(ROOTDIR)/compilerlibs/ocamlcommon.cma \ - $(ROOTDIR)/compilerlibs/ocamlbytecomp.cma \ diff --git a/debian/patches/series b/debian/patches/series index c66a94db..c9d9fc17 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,7 +2,5 @@ 0004-Put-manpages-in-section-3o-instead-of-3.patch 0013-Use-CCLINKFLAGS-for-linking-all-executables-and-shar.patch 0005-Check-for-definition-of-AT_SECURE-before-using-it.patch -0008-Reimplement-custom-without-hacks.patch 0006-read_main_debug_info-do-not-die-in-custom-executable.patch -0007-Avoid-duplicate-definitions-of-common-global-variabl.patch 0008-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch -- 2.30.2