Why is there any restriction at all on which register can be used ? I
can't see such restriction in GCC documentation :
https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html
The clang implementation shares the same code paths as the user space
thread local storage implementation. That code uses a fixed register (2
for 32-bit, 13 for 64-bit) and a fixed offset (-0x7008 for 32-bit and
-0x7010 for 64-bit).
The new code controls the offset value with a command line parameter.
I didn't see any need to make the changes more complicated by including
support for arbitrary registers. The implementation would be reasonably
straightforward, but it would make testing a bunch harder.
The command line parsing code validates that you've selected the correct
register — if we allow other registers in the future, you'll be able to
verify whether the compiler supports that by testing at build time.
--
-keith