Guest User

Untitled

a guest
Feb 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. From cafd65c97a51f346451ba0d560662450cce2bbc3 Mon Sep 17 00:00:00 2001
  2. From: Mehdi Dogguy <mehdi@debian.org>
  3. Date: Fri, 15 Jul 2011 21:45:29 +0200
  4. Subject: [PATCH] Make objinfo show force_link and ccobjs/ccopts when needed
  5.  
  6. - Show force_link for cmx/cma
  7. - Show ccobjs/ccopts for cmxa
  8. ---
  9. tools/objinfo.ml | 25 +++++++++++++++++++++----
  10. 1 files changed, 21 insertions(+), 4 deletions(-)
  11.  
  12. diff --git a/tools/objinfo.ml b/tools/objinfo.ml
  13. index 4f467f2..89855da 100644
  14. --- a/tools/objinfo.ml
  15. +++ b/tools/objinfo.ml
  16. @@ -44,8 +44,12 @@ let print_name_crc (name, crc) =
  17. let print_line name =
  18. printf "\t%s\n" name
  19.  
  20. +let string_of_bool name =
  21. + if name then "YES" else "no"
  22. +
  23. let print_cmo_infos cu =
  24. printf "Unit name: %s\n" cu.cu_name;
  25. + printf "Force link: %s\n" (string_of_bool cu.cu_force_link);
  26. print_string "Interfaces imported:\n";
  27. List.iter print_name_crc cu.cu_imports;
  28. printf "Uses unsafe features: ";
  29. @@ -85,7 +89,7 @@ let print_spaced_string s =
  30. printf " %s" s
  31.  
  32. let print_cma_infos (lib : Cmo_format.library) =
  33. - printf "Force custom: %s\n" (if lib.lib_custom then "YES" else "no");
  34. + printf "Force custom: %s\n" (string_of_bool lib.lib_custom);
  35. printf "Extra C object files:";
  36. (* PR#4949: print in linking order *)
  37. List.iter print_spaced_string (List.rev lib.lib_ccobjs);
  38. @@ -102,8 +106,11 @@ let print_cmi_infos name sign comps crcs =
  39. printf "Interfaces imported:\n";
  40. List.iter print_name_crc crcs
  41.  
  42. -let print_general_infos name crc defines cmi cmx =
  43. +let print_general_infos name force_link crc defines cmi cmx =
  44. printf "Name: %s\n" name;
  45. + match force_link with
  46. + Some flag -> printf "Force link: %s\n" (string_of_bool flag)
  47. + | None -> ();
  48. printf "CRC of implementation: %s\n" (Digest.to_hex crc);
  49. printf "Globals defined:\n";
  50. List.iter print_line defines;
  51. @@ -116,7 +123,7 @@ open Cmx_format
  52.  
  53. let print_cmx_infos (ui, crc) =
  54. print_general_infos
  55. - ui.ui_name crc ui.ui_defines ui.ui_imports_cmi ui.ui_imports_cmx;
  56. + ui.ui_name (Some ui.ui_force_link) crc ui.ui_defines ui.ui_imports_cmi ui.ui_imports_cmx;
  57. printf "Approximation:\n";
  58. Format.fprintf Format.std_formatter " %a@." print_approx_infos ui.ui_approx;
  59. let pr_funs _ fns =
  60. @@ -124,11 +131,21 @@ let print_cmx_infos (ui, crc) =
  61. printf "Currying functions:%a\n" pr_funs ui.ui_curry_fun;
  62. printf "Apply functions:%a\n" pr_funs ui.ui_apply_fun
  63.  
  64. +let print_cmxa_infos lib =
  65. + printf "Extra C object files:";
  66. + (* PR#4949: print in linking order *)
  67. + List.iter print_spaced_string (List.rev lib.lib_ccobjs);
  68. + printf "\nExtra C options:";
  69. + List.iter print_spaced_string lib.lib_ccopts;
  70. + printf "\n";
  71. + List.iter print_cmx_infos lib.lib_units
  72. +
  73. let print_cmxs_infos header =
  74. List.iter
  75. (fun ui ->
  76. print_general_infos
  77. ui.dynu_name
  78. + None
  79. ui.dynu_crc
  80. ui.dynu_defines
  81. ui.dynu_imports_cmi
  82. @@ -234,7 +251,7 @@ let dump_obj filename =
  83. end else if magic_number = cmxa_magic_number then begin
  84. let li = (input_value ic : library_infos) in
  85. close_in ic;
  86. - List.iter print_cmx_infos li.lib_units
  87. + print_cmxa_infos li
  88. end else begin
  89. let pos_trailer = in_channel_length ic - len_magic_number in
  90. let _ = seek_in ic pos_trailer in
  91. --
  92. 1.7.5.4
Add Comment
Please, Sign In to add comment