This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions about powerpc __tls_get_addr optimization


On Fri, Oct 12, 2018 at 10:08:30AM -0400, Rich Felker wrote:
> I meant at startup; rather I was asking if there's a possibility that
> the second slot contains something other than a 0 (indicating
> __tls_get_addr should return a pointer 0x8000 into the TLS space of
> the module identified by the modid). For example, it seems conceivable
> that asm that wanted a pointer to the start of the TLS space could put
> -0x8000 in the offset position so that __tls_get_addr would return
> that, and if the dynamic linker clobbered it when setting up the
> (0,tprel) form, that would get lost.

Yes, that is possible but unlikely.  Another concern if you are
thinking about adapting the PowerPC scheme to other targets, without
some tag from the linker, is that dynamic relocations are not needed
in the executable on the tls_index words for a General Dynamic TLS
access to a locally defined TLS variable.  Of course, such access
sequences are generally edited to a Local Exec TLS sequence if the
linker implements TLS code editing.  So if the linker does not
implement TLS editing (or the editing is disabled), and the linker
happens to emit a dynamic DTPMOD relocation unnecessarily but not a
dynamic DTPREL relocation, then you have your scenario where it's
wrong for the DTPMOD to modify the second tls_index word.

The presence of the PPC64_OPT_TLS dynamic tag bit asserts that the
linker hasn't introduced such silliness with dynamic relocations.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]