This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Questions about powerpc __tls_get_addr optimization
- From: Rich Felker <dalias at libc dot org>
- To: Alan Modra <amodra at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 11 Oct 2018 17:26:54 -0400
- Subject: Questions about powerpc __tls_get_addr optimization
Alan, can you (or anyone) shed some light on why the DT_PPC_OPT flag
is needed for the dynamic linker to be able to apply your
__tls_get_addr optimization? Assuming the dynamic linker implements
the real function __tls_get_addr, it could do the same modid==0 check
itself, without needing assistance from ld.
My concern with doing this would be that there's no relocation on the
second (offset) slot when the local-dynamic model is used, and I
thought ld would be doing something special to account for this when
the optimization is used, but apparently your code in the glibc
dynamic linker just ignores this and fills in both slots when
processing the R_PPC64_DTPMOD64 relocation. Is this valid, i.e. is is
valid to assume that a corresponding R_PPC64_DTPREL64 relocation will
come after the R_PPC64_DTPMOD64 relocation, if there is one? Is this
assumption valid for other targets as well?
Are there other reasons I'm missing that DT_PPC_OPT is needed in order
for it to be valid for the dynamic linker to use this technique? Or is
it just that you only wanted to implement the zero check in the PLT
stub and not repeat it in the __tls_get_addr function?
Rich