1 /**************************************************************************/
2 /*                                                                        */
3 /*                                 OCaml                                  */
4 /*                                                                        */
5 /*             Xavier Leroy, projet Cristal, INRIA Rocquencourt           */
6 /*                                                                        */
7 /*   Copyright 1996 Institut National de Recherche en Informatique et     */
8 /*     en Automatique.                                                    */
9 /*                                                                        */
10 /*   All rights reserved.  This file is distributed under the terms of    */
11 /*   the GNU Lesser General Public License version 2.1, with the          */
12 /*   special exception on linking described in the file LICENSE.          */
13 /*                                                                        */
14 /**************************************************************************/
15 
16 /* exec.h : format of executable bytecode files */
17 
18 #ifndef CAML_EXEC_H
19 #define CAML_EXEC_H
20 
21 #ifdef CAML_INTERNALS
22 
23 /* Executable bytecode files are composed of a number of sections,
24    identified by 4-character names.  A table of contents at the
25    end of the file lists the section names along with their sizes,
26    in the order in which they appear in the file:
27 
28    offset 0 --->  initial junk
29                   data for section 1
30                   data for section 2
31                   ...
32                   data for section N
33                   table of contents:
34                     descriptor for section 1
35                     ...
36                     descriptor for section N
37                   trailer
38  end of file --->
39 */
40 
41 /* Structure of t.o.c. entries
42    Numerical quantities are 32-bit unsigned integers, big endian */
43 
44 struct section_descriptor {
45   char name[4];                 /* Section name */
46   uint32_t len;                   /* Length of data in bytes */
47 };
48 
49 /* Structure of the trailer. */
50 
51 struct exec_trailer {
52   uint32_t num_sections;          /* Number of sections */
53   char magic[12];               /* The magic number */
54   struct section_descriptor * section; /* Not part of file */
55 };
56 
57 #define TRAILER_SIZE (4+12)
58 
59 /* Magic number for this release */
60 
61 #define EXEC_MAGIC "Caml1999X011"
62 
63 #endif /* CAML_INTERNALS */
64 
65 #endif /* CAML_EXEC_H */
66