~ubuntu-branches/debian/sid/ocaml/sid

« back to all changes in this revision

Viewing changes to debian/patches/0011-Embed-bytecode-in-C-object-when-using-custom.patch

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-05-25 07:40:01 UTC
  • mfrom: (12.1.15 sid)
  • Revision ID: james.westby@ubuntu.com-20110525074001-cxo449ibv0fkjlho
* Provide a way to use legacy custom linking (Closes: #627761)
* Document Debian-specific -custom behaviour in README.Debian
* Properly initialize executable name in caml_startup_code
  (Closes: #627756)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Subject: Embed bytecode in C object when using -custom
4
4
 
5
5
This patch fixes non-strippability of bytecode executables linked with
6
 
custom runtime.
 
6
custom runtime. Having "c" in OCAML_COMPAT environment variable
 
7
restores the original behaviour.
7
8
 
8
9
Forwarded: not-needed
9
10
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900
 
11
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627761
10
12
Signed-off-by: Stephane Glondu <steph@glondu.net>
11
13
---
12
 
 bytecomp/bytelink.ml |   31 +++++++++++++++++++++++++++----
13
 
 1 files changed, 27 insertions(+), 4 deletions(-)
 
14
 bytecomp/bytelink.ml |   36 ++++++++++++++++++++++++++++++++----
 
15
 1 files changed, 32 insertions(+), 4 deletions(-)
14
16
 
15
17
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
16
 
index 47903c4..184079c 100644
 
18
index 47903c4..e63dd3b 100644
17
19
--- a/bytecomp/bytelink.ml
18
20
+++ b/bytecomp/bytelink.ml
19
21
@@ -415,7 +415,7 @@ let mlvalues_primitives = [
55
57
 #ifdef __cplusplus\n\
56
58
 }\n\
57
59
 #endif\n";
58
 
@@ -514,6 +527,16 @@ let link objfiles output_name =
 
60
@@ -501,6 +514,11 @@ let fix_exec_name name =
 
61
       if String.contains name '.' then name else name ^ ".exe"
 
62
   | _ -> name
 
63
 
 
64
+(* Legacy custom behaviour (Debian-specific) *)
 
65
+
 
66
+let legacy_custom =
 
67
+  try String.contains (Sys.getenv "OCAML_COMPAT") 'c' with Not_found -> false
 
68
+
 
69
 (* Main entry point (build a custom runtime if needed) *)
 
70
 
 
71
 let link objfiles output_name =
 
72
@@ -514,6 +532,16 @@ let link objfiles output_name =
59
73
   Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *)
60
74
   if not !Clflags.custom_runtime then
61
75
     link_bytecode tolink output_name true
62
 
+  else if not !Clflags.output_c_object && not !Clflags.make_runtime then
 
76
+  else if not legacy_custom && not !Clflags.output_c_object && not !Clflags.make_runtime then
63
77
+    let c_file = Filename.temp_file "camlobj" ".c" in
64
78
+    try
65
79
+      link_bytecode_as_c tolink c_file true;
72
86
   else if not !Clflags.output_c_object then begin
73
87
     let bytecode_name = Filename.temp_file "camlcode" "" in
74
88
     let prim_name = Filename.temp_file "camlprim" ".c" in
75
 
@@ -552,7 +575,7 @@ let link objfiles output_name =
 
89
@@ -552,7 +580,7 @@ let link objfiles output_name =
76
90
     if Sys.file_exists c_file then raise(Error(File_exists c_file));
77
91
     let temps = ref [] in
78
92
     try