diff options
author | Alain Frisch <alain@frisch.fr> | 2012-07-16 10:36:00 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2012-07-16 10:36:00 +0000 |
commit | 95107f7baecf20457f8b8ef40fcd40dec57a7e31 (patch) | |
tree | f2ee30f0a232851a4068974dd26bca1960175966 /byterun/fix_code.c | |
parent | e17f1f82f251d0bf645f440d3c78ba8811902b04 (diff) | |
download | ocaml-95107f7baecf20457f8b8ef40fcd40dec57a7e31.tar.gz |
#5687: Fix dynlink when used from output-obj'ed main bytecode program.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12714 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/fix_code.c')
-rw-r--r-- | byterun/fix_code.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/byterun/fix_code.c b/byterun/fix_code.c index ac519f7156..67f9e96ae2 100644 --- a/byterun/fix_code.c +++ b/byterun/fix_code.c @@ -37,15 +37,8 @@ unsigned char * caml_saved_code; /* Read the main bytecode block from a file */ -void caml_load_code(int fd, asize_t len) -{ - int i; +void caml_init_code_fragments() { struct code_fragment * cf; - - caml_code_size = len; - caml_start_code = (code_t) caml_stat_alloc(caml_code_size); - if (read(fd, (char *) caml_start_code, caml_code_size) != caml_code_size) - caml_fatal_error("Fatal error: truncated bytecode file.\n"); /* Register the code in the table of code fragments */ cf = caml_stat_alloc(sizeof(struct code_fragment)); cf->code_start = (char *) caml_start_code; @@ -54,6 +47,17 @@ void caml_load_code(int fd, asize_t len) cf->digest_computed = 1; caml_ext_table_init(&caml_code_fragments_table, 8); caml_ext_table_add(&caml_code_fragments_table, cf); +} + +void caml_load_code(int fd, asize_t len) +{ + int i; + + caml_code_size = len; + caml_start_code = (code_t) caml_stat_alloc(caml_code_size); + if (read(fd, (char *) caml_start_code, caml_code_size) != caml_code_size) + caml_fatal_error("Fatal error: truncated bytecode file.\n"); + caml_init_code_fragments(); /* Prepare the code for execution */ #ifdef ARCH_BIG_ENDIAN caml_fixup_endianness(caml_start_code, caml_code_size); |