This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: TLS transition error
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Friday, February 19, 2010 4:44 PM
> To: King, Steven R
> Cc: binutils@sourceware.org
> Subject: Re: TLS transition error
>
> From: "King, Steven R" <steven.r.king@intel.com>
> Date: Fri, 19 Feb 2010 16:36:26 -0800
>
> > libc.a(malloc.o): TLS transition from R_386_TLS_IE to R_386_TLS_LE_32
> against `__libc_tsd_MALLOC' at 0x9c in section `.text' failed
> > libc.a: could not read symbols: Bad value
> >
> > I did an objdump -x of malloc.o and libc.a but don't see R_386_TLS_LE_32
> anywhere.
> >
> > I've stepped through the BFD code around the error, but there are many
> mystery constants in play and I am not making much progress.
> >
> > Can someone please point me in the right direction?
>
> The R_386_TLS_LE_32 relocation is being produced internally by the
> i386 BFD backend during linking when it optimizes TLS relocations.
>
> Start by studying elf_i386_tls_transition().
Thank you for the help. elf_i386_tls_transition() eventually calls elf_i386_check_tls_transition(), which eventually returns false (failure) in the case statement below. Where do I look to understand the meaning of 0xa1, 0x8b and x3 comparison values? At runtime, my val = 0x3D and type = 0x2B. What do these values imply?
Thanks again for help!
-steve
case R_386_TLS_IE:
/* Check transition from IE access model:
movl foo@indntpoff(%rip), %eax
movl foo@indntpoff(%rip), %reg
addl foo@indntpoff(%rip), %reg
*/
if (offset < 1 || (offset + 4) > sec->size)
return FALSE;
/* Check "movl foo@tpoff(%rip), %eax" first. */
val = bfd_get_8 (abfd, contents + offset - 1);
if (val == 0xa1)
return TRUE;
if (offset < 2)
return FALSE;
/* Check movl|addl foo@tpoff(%rip), %reg. */
type = bfd_get_8 (abfd, contents + offset - 2);
return ((type == 0x8b || type == 0x03)
&& (val & 0xc7) == 0x05);