diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2003-05-26 13:46:36 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2003-05-26 13:46:36 +0000 |
commit | 78a25aa7d6a01c183afe483f643cb28812e19425 (patch) | |
tree | 7e1c34696991fd8b2d433a434fb1a5ba8a9895fc /otherlibs/dynlink | |
parent | fc47a7d6accf696cf7b4a8042aeda621ab6a7119 (diff) | |
download | ocaml-78a25aa7d6a01c183afe483f643cb28812e19425.tar.gz |
Deplacement de check_global_references dans Symtable
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5585 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/dynlink')
-rw-r--r-- | otherlibs/dynlink/dynlink.ml | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/otherlibs/dynlink/dynlink.ml b/otherlibs/dynlink/dynlink.ml index d8806d0a16..2d4047a615 100644 --- a/otherlibs/dynlink/dynlink.ml +++ b/otherlibs/dynlink/dynlink.ml @@ -144,26 +144,6 @@ let check_unsafe_module cu = if (not !unsafe_allowed) && cu.cu_primitives <> [] then raise(Error(Unsafe_file)) -(* Check that all globals referenced in the object file have been - initialized already *) - -let check_global_references file_name patchlist = - (* First determine the globals we will define *) - let defined_globals = ref [] in - let add_defined = function - (Reloc_setglobal id, pos) -> defined_globals := id :: !defined_globals - | _ -> () in - List.iter add_defined patchlist; - (* Then check that all referenced, not defined globals have a value *) - let check_reference = function - (Reloc_getglobal id, pos) -> - if not (List.mem id !defined_globals) - && Obj.is_int (Symtable.get_global_value id) then - raise(Error(Linking_error(file_name, - Uninitialized_global(Ident.name id)))) - | _ -> () in - List.iter check_reference patchlist - (* Load in-core and execute a bytecode object file *) let load_compunit ic file_name compunit = @@ -184,13 +164,14 @@ let load_compunit ic file_name compunit = let initial_symtable = Symtable.current_state() in begin try Symtable.patch_object code compunit.cu_reloc; - check_global_references file_name compunit.cu_reloc; + Symtable.check_global_initialized compunit.cu_reloc; Symtable.update_global_table() with Symtable.Error error -> let new_error = match error with Symtable.Undefined_global s -> Undefined_global s | Symtable.Unavailable_primitive s -> Unavailable_primitive s + | Symtable.Uninitialized_global s -> Uninitialized_global s | _ -> assert false in raise(Error(Linking_error (file_name, new_error))) end; |