[PATCH 3/3] nptl: Add tests for internal pthread_mutex_t offsets
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Oct 17 13:47:00 GMT 2017
On 16/10/2017 19:36, H.J. Lu wrote:
> On Mon, Oct 16, 2017 at 1:44 PM, Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> This patch adds a new build test to check for internal fields
>> offsets uses on pthread_mutex_t static initialization macros
>> (PTHREAD_MUTEX_INITIALIZER, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
>> PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, and
>> PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP).
>>
>> Currently the only field which is statically initialized to a
>> non zero/null value is pthread_mutex_t.__data.__kind value. A new
>> internal header (pthread-offset.h) is added to each major ABI with
>> the reference value.
>>
>> Checked on x86_64-linux-gnu and with a build check for all affected
>> ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
>> hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
>> microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu,
>> mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu,
>> s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu,
>> sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32,
>> tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32).
>>
>> * nptl/Makefile (tests-internal): Add tst-offsets.
>> * nptl/tst-offsets.c: New file.
>> * sysdeps/aarch64/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/alpha/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/arm/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/hppa/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/i386/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/ia64/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/m68k/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/microblaze/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/mips/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/nios2/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/powerpc/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/s390/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/sh/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/sparc/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/tile/nptl/pthread-offsets.h: Likewise.
>> * sysdeps/x86_64/nptl/pthread-offsets.h: Likewise.
>> ---
>>
>
> __PTHREAD_MUTEX_HAVE_PREV affects quite few offsets.
> We should check all of offsets which depend on it.
I thought about it, however currently only __data.__kind member is initialized
to non zero value by the static initializers (and thus the only member really
affected by ABI change by change in internal layout). My idea is to make the
test a place-holder in case change the static initializers to user different
values.
More information about the Libc-alpha
mailing list