- T.size += (-T.size - (uintptr_t)T.image) & (T.align-1);
- if (T.align < MIN_TLS_ALIGN) T.align = MIN_TLS_ALIGN;
+ main_tls.size += (-main_tls.size - (uintptr_t)main_tls.image)
+ & (main_tls.align-1);
+#ifdef TLS_ABOVE_TP
+ main_tls.offset = GAP_ABOVE_TP;
+ main_tls.offset += -GAP_ABOVE_TP & (main_tls.align-1);
+#else
+ main_tls.offset = main_tls.size;
+#endif
+ if (main_tls.align < MIN_TLS_ALIGN) main_tls.align = MIN_TLS_ALIGN;