anchor.diff:  	   "please regenerate native code for this runtime system\n", [Mod]),
         bad_crc;
       true ->
  +      put(closures_to_patch, []),
         %% Create data segment
         {ConstAddr,ConstMap2} =
   	create_data_segment(ConstAlign, ConstSize, ConstMap),
  
positive.code:       %% Patch all dynamic references in the code.
        %%  Function calls, Atoms, Constants, System calls
        ok = patch(Refs, CodeAddress, ConstMap2, Addresses, TrampolineMap),
        %% Tell the system where the loaded funs are. 
        %%  (patches the BEAM code to redirect to native.)
        case Beam of
  	[] ->
  	  export_funs(Addresses),
  	  ok;
  	BeamBinary when is_binary(BeamBinary) ->
  	  %% Find all closures in the code.
  	  ClosurePatches = find_closure_patches(Refs),
  	  AddressesOfClosuresToPatch =
  	    calculate_addresses(ClosurePatches, CodeAddress, Addresses),
  
negative.code:       %% The call to export_funs/1 above updated the native addresses
        %% for the targets, so passing 'Addresses' is not needed.
        redirect(ReferencesToPatch),
        %% Final clean up.
        _ = erase(hipe_patch_closures),
        _ = erase(hipe_assert_code_area),
        ?debug_msg("****************Loader Finished****************\n", []),
        {module,Mod}  % for compatibility with code:load_file/1
    end.
  