[committed] hppa: Drop 16-byte pthread lock alignment
John David Anglin
dave.anglin@bell.net
Mon Mar 27 01:58:19 GMT 2023
On 2023-03-26 8:37 p.m., Sam James wrote:
> Florian Weimer <fw@deneb.enyo.de> writes:
>
>> * John David Anglin:
>>
>>> hppa: Drop 16-byte pthread lock alignment
>>>
>>> Linux threads were removed about 12 years ago and the current
>>> nptl implementation only requires 4-byte alignment for pthread
>>> locks.
>>>
>>> The 16-byte alignment causes various issues. For example in
>>> building ignition-msgs, we have:
>>>
>>> /usr/include/google/protobuf/map.h:124:37: error: static assertion failed
>>> 124 | static_assert(alignof(value_type) <= 8, "");
>>> | ~~~~~~~~~~~~~~~~~~~~^~~~
>>>
>>> This is caused by the 16-byte pthread lock alignment.
>> This was done deliberately to preserve ABI. This change needs a mass
>> rebuild because struct offsets after pthread_mutex_t members are
>> likely to change.
Although the change may change some structure offsets, I don't believe the change requires a mass rebuild.
I am running a Debian hppa system with the reduced lock alignment and so far I haven't observed any breakage.
I checked this prior to committing the change.
Packages in Debian unstable are rebuilt frequently.
I don't see that we had much choice. Either we break the ABI or we live with packages that don't work on hppa.
Here is comment in map.h:
// MapAllocator does not support alignments beyond 8. Technically we should
// support up to std::max_align_t, but this fails with ubsan and tcmalloc
// debug allocation logic which assume 8 as default alignment.
static_assert(alignof(value_type) <= 8, "");
It was the above comment that convinced me that we needed to change the pthread lock alignment.
The analysis in the protobuf issue is exactly correct:
https://github.com/protocolbuffers/protobuf/issues/9433
Protobuf is not the only package affected by this issue.
Regards,
Dave
--
John David Anglin dave.anglin@bell.net
More information about the Libc-alpha
mailing list