caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Carr <jfc@MIT.EDU>
To: Normand <normand@linux.vnet.ibm.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Where is defined the caml_program initial entry point called from asmrun/*/
Date: Fri, 28 Mar 2014 07:59:18 -0400	[thread overview]
Message-ID: <201403281159.s2SBxI0E022524@outgoing.mit.edu> (raw)
In-Reply-To: <5335584E.5080908@linux.vnet.ibm.com>


The result of an ocaml program is the side effect of loading
(initializing) all modules.  Cmmgen.entry_point generates a function
called caml_program that runs the module initializer functions of
everything you link.  If you need to see the exact assembly code
you can use -S to save the assembly file with this generated function.
It may be in /tmp.

Make sure you understand asmrun/stack.h, which defines part of the
binary interface between compiler and runtime and between runtime
C and assembly code.  If the definitions don't match your program may
crash when it throws an exception or garbage collects.

> 
> I still have problems while porting ocaml on ppc64le archi. I was able to generate the ocamlcompopt, but obviously with missing changes because the first trial is segfault.
> 
> Investigating the failure with gdb I was able to trace the code from "caml_start_program" calling "caml_program"
> https://git.fedorahosted.org/cgit/fedora-ocaml.git/tree/asmrun/power64-elf.S#n350
> (url without my own patches)
> 
> But I am not able to find the source code associated to the "caml_program"
> 
> Could somebody give me a clue ? I guess this is generated with help of asmcomp/*/emit.mlp
> and may be the asmcomp/cmmgen.ml  but the generated asmcom/cmmgen.s do not match the disassemble code displayed via gdb.
> 
> 
> -- 
> Michel Normand
> 
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

      reply	other threads:[~2014-03-28 11:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 15:53 [Caml-list] need help to investigate an ocaml build error on ppc64le archi Normand
2014-03-20 18:36 ` Normand
2014-03-22 12:20 ` Richard W.M. Jones
2014-03-22 12:24 ` Richard W.M. Jones
2014-03-28 11:09   ` [Caml-list] Where is defined the caml_program initial entry point called from asmrun/*/ Normand
2014-03-28 11:59     ` John Carr [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201403281159.s2SBxI0E022524@outgoing.mit.edu \
    --to=jfc@mit.edu \
    --cc=caml-list@inria.fr \
    --cc=normand@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).