* Richard Henderson: > You're kidding, right? *All* targets have to generate different > code for thread-local storage. If it didn't, it wouldn't be > thread-local, would it?
The local/non-local distinction could be encoded as a flag in the load instruction, set by the linker according to the definition it sees. i386 is not very far away from that. Nowadays, the distinction is just an instruction prefix. However, you need very specialized hardware support for taking a globally valid address of a thread-local object. (For example, LEA on i386 is not good enough). This means that thread-local storage with the semantics GCC provides is not just a mapping issue.