|
From: <sv...@va...> - 2006-01-20 21:45:42
|
Author: sewardj
Date: 2006-01-20 21:45:36 +0000 (Fri, 20 Jan 2006)
New Revision: 5576
Log:
ppc64-linux: compute the correct initial program counter and tocptr
when the interpreter is loaded at a different address than what it
asked for.
Modified:
trunk/coregrind/m_ume.c
Modified: trunk/coregrind/m_ume.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_ume.c 2006-01-20 16:48:31 UTC (rev 5575)
+++ trunk/coregrind/m_ume.c 2006-01-20 21:45:36 UTC (rev 5576)
@@ -329,6 +329,11 @@
void *entry;
ESZ(Addr) ebase =3D 0;
=20
+ /* The difference between where the interpreter got mapped and
+ where it asked to be mapped. Needed for computing the ppc64 ELF
+ entry point and initial tocptr (R2) value. */
+ ESZ(Word) interp_offset =3D 0;
+
#ifdef HAVE_PIE
ebase =3D info->exe_base;
#endif
@@ -484,6 +489,7 @@
=20
entry =3D (void *)(advised - interp_addr + interp->e.e_entry);
info->interp_base =3D (ESZ(Addr))advised;
+ interp_offset =3D advised - interp_addr;
=20
VG_(free)(interp->p);
VG_(free)(interp);
@@ -500,6 +506,8 @@
is the static chain value. */
info->init_ip =3D ((ULong*)entry)[0];
info->init_toc =3D ((ULong*)entry)[1];
+ info->init_ip +=3D interp_offset;
+ info->init_toc +=3D interp_offset;
#else
info->init_ip =3D (Addr)entry;
info->init_toc =3D 0; /* meaningless on this platform */
|