This patch adds support for thread-local storage (TLS). All four TLS models: global/local-dynamic (both are the same in RISC-V), initial-exec and local-exec are supported, but TLS relaxation is not implemented yet.
In RISC-V (in glibc's implementation at least), the thread pointer (tp/x4) points to the end of TCB and the beginning of the static TLS block, and each DTV points to 0x800 past the start of the TLS block.
I think there's no reason to use a preprocessor macro. Why don't you use constexpr?