[PATCH 2/2] libdl: fix pointer-width problems with _dl_tls_symaddr() calls.

Mike Frysinger vapier at gentoo.org
Sun Nov 27 01:35:49 UTC 2011


On Tuesday 01 November 2011 18:51:02 William Pitcock wrote:
> Casting a pointer to Elf32_Addr type will discard 32 bits from the
> pointer address.  Using unsigned long ensures that a pointer is 64-bit
> safe.
>
> --- a/ldso/libdl/libdl.c
> +++ b/ldso/libdl/libdl.c
>
>		ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt,
>		ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt,
> -					(Elf32_Addr) ret);
> +					(unsigned long) ret);

i don't think this works.  the _dl_tls_symaddr() func still takes an 
Elf32_Addr argument, so it still gets implicitly cast from unsigned long to 
Elf32_Addr.

so if this is going to be fixed, you'd want to use ElfW(Addr) in both places as 
suggested by Carmelo.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20111126/8c53beec/attachment-0001.asc>


More information about the uClibc mailing list