This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch experimental/master
in repository ocaml.

commit add91ac9b518ee9dfe1bc74dfb49512fea091852
Author: Stephane Glondu <st...@glondu.net>
Date:   Fri Aug 21 22:04:34 2015 +0200

    Cleaner patch for adding .file directives (Closes: #796336)
---
 ...d-a-.file-directive-to-generated-.s-files.patch | 108 +++++++++++++++++++++
 ...-directive-to-startup-.s-files-for-reprod.patch |  25 -----
 debian/patches/series                              |   2 +-
 3 files changed, 109 insertions(+), 26 deletions(-)

diff --git 
a/debian/patches/0010-Add-a-.file-directive-to-generated-.s-files.patch 
b/debian/patches/0010-Add-a-.file-directive-to-generated-.s-files.patch
new file mode 100644
index 0000000..31765c4
--- /dev/null
+++ b/debian/patches/0010-Add-a-.file-directive-to-generated-.s-files.patch
@@ -0,0 +1,108 @@
+From: Stephane Glondu <st...@glondu.net>
+Date: Sun, 16 Aug 2015 20:59:14 +0200
+Subject: Add a .file directive to generated .s files
+
+When no .file directive is given, the toolchain records the filename
+of the .o file, which is sometimes random, making generated objects
+non-deterministic.
+
+We use Location.input_name for adding .file directives to assembly
+files. When the file is preprocessed, this reference used to hold the
+name of the temporary file. With this patch, it is no longer the case.
+
+Bug-Debian: https://bugs.debian.org/795784
+Bug-Debian: https://bugs.debian.org/796336
+---
+ asmcomp/amd64/emit.mlp | 1 +
+ asmcomp/arm/emit.mlp   | 1 +
+ asmcomp/arm64/emit.mlp | 1 +
+ asmcomp/i386/emit.mlp  | 1 +
+ asmcomp/power/emit.mlp | 1 +
+ asmcomp/sparc/emit.mlp | 1 +
+ driver/pparse.ml       | 1 -
+ 7 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp
+index d56d0f5..4d7aa30 100644
+--- a/asmcomp/amd64/emit.mlp
++++ b/asmcomp/amd64/emit.mlp
+@@ -794,6 +794,7 @@ let data l =
+ let begin_assembly() =
+   reset_debug_info();                   (* PR#5603 *)
+   float_constants := [];
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
+   if !Clflags.dlcode then begin
+     (* from amd64.S; could emit these constants on demand *)
+     if macosx then
+diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp
+index 4948fb2..6f30fba 100644
+--- a/asmcomp/arm/emit.mlp
++++ b/asmcomp/arm/emit.mlp
+@@ -892,6 +892,7 @@ let data l =
+ 
+ let begin_assembly() =
+   reset_debug_info();
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\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 750c2b2..5afbb8a 100644
+--- a/asmcomp/arm64/emit.mlp
++++ b/asmcomp/arm64/emit.mlp
+@@ -942,6 +942,7 @@ let data l =
+ 
+ let begin_assembly() =
+   reset_debug_info();
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\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 98df5f9..531150f 100644
+--- a/asmcomp/i386/emit.mlp
++++ b/asmcomp/i386/emit.mlp
+@@ -986,6 +986,7 @@ let data l =
+ let begin_assembly() =
+   reset_debug_info();                   (* PR#5603 *)
+   float_constants := [];
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
+   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
+   `   .data\n`;
+   `   .globl  {emit_symbol lbl_begin}\n`;
+diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp
+index 4344085..343132b 100644
+--- a/asmcomp/power/emit.mlp
++++ b/asmcomp/power/emit.mlp
+@@ -887,6 +887,7 @@ let data l =
+ let begin_assembly() =
+   defined_functions := StringSet.empty;
+   external_functions := StringSet.empty;
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\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 877a3d5..7b041e9 100644
+--- a/asmcomp/sparc/emit.mlp
++++ b/asmcomp/sparc/emit.mlp
+@@ -727,6 +727,7 @@ let data l =
+ (* Beginning / end of an assembly file *)
+ 
+ let begin_assembly() =
++  `   .file \"{emit_string (String.escaped !Location.input_name)}\"\n`;
+   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
+   `   .data\n`;
+   `   .global {emit_symbol lbl_begin}\n`;
+diff --git a/driver/pparse.ml b/driver/pparse.ml
+index b67c180..f985c53 100644
+--- a/driver/pparse.ml
++++ b/driver/pparse.ml
+@@ -156,7 +156,6 @@ let file ppf ~tool_name inputfile parse_fun ast_magic =
+         input_value ic
+       end else begin
+         seek_in ic 0;
+-        Location.input_name := inputfile;
+         let lexbuf = Lexing.from_channel ic in
+         Location.init lexbuf inputfile;
+         parse_fun lexbuf
diff --git 
a/debian/patches/0010-Add-a-.file-directive-to-startup-.s-files-for-reprod.patch
 
b/debian/patches/0010-Add-a-.file-directive-to-startup-.s-files-for-reprod.patch
deleted file mode 100644
index 1095949..0000000
--- 
a/debian/patches/0010-Add-a-.file-directive-to-startup-.s-files-for-reprod.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From: Stephane Glondu <st...@glondu.net>
-Date: Sun, 16 Aug 2015 20:59:14 +0200
-Subject: Add a .file directive to startup .s files for reproducibility
-
-When no .file directive is given, gcc records the filename of the
-startup .o file, which is random, in the final executable, making it
-non-reproducible.
-
-Bug-Debian: https://bugs.debian.org/795784
----
- asmcomp/asmlink.ml | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
-index cea7b56..cad7d8c 100644
---- a/asmcomp/asmlink.ml
-+++ b/asmcomp/asmlink.ml
-@@ -201,6 +201,7 @@ let scan_file obj_name tolink = match read_file obj_name 
with
- let make_startup_file ppf filename units_list =
-   let compile_phrase p = Asmgen.compile_phrase ppf p in
-   let oc = open_out filename in
-+  Printf.fprintf oc "\t.file \"startup.s\"\n";
-   Emitaux.output_channel := oc;
-   Location.input_name := "caml_startup"; (* set name of "current" input *)
-   Compilenv.reset "_startup"; (* set the name of the "current" compunit *)
diff --git a/debian/patches/series b/debian/patches/series
index 67aa81b..914223c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,4 +7,4 @@
 0007-Tune-resource-usage-of-some-tests.patch
 0008-Native-backtraces-don-t-work-on-powerpc-and-sparc.patch
 0010-Enable-ocamldoc-to-build-reproducible-manpages.patch
-0010-Add-a-.file-directive-to-startup-.s-files-for-reprod.patch
+0010-Add-a-.file-directive-to-generated-.s-files.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml.git

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to