diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2006-10-16 08:40:42 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2006-10-16 08:40:42 +0000 |
commit | f2027274dd75aedfa30a60ec7c68331bd6759854 (patch) | |
tree | e09fabdbe2111af5e4d1ae7d66d17ac0ad432ae6 | |
parent | 34430286a5f547f48098f77515a05e93419effba (diff) |
gprof profiling support for MacOSX/Intel (PR#4087)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7692 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | asmcomp/i386/emit.mlp | 16 | ||||
-rw-r--r-- | asmrun/i386.S | 15 | ||||
-rwxr-xr-x | configure | 1 |
3 files changed, 31 insertions, 1 deletions
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp index b04b1e9cd..7e3b23290 100644 --- a/asmcomp/i386/emit.mlp +++ b/asmcomp/i386/emit.mlp @@ -815,7 +815,12 @@ let emit_external_symbols () = external_symbols_indirect := StringSet.empty; ` .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5\n`; StringSet.iter emit_external_symbol_direct !external_symbols_direct; - external_symbols_direct := StringSet.empty + external_symbols_direct := StringSet.empty; + if !Clflags.gprofile then begin + `Lmcount$stub:\n`; + ` .indirect_symbol mcount\n`; + ` hlt ; hlt ; hlt ; hlt ; hlt\n` + end (* Emission of the profiling prelude *) @@ -839,6 +844,15 @@ let emit_profile () = ` popl %edx\n`; ` popl %ecx\n`; ` popl %eax\n` + | "macosx" -> + ` pushl %eax\n`; + ` movl %esp, %ebp\n`; + ` pushl %ecx\n`; + ` pushl %edx\n`; + ` call Lmcount$stub\n`; + ` popl %edx\n`; + ` popl %ecx\n`; + ` popl %eax\n` | _ -> () (*unsupported yet*) (* Declare a global function symbol *) diff --git a/asmrun/i386.S b/asmrun/i386.S index be02b911e..518ebf3d5 100644 --- a/asmrun/i386.S +++ b/asmrun/i386.S @@ -57,6 +57,13 @@ popl %edx; popl %ecx; popl %eax; popl %ebp #define PROFILE_C \ pushl %ebp; movl %esp, %ebp; call .mcount; popl %ebp +#elif defined(SYS_macosx) +#define PROFILE_CAML \ + pushl %ebp; movl %esp, %ebp; pushl %eax; pushl %ecx; pushl %edx; \ + call Lmcount$stub; \ + popl %edx; popl %ecx; popl %eax; popl %ebp +#define PROFILE_C \ + pushl %ebp; movl %esp, %ebp; call Lmcount$stub; popl %ebp #endif #else #define PROFILE_CAML @@ -368,3 +375,11 @@ G(caml_extra_params): #else .zero 64 #endif + +#if defined(PROFILING) && defined(SYS_macosx) + .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 +Lmcount$stub: + .indirect_symbol mcount + hlt ; hlt ; hlt ; hlt ; hlt + .subsections_via_symbols +#endif @@ -674,6 +674,7 @@ case "$arch,$model,$system" in i386,*,linux_elf) profiling='prof';; i386,*,gnu) profiling='prof';; i386,*,bsd_elf) profiling='prof';; + i386,*,macosx) profiling='prof';; sparc,*,solaris) profiling='prof' case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;; |