This is the mail archive of the
mailing list for the glibc project.
Re: x86-64 prelink support for TLS dialect gnu2
On Mon, 5 Nov 2018, 19:32 Steven Newbury <firstname.lastname@example.org
> On 05/11/2018, Szabolcs Nagy <Szabolcs.Nagy@arm.com> wrote:
> > On 05/11/18 16:21, Steven Newbury wrote:
> >> I'm working on gettting TLS gnu2 dialect support working for x86-64
> >> with prelink. Yes, it's still maintained, see:
> >> https://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/
> > prelinking for tlsdesc was never supported in ld.so
> > on any target.
> > at some point arm had support in case of lazy binding,
> > but now lazy binding of tlsdesc is disabled on arm
> > so that code got removed:
> I've been comparing the removed code to what is currently in the
> x86_64 dl-machine.h and it's almost identical, which makes sense since
> x86_64 still supports lazy binding of tlsdesc AFAIK. The only notable
> difference that I see is:
> Removed ARM support code
> - if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
> - *(Elf32_Addr*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) +
> - = (Elf32_Addr) &_dl_tlsdesc_lazy_resolver;
> Currently in x86_64
> if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy)
> *(ElfW(Addr)*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr)
> = (ElfW(Addr)) &_dl_tlsdesc_resolve_rela;
> Am I looking in the right place?
I think not, since that snippet predates the prelink support.
>From the reverted ARM prelink patch it's clear the magic is in the
by RESOLVE_CONFLICT_FIND_MAP. The x86_64 code already handles several
different cases of R_X86_64_TLSDESC in that switch so I still don't
understand how it falls through to _dl_reloc_bad_type rather than just
ignoring the prelink suppliied address. Most of the ARM patch
consists of asserts presumably because the code wasn't fully trusted.