bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test for pthread_rwlock_init() always passes, regardless


From: Sevan Janiyan
Subject: Re: Test for pthread_rwlock_init() always passes, regardless
Date: Wed, 8 Nov 2023 13:35:09 +0000
User-agent: Mozilla Thunderbird

On 08/11/2023 09:58, Bruno Haible wrote:
According to our function database
https://git.savannah.gnu.org/gitweb/?p=gnulib/maint-tools.git;a=tree;f=platforms/various-symlists;h=959af7a410a8416f4b183793ac2dae7e1063024f;hb=HEAD
the function does exist in Mac OS X 10.3, 10.4, and 10.5. In 10.5
they added an alias pthread_rwlock_init$UNIX2003, but that is not
relevant for the autoconf test.

You're right, I was mixing two things up.
Compiling the test case with 'cc -Wall -O2 -lpthread' by hand results in
Bus Error
What do you mean? You get a Bus Error already at compile time, i.e.
the compiler or linker crashes?

Or do you get a Bus Error by running that test program? I.e. as if
we had an AC_RUN_IFELSE instead of AC_LINK_IFELSE in the above test?

I get a Bus Error when I try to run the program. Mentioned it because it doesn't happen on newer macOS versions but that could because the compiler is smarter?

Otherwise things fail during compilation because it's
expecting an implementation from the host.
test-pthread.c:33: error: ‘PTHREAD_RWLOCK_INITIALIZER’ undeclared here
(not in a function).
Ah, but that is a different problem. What you report here is that
no macro PTHREAD_RWLOCK_INITIALIZER is defined in Mac OS X 10.4,
while it exists in 10.5:
   #define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}

It looks like lib/glthread/lock.h does better efforts at handling the
lack of PTHREAD_RWLOCK_INITIALIZER than lib/pthread.in.h. What is the
result if you change lib/pthread.in.h?

The patch passes that error and then fails in compiling test-lock.c because _PTHREAD_RWLOCK_SIG_init is not defined. test-lock.c:234: error: ‘_PTHREAD_RWLOCK_SIG_init’ undeclared here (not in a function)

On 10.5 & newer, _PTHREAD_RWLOCK_SIG_init is defined as
#define _PTHREAD_RWLOCK_SIG_init    0x2DA8B3B4
in pthread_impl.h.

Looking into the libc source for 10.4.11 PPC [1]
It's defined with a comment in pthread_internals.h that indicates to me that there may be some issue with the implementation on 10.4? (they reached UNIX certification in 10.5)
#define _PTHREAD_RWLOCK_SIG_init        0x2DA8B3B4  /* [almost] ~'RWLK' */


Sevan
[1] https://github.com/apple-oss-distributions/Libc/blob/d07313eeff7c6402e25133c65d3fa66f2a64f688/pthreads/pthread_internals.h#L288




reply via email to

[Prev in Thread] Current Thread [Next in Thread]