RFC: TLS improvements for IA32 and AMD64/EM64T

Alexandre Oliva aoliva@redhat.com
Mon Feb 6 16:32:00 GMT 2006


On Sep 22, 2005, Alexandre Oliva <aoliva@redhat.com> wrote:

> On Sep 17, 2005, Alexandre Oliva <aoliva@redhat.com> wrote:
>> On Sep 16, 2005, Alexandre Oliva <aoliva@redhat.com> wrote:
>>> On Sep 16, 2005, Alexandre Oliva <aoliva@redhat.com> wrote:
>>>> Over the past few months, I've been working on porting to IA32 and
>>>> AMD64/EM64T the interesting bits of the TLS design I came up with for
>>>> FR-V, achieving some impressive speedups along with slight code size
>>>> reductions in the most common cases.

>>>> Although the design is not set in stone yet, it's fully implemented
>>>> and functional with patches I'm about to post for binutils, gcc and
>>>> glibc mainline, as follow-ups to this message, except that the GCC
>>>> patch will go to gcc-patches, as expected.

>>> This is the glibc portion of the implementation.  I've built it for
>>> amd64-linux-gnu and i686-pc-linux-gnu, with both the current TLS
>>> dialect and the new -mtls-dialect=gnu2, without regressions.

>> Revised patch using new relocation and dynamic entry numbers.  Tested
>> again on all 4 combinations mentioned above.

> Revised patch that does not include other changes, fixes a few
> inconsistent uses of addends here and there (copy&pastos), avoids
> crashing when lazily resolving TLSDESC relocations to weak symbols
> that turn out to be undefined, and, as a bonus, handles them correctly
> such that their address does map to NULL for all threads.  I know
> people shouldn't rely on this, since the linker may very well break
> it, but hey, since I was already tweaking the code to avoid crashes,
> why not take the final step and make it work as closely as possible to
> a random person's expectations? :-)

> Index: ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.com>

> 	Introduce TLS descriptors for i386 and x86_64.

binutils 2.17 and GCC 4.2 will be able to generate code conforming to
this ABI extension, so ideally GLIBC should be able to support the
corresponding relocations.  The patch has been pending for a while and
AFAIK it was not even reviewed yet :-(

This was re-tested with yesterday's glibc tree, using GCC and binutils
trunks as of one or two weeks ago, no regressions on 32- or 64-bit
builds using the old and the new dynamic access models, with the use
of Initial Exec enabled or forced disabled (for a total of 8 builds).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlsdesc.patch
Type: text/x-patch
Size: 75803 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20060206/2684d970/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America        http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


More information about the Libc-alpha mailing list