[PATCH 1/2] ldso: fix pointer width problem with debug statement

William Pitcock nenolod at dereferenced.org
Tue Nov 1 22:48:49 UTC 2011


On 64-bit platforms, the compiler copies a 64-bit memory address into
an unsigned int, which is 32 bits wide.  This should be unsigned long,
because unsigned long will always be the width of a long pointer, which
is 64-bit on 64-bit platforms instead of 32-bit.

Signed-off-by: William Pitcock <nenolod at dereferenced.org>
---
 ldso/ldso/ldso.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index fe463b7..1308f22 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -738,7 +738,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 	 * case the executable is actually an ET_DYN object.
 	 */
 	if (app_tpnt->l_tls_initimage != NULL) {
-		unsigned int tmp = (unsigned int) app_tpnt->l_tls_initimage;
+		unsigned long tmp = (unsigned long) app_tpnt->l_tls_initimage;
 		app_tpnt->l_tls_initimage =
 			(char *) app_tpnt->l_tls_initimage + app_tpnt->loadaddr;
 		_dl_debug_early("Relocated TLS initial image from %x to %x (size = %x)\n",
-- 
1.7.7.1



More information about the uClibc mailing list