Message from discussion
Bytecode object files structure
Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!out03a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!news2.euro.net!newsfeed.freenet.de!border2.nntp.ams.giganews.com!nntp.giganews.com!uio.no!nntp.uio.no!not-for-mail
From: Pierre-Etienne Meunier <pierreetienne.meun...@ens-lyon.fr>
Newsgroups: fa.caml
Subject: Re: [Caml-list] Bytecode object files structure
Date: Mon, 13 Nov 2006 11:41:53 UTC
Organization: Internet mailing list
Lines: 75
Sender: caml-list-boun...@yquem.inria.fr
Message-ID: <fa.u7i3U76NhcS7WsYo2+Dab37m7Ss@ifi.uio.no>
References: <fa.jDbMz1arpMl1okwtiwJSDnQmfkA@ifi.uio.no> <fa.AUAW4vQWQcldUjZ/xJSuokJya90@ifi.uio.no>
NNTP-Posting-Host: jess.uio.no
Mime-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: readme.uio.no 1163418113 16995 129.240.10.48 (13 Nov 2006 11:41:53 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Mon, 13 Nov 2006 11:41:53 +0000 (UTC)
To: Xavier Clerc <xcfo...@free.fr>
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled
version=3.1.3
X-Original-To: caml-l...@yquem.inria.fr
Delivered-To: caml-l...@yquem.inria.fr
User-Agent: KMail/1.7.2
In-Reply-To: <968382EE-B8CB-452C-A86F-684879E33798@free.fr>
Content-Disposition: inline
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ens-lyon.fr
X-Miltered: at concorde with ID 45585851.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)!
X-Miltered: at discorde with ID 45585845.000 by Joe's j-chkmail
(http://j-chkmail.ensmp.fr)!
X-Spam: no; 0.00;
ens-lyon:01 bytecode:01 compiler:01 bytecode:01 compilation:01
ocaml:01 cmo:01 cmi:01 cmo:01 ocaml:01 vaguely:01 ens-lyon:01
beginner's:01 bug:01 cordially:98
X-BeenThere: caml-l...@yquem.inria.fr
X-Mailman-Version: 2.1.5
List-Id: Caml users' mailing list <caml-list.yquem.inria.fr>
List-Unsubscribe: <http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list>,
<mailto:caml-list-requ...@yquem.inria.fr?subject=unsubscribe>
List-Post: <mailto:caml-l...@yquem.inria.fr>
List-Help: <mailto:caml-list-requ...@yquem.inria.fr?subject=help>
List-Subscribe: <http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list>,
<mailto:caml-list-requ...@yquem.inria.fr?subject=subscribe>
Original-CC: caml-l...@yquem.inria.fr
Original-Date: Mon, 13 Nov 2006 12:36:29 +0100
Original-Message-Id: <200611131236.30129.pierreetienne.meun...@ens-lyon.fr>
Original-References: <200611121542.30370.pierreetienne.meun...@ens-lyon.fr>
<968382EE-B8CB-452C-A86F-684879E33...@free.fr>
Hello,
I'd like to write an assembler, to be able to understand how the vm really
works. I've to work on this for a school project (a compiler, I want it to
output caml bytecode object files).
I've understood that the data part, after the code itself, was generated using
output_value (I didn't know this function before). What I don't get now are
the cu_reloc, cu_primitives and cu_imports fields of the compilation_unit
type.
If you can help on this,
Thanks
P.E. Meunier
On Monday 13 November 2006 11:53, Xavier Clerc wrote:
> Hello,
>
> As I read a substancial part of the ocaml source code, I may help you
> understanding file formats.
> Could you be more precise about what you are particularly interested
> in :
> - file type : bytecode file, cmo file, cmi file ?
> - code or data section of these files ?
>
> May I also ask you what you are trying to do using these elements ?
>
>
> Cordially,
>
> Xavier Clerc
>
> Le 12 nov. 06 à 15:42, Pierre-Etienne Meunier a écrit :
> > Hi,
> >
> > I'm trying to decrypt .cmo files produced by simple programs, such as
> > 1+1;;
> > or
> > print_string "string";;
> > or
> > List.length [1;2;3;4;5];;
> >
> > According to the source of Ocaml, there's something called the
> > "cmo_magic_number", systematically written at the beginning of
> > all .cmo
> > files. Does it have a real function for executing the programs, or
> > is it just
> > a way to make sure the file contains ocaml bytecode ?
> >
> > Then, there's the address of what seems to be the last bytecode
> > instruction.
> > Then, the bytecode instructions, as documented in opcodes.ml.
> >
> > After that, I can't understand anything : there vaguely seems to be
> > some
> > information related to linking or so... What is the precise
> > structure of this
> > part ? Is there some kind of a bytecode assembler ?
> >
> > Thanks,
> > P.E. Meunier (pierreetienne.meun...@ens-lyon.fr)
> >
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs