anchor.diff:  %% -record(ref, {caller_mfa, address, ref_type, trampoline, remote_or_local}).
   %%
   
  -add_ref(CalleeMFA, Address, Addresses, RefType, Trampoline, RemoteOrLocal) ->
  -  CallerMFA = address_to_mfa_lth(Address, Addresses),
  +add_ref(CalleeMFA, Address, FunDefs, RefType, Trampoline, RemoteOrLocal) ->
  +  CallerMFA = address_to_mfa_lth(Address, FunDefs),
     %% just a sanity assertion below
     true = case RemoteOrLocal of
   	   local ->
  
positive.code:   patch_bif_call_list(Offsets, BaseAddress, BifAddress, Trampoline);
  patch_bif_call_list([], _, _, _) -> ok.
  
  patch_mfa_call_list([Offset|Offsets], BaseAddress, DestMFA, DestAddress, Addresses, RemoteOrLocal, Trampoline) ->
    CallAddress = BaseAddress+Offset,
    add_ref(DestMFA, CallAddress, Addresses, 'call', Trampoline, RemoteOrLocal),
    ?ASSERT(assert_local_patch(CallAddress)),
    patch_call_insn(CallAddress, DestAddress, Trampoline),
    patch_mfa_call_list(Offsets, BaseAddress, DestMFA, DestAddress, Addresses, RemoteOrLocal, Trampoline);
  patch_mfa_call_list([], _, _, _, _, _, _) -> ok.
  
  patch_call_insn(CallAddress, DestAddress, Trampoline) ->
  
negative.code: %%  (we use this to look up the address of a referred function only once).
  %%
  
  patch([{Type,SortedRefs}|Rest], CodeAddress, ConstMap2, FunDefs, TrampolineMap) ->
    ?debug_msg("Patching ~w at [~w+offset] with ~w\n",
  	     [Type,CodeAddress,SortedRefs]),
    case ?EXT2PATCH_TYPE(Type) of 
      call_local -> 
        patch_call(SortedRefs, CodeAddress, FunDefs, 'local', TrampolineMap);
      call_remote ->
        patch_call(SortedRefs, CodeAddress, FunDefs, 'remote', TrampolineMap);
      Other -> 
        patch_all(Other, SortedRefs, CodeAddress, {ConstMap2,CodeAddress}, FunDefs)
    end,
    patch(Rest, CodeAddress, ConstMap2, FunDefs, TrampolineMap);
  patch([], _, _, _, _) -> ok.
  
  %%----------------------------------------------------------------
  %% Handle a 'call_local' or 'call_remote' patch.
  %%
  patch_call([{DestMFA,Offsets}|SortedRefs], BaseAddress, FunDefs, RemoteOrLocal, TrampolineMap) ->
    case bif_address(DestMFA) of
      false ->
        %% Previous code used mfa_to_address(DestMFA, FunDefs)
        %% here for local calls. That is wrong because even local
        %% destinations may not be present in FunDefs: they may
        %% not have been compiled yet, or they may be BEAM-only
        %% functions (e.g. module_info).
        DestAddress = get_native_address(DestMFA, FunDefs, RemoteOrLocal),
        Trampoline = trampoline_map_get(DestMFA, TrampolineMap),
        patch_mfa_call_list(Offsets, BaseAddress, DestMFA, DestAddress, FunDefs, RemoteOrLocal, Trampoline);
      BifAddress when is_integer(BifAddress) ->
        Trampoline = trampoline_map_lookup(DestMFA, TrampolineMap),
        patch_bif_call_list(Offsets, BaseAddress, BifAddress, Trampoline)
    end,
    patch_call(SortedRefs, BaseAddress, FunDefs, RemoteOrLocal, TrampolineMap);
  patch_call([], _, _, _, _) ->
    ok.
  
  