options/rtdl: Permit TLS alignments greater than 16 bytes
@@ -712,6 +712,8 @@ Tcb *allocateTcb() {
auto td_buffer = getAllocator().allocate(td_size);
memset(td_buffer, 0, td_size);
+ __ensure((reinterpret_cast<uintptr_t>(td_buffer) & (tlsMaxAlignment - 1)) == 0);
+
Tcb *tcb_ptr = nullptr;
if constexpr (tlsAboveTp) {
@@ -1047,8 +1049,6 @@ void Loader::_buildTlsMaps() {
object->tlsIndex = runtimeTlsMap->indices.size();
runtimeTlsMap->indices.push_back(object);
- __ensure((16 & (object->tlsAlignment - 1)) == 0);
-
object->tlsModel = TlsModel::initial;
if constexpr (tlsAboveTp) {
@@ -1097,7 +1097,6 @@ void Loader::_buildTlsMaps() {
// There are some libraries (e.g. Mesa) that require static TLS even though
// they expect to be dynamically loaded.
if(object->haveStaticTls) {
- __ensure((16 & (object->tlsAlignment - 1)) == 0);
auto ptr = runtimeTlsMap->initialPtr + object->tlsSegmentSize;
size_t misalign = ptr & (object->tlsAlignment - 1);
if(misalign)
