Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:29:26+00:00 2026-06-13T00:29:26+00:00

Ulrich Drepper’s paper on thread-local storage outlines the TLS ABI for several different cpu

  • 0

Ulrich Drepper’s paper on thread-local storage outlines the TLS ABI for several different cpu architectures, but I’m finding it insufficient as a basis for implementing TLS for two reasons:

  1. It omits a number of important archs like ARM, MIPS, etc. (while including a bunch of completely-irrelevant ones like Itanium)
  2. More importantly, it mixes a lot of implementation details with ABI, so that it’s hard to tell which properties are required for interoperability, and which are just aspects of his implementation.

As an example, the only actual ABI requirements for i386 are:

  • %gs:0 points to a pointer to itself.
  • The main executable’s TLS segment, if any, must be located at a fixed (by the linker, negative) offset from this address.
  • All other TLS segments for initially-loaded libraries must have a runtime-constant (i.e. same for each thread, but not necessarily the same across different program runs) offsets relative to this address (and the dynamic linker must be able to fill in relocations with these offsets).
  • ___tls_get_addr and __tls_get_addr functions must exist with the correct semantics for looking up arbitrary TLS segments.

In particular, the existence or layout of a DTV is not part of the ABI, nor is the ordering/layout of TLS segments other than the main program’s.

It seems that any arch using “TLS variant II” has roughly the above ABI requirements. But I don’t understand the requirements of “TLS variant I” very well at all, and it seems from reading sources (in uClibc and glibc) that there may even be several variants of “variant I”.

Are there any better documents I should be looking at, or can somebody familiar with the workings of TLS explain the ABI requirements to me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:29:27+00:00Added an answer on June 13, 2026 at 12:29 am

    The best I can gather so far is:

    For either TLS variant, __tls_get_addr or other arch-specific functions must exist and have the correct semantics for looking up any TLS object, and the relative offset between any two TLS segments must be a runtime constant (same offset for each thread).

    For TLS variant II (i386, etc.), the “thread pointer register” (which may not actually be a register, but perhaps some mechanism like %gs:0 or even a trap into kernelspace; for simplicity though let’s just call it a register) points just past the end of the TLS segment for the main executable, where “just past the end” includes rounding up to the next multiple of the TLS segment’s alignment.

    For TLS variant I, the “thread pointer register” points to some fixed offset from the beginning of the TLS segment for the main executable. This offset varies by arch. (It has been chosen on some ugly RISC archs to maximize the amount of TLS accessible via signed 16-bit offsets, which strikes me as extremely useless since the compiler has no way of knowing whether the relocated offset will fit in 16 bits and thus must always generate the slower, larger 32-bit-offset code using load-upper/add instructions).

    As far as I can tell, nothing about TCBs, DTVs, etc. is part of the ABI, in the sense that applications are not permitted to access these structures, nor is the location of any TLS segment other than the main executable’s part of the ABI. In both variants I and II, it makes sense to store implementation-internal information for the thread at a fixed offset from the “thread pointer register”, in whichever way safely avoids overlapping the TLS segment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Ulrich Drepper's paper What every programmer should know about memory , the 3rd
Readed bog of Ulrich Drepper and come across 2 entries that looks like conficting.
I've been reading Ulrich Drepper's, What every programmer should know about memory and in
I am wondering how much of Ulrich Drepper's What Every Programmer Should Know About
The Portlets in Plone are quite handy but I'd like to be able to
After learning that both strncmp is not what it seems to be and strlcpy
I have a number field with duplicate no's (1,1,1,1,2,2,2,2,3,4,5 etc) which defines the position
I am new to .htaccess and I have found a few articles and I've
This is really an extension of my question yesterday where I learned about apply.weekly
Most of the time, when you compile a shared library, executing it is meaningless

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.