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

Bernd Petrovitsch bernd at petrovitsch.priv.at
Wed Nov 2 14:38:41 UTC 2011


On Mit, 2011-11-02 at 09:44 -0400, Rich Felker wrote:
> On Wed, Nov 02, 2011 at 01:20:56PM +0100, Bernd Petrovitsch wrote:
> > Hmm, why not just
> > ---- snip  ----
> > --- 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;
> > +		void * tmp = 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",
> > ---- snip  ----
> > as that's actually the type of l_tls_initimage?
> 
> Because it's being used in a printf-type format string where the type
> does not match. The type does not match unsigned long either,
> however...

Yes, the format string should better be
	"Relocated TLS initial image from %p to %p (size = %x)\n"
IMHO.

Hmm, is there some value to look at the warnings from gcc and fix them
(and not with type casts)?
And than to add/use further gcc features like
__attribute__((format(printf,...,...))) and more warnings?

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at



More information about the uClibc mailing list