2016-02-18 07:11:59 -08:00
|
|
|
/**************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* OCaml */
|
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
|
|
|
/* en Automatique. */
|
|
|
|
/* */
|
|
|
|
/* All rights reserved. This file is distributed under the terms of */
|
|
|
|
/* the GNU Lesser General Public License version 2.1, with the */
|
|
|
|
/* special exception on linking described in the file LICENSE. */
|
|
|
|
/* */
|
|
|
|
/**************************************************************************/
|
1995-08-09 08:06:35 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
/* exec.h : format of executable bytecode files */
|
|
|
|
|
2003-12-15 10:10:51 -08:00
|
|
|
#ifndef CAML_EXEC_H
|
|
|
|
#define CAML_EXEC_H
|
2001-02-19 04:29:00 -08:00
|
|
|
|
2016-07-04 10:00:57 -07:00
|
|
|
#ifdef CAML_INTERNALS
|
|
|
|
|
2000-03-05 11:18:50 -08:00
|
|
|
/* Executable bytecode files are composed of a number of sections,
|
|
|
|
identified by 4-character names. A table of contents at the
|
|
|
|
end of the file lists the section names along with their sizes,
|
|
|
|
in the order in which they appear in the file:
|
|
|
|
|
|
|
|
offset 0 ---> initial junk
|
|
|
|
data for section 1
|
|
|
|
data for section 2
|
|
|
|
...
|
|
|
|
data for section N
|
|
|
|
table of contents:
|
|
|
|
descriptor for section 1
|
|
|
|
...
|
|
|
|
descriptor for section N
|
|
|
|
trailer
|
1995-05-04 03:15:53 -07:00
|
|
|
end of file --->
|
|
|
|
*/
|
|
|
|
|
2000-03-05 11:18:50 -08:00
|
|
|
/* Structure of t.o.c. entries
|
|
|
|
Numerical quantities are 32-bit unsigned integers, big endian */
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-03-05 11:18:50 -08:00
|
|
|
struct section_descriptor {
|
|
|
|
char name[4]; /* Section name */
|
2014-08-27 02:58:33 -07:00
|
|
|
uint32_t len; /* Length of data in bytes */
|
2000-03-05 11:18:50 -08:00
|
|
|
};
|
|
|
|
|
2018-05-15 06:15:06 -07:00
|
|
|
#define EXEC_MAGIC_LENGTH 12
|
|
|
|
|
2000-03-05 11:18:50 -08:00
|
|
|
/* Structure of the trailer. */
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
struct exec_trailer {
|
2018-05-15 06:15:06 -07:00
|
|
|
uint32_t num_sections; /* Number of sections */
|
|
|
|
char magic[EXEC_MAGIC_LENGTH]; /* The magic number */
|
2000-03-05 11:18:50 -08:00
|
|
|
struct section_descriptor * section; /* Not part of file */
|
1995-05-04 03:15:53 -07:00
|
|
|
};
|
|
|
|
|
2018-05-15 06:15:06 -07:00
|
|
|
#define TRAILER_SIZE (4+EXEC_MAGIC_LENGTH)
|
2000-03-05 11:18:50 -08:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
/* Magic number for this release */
|
|
|
|
|
2020-10-19 06:33:26 -07:00
|
|
|
#define EXEC_MAGIC "Caml1999X029"
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2016-07-04 10:00:57 -07:00
|
|
|
#endif /* CAML_INTERNALS */
|
2001-02-19 04:29:00 -08:00
|
|
|
|
2003-12-15 10:10:51 -08:00
|
|
|
#endif /* CAML_EXEC_H */
|