anchor.diff:        %% address into the fun entry to ensure that the native code cannot
         %% be called until it has been completely fixed up.
         RemoteOrLocal = local, % closure code refs are local
  -      DestAddress = get_native_address(DestMFA, Addresses, RemoteOrLocal),
  +      DestAddress = get_native_address(DestMFA, FunDefs, RemoteOrLocal),
         BEAMAddress = hipe_bifs:fun_to_address(DestMFA),
         FE = hipe_bifs:get_fe(mod(DestMFA), {Uniq, Index, BEAMAddress}),
         put(closures_to_patch, [{FE,DestAddress}|get(closures_to_patch)]),
  
positive.code: exports(ExportMap, BaseAddress) ->
    exports(ExportMap, BaseAddress, [], []).
  
  exports([Offset,M,F,A,IsClosure,IsExported|Rest], BaseAddress, MFAs, Addresses) ->
    case IsExported andalso erlang:is_builtin(M, F, A) of
      true ->
        exports(Rest, BaseAddress, MFAs, Addresses);
      _false ->
        MFA = {M,F,A},
        Address = BaseAddress + Offset,
        FunDef = #fundef{address=Address, mfa=MFA, is_closure=IsClosure,
  		       is_exported=IsExported},
        exports(Rest, BaseAddress, [MFA|MFAs], [FunDef|Addresses])
    end;
  exports([], _, MFAs, Addresses) ->
    {MFAs, Addresses}.
  
  mod({M,_F,_A}) -> M.
  
  %%------------------------------------------------------------------------
  
  calculate_addresses(PatchOffsets, Base, Addresses) ->
    RemoteOrLocal = local, % closure code refs are local
    [{Data,
      offsets_to_addresses(Offsets, Base),
      get_native_address(DestMFA, Addresses, RemoteOrLocal)} || 
      {{DestMFA,_,_}=Data,Offsets} <- PatchOffsets].
  
  offsets_to_addresses(Os, Base) ->
  
negative.code: 	  lists:foreach(fun({FE, DestAddress}) ->
  			    hipe_bifs:set_native_address_in_fe(FE, DestAddress)
  			end, erase(closures_to_patch)),
  	  export_funs(FunDefs),
  	  ok;
  	BeamBinary when is_binary(BeamBinary) ->
  	  %% Find all closures in the code.
  	  [] = erase(closures_to_patch),	%Clean up, assertion.
  	  ClosurePatches = find_closure_patches(Refs),
  	  AddressesOfClosuresToPatch =
  	    calculate_addresses(ClosurePatches, CodeAddress, FunDefs),
  	  export_funs(FunDefs),
  	  export_funs(Mod, MD5, BeamBinary,
                        FunDefs, AddressesOfClosuresToPatch)
        end,
        %% Redirect references to the old module to the new module's BEAM stub.
        patch_to_emu_step2(OldReferencesToPatch),
        %% Patch referring functions to call the new function
        %% The call to export_funs/1 above updated the native addresses
        %% for the targets, so passing 'FunDefs' is not needed.
        redirect(ReferencesToPatch),
        %% Final clean up.
        _ = erase(hipe_patch_closures),
  