For a module of finite length $M$ over a principal ideal domain $A$, we have $\mathrm{Hom}(M,A)=0$, and $\mathrm{Ext}^1(M,A)$ (the *dual* of $A$, see Bourbaki, *Algebra* VII, §4, No. 9) is non-canonically isomorphic to $M$. Therefore $\chi (\mathrm{RHom}(M,A))=-\mathrm{length}\,(\mathrm{Ext}^1(M,A))=-\chi (M)$.