[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794583: OCaml and reproducible builds



Hello,

from the OCaml trenches:
- gasche has pulled the OCamldoc patch upstream (see
https://github.com/ocaml/ocaml/pull/321)
- xavier has pushed a patch which emits a .file "" directive at the
beginning of each assembly file
(https://github.com/ocaml/ocaml/commit/eef84c432a4fcecc83f02d81b347cf819c69df9f)
(discussion of why setting Location.input_file to the original file
breaks is in http://caml.inria.fr/mantis/view.php?id=7037#c15059)


It would be great to test xavier's patch in your setup, but it does not
apply to 4.02.3 release (due to missing files).  Please find attached a
patch which cleanly applies to 4.02.3 (a merge of glondu@ and xavier's
work).


hannes
--- a/asmcomp/amd64/emit.mlp
+++ b/asmcomp/amd64/emit.mlp
@@ -882,6 +882,7 @@ let begin_assembly() =
   reset_debug_info();                   (* PR#5603 *)
   reset_imp_table();
   float_constants := [];
+  `	.file \"\"\n`;
   if system = S_win64 then begin
     D.extrn "caml_young_ptr" QWORD;
     D.extrn "caml_young_limit" QWORD;
@@ -896,8 +897,6 @@ let begin_assembly() =
     D.extrn "caml_raise_exn" NEAR;
     D.extrn "caml_reraise_exn" NEAR;
   end;
-
-
   if !Clflags.dlcode then begin
     (* from amd64.S; could emit these constants on demand *)
     begin match system with
diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp
index 440f463..f0ae430 100644
--- a/asmcomp/arm/emit.mlp
+++ b/asmcomp/arm/emit.mlp
@@ -894,6 +894,7 @@ let data l =
 
 let begin_assembly() =
   reset_debug_info();
+  `	.file \"\"\n`;
   `	.syntax	unified\n`;
   begin match !arch with
   | ARMv4   -> `	.arch	armv4t\n`
diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
index bc05139..895cd85 100644
--- a/asmcomp/arm64/emit.mlp
+++ b/asmcomp/arm64/emit.mlp
@@ -944,6 +944,7 @@ let data l =
 
 let begin_assembly() =
   reset_debug_info();
+  `	.file \"\"\n`;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `	.data\n`;
   `	.globl	{emit_symbol lbl_begin}\n`;
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index 70b4540..200f296 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -1033,6 +1033,7 @@ let begin_assembly() =
 
   D.text ();
   emit_global_label "code_begin";
+  `	.file \"\"\n`;
   if system = S_macosx then I.nop (); (* PR#4690 *)
   ()
 
diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp
index eac1231..85b958c 100644
--- a/asmcomp/power/emit.mlp
+++ b/asmcomp/power/emit.mlp
@@ -1137,6 +1137,7 @@ let begin_assembly() =
   | _ -> ()
   end;
   Hashtbl.clear tocref_entries;
+  `	.file \"\"\n`;
   (* Emit the beginning of the segments *)
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   emit_string data_space;
diff --git a/asmcomp/sparc/emit.mlp b/asmcomp/sparc/emit.mlp
index b29278f..b57b1aa 100644
--- a/asmcomp/sparc/emit.mlp
+++ b/asmcomp/sparc/emit.mlp
@@ -737,7 +737,7 @@ let data l =
 (* Beginning / end of an assembly file *)
 
 let begin_assembly() =
+  `	.file \"\"\n`;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `	.data\n`;
   `	.global	{emit_symbol lbl_begin}\n`;

Reply to: