summaryrefslogtreecommitdiff
path: root/utils/ccomp.ml
diff options
context:
space:
mode:
authorValentin Gatien-Baron <vgatien-baron@janestreet.com>2019-08-23 09:20:45 -0400
committerArmaël Guéneau <Armael@users.noreply.github.com>2019-08-26 07:58:28 +0200
commitf40011556c2ca3a11b323d4215f17cf8caacdae9 (patch)
tree01bf1e1e9fe9e4c4c37fb2e7e97a4dbc8d5b4f75 /utils/ccomp.ml
parentebc6bb8013fc8ce6817ef3fa65153bed184bba6f (diff)
downloadocaml-f40011556c2ca3a11b323d4215f17cf8caacdae9.tar.gz
in -dtimings output, show time spent in C linker clearly
Diffstat (limited to 'utils/ccomp.ml')
-rw-r--r--utils/ccomp.ml62
1 files changed, 32 insertions, 30 deletions
diff --git a/utils/ccomp.ml b/utils/ccomp.ml
index 3593ef1570..9eecbb2ed4 100644
--- a/utils/ccomp.ml
+++ b/utils/ccomp.ml
@@ -181,33 +181,35 @@ let remove_Wl cclibs =
else cclib)
let call_linker mode output_name files extra =
- let cmd =
- if mode = Partial then
- let l_prefix =
- match Config.ccomp_type with
- | "msvc" -> "/libpath:"
- | _ -> "-L"
- in
- Printf.sprintf "%s%s %s %s %s"
- Config.native_pack_linker
- (Filename.quote output_name)
- (quote_prefixed l_prefix (Load_path.get_paths ()))
- (quote_files (remove_Wl files))
- extra
- else
- Printf.sprintf "%s -o %s %s %s %s %s %s"
- (match !Clflags.c_compiler, mode with
- | Some cc, _ -> cc
- | None, Exe -> Config.mkexe
- | None, Dll -> Config.mkdll
- | None, MainDll -> Config.mkmaindll
- | None, Partial -> assert false
- )
- (Filename.quote output_name)
- "" (*(Clflags.std_include_flag "-I")*)
- (quote_prefixed "-L" (Load_path.get_paths ()))
- (String.concat " " (List.rev !Clflags.all_ccopts))
- (quote_files files)
- extra
- in
- command cmd = 0
+ Profile.record_call "c-linker" (fun () ->
+ let cmd =
+ if mode = Partial then
+ let l_prefix =
+ match Config.ccomp_type with
+ | "msvc" -> "/libpath:"
+ | _ -> "-L"
+ in
+ Printf.sprintf "%s%s %s %s %s"
+ Config.native_pack_linker
+ (Filename.quote output_name)
+ (quote_prefixed l_prefix (Load_path.get_paths ()))
+ (quote_files (remove_Wl files))
+ extra
+ else
+ Printf.sprintf "%s -o %s %s %s %s %s %s"
+ (match !Clflags.c_compiler, mode with
+ | Some cc, _ -> cc
+ | None, Exe -> Config.mkexe
+ | None, Dll -> Config.mkdll
+ | None, MainDll -> Config.mkmaindll
+ | None, Partial -> assert false
+ )
+ (Filename.quote output_name)
+ "" (*(Clflags.std_include_flag "-I")*)
+ (quote_prefixed "-L" (Load_path.get_paths ()))
+ (String.concat " " (List.rev !Clflags.all_ccopts))
+ (quote_files files)
+ extra
+ in
+ command cmd = 0
+ )