diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-04-21 11:09:25 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-04-21 11:13:54 +0200 |
commit | 2d4c3af94f84c874cfddc753dc0f34ebf7fc11d9 (patch) | |
tree | 0c2846199cd8422a5c2c912460c746ff7279d9ca /libstdc++-v3 | |
parent | 0bf8cd9d5e8acf6fd90a14f832bb2d5de97449b3 (diff) | |
download | gcc-2d4c3af94f84c874cfddc753dc0f34ebf7fc11d9.zip gcc-2d4c3af94f84c874cfddc753dc0f34ebf7fc11d9.tar.gz gcc-2d4c3af94f84c874cfddc753dc0f34ebf7fc11d9.tar.bz2 |
Fix AIX libstdc++ semaphore support [PR100164]
> > The #error would not be hit if _GLIBCXX_HAVE_POSIX_SEMAPHORE were defined,
> > but it shows up in your error report.
> You now have pinpointed the problem.
> It's not that AIX doesn't have semaphore, but that the code previously
> had a fallback that hid a bug in the macros:
// Use futex if available and didn't force use of POSIX
using __fast_semaphore = __atomic_semaphore<__detail::__platform_wait_t>;
using __fast_semaphore = __platform_semaphore;
using __fast_semaphore = __atomic_semaphore<ptrdiff_t>;
> The problem is that libstdc++ configure defines
> _GLIBCXX_HAVE_POSIX_SEMAPHORE in config.h. libstdc++ uses sed to
> rewrite config.h to c++config.h and prepends _GLIBCXX_, so c++config.h
> contains
> And bits/semaphore_base.h is not testing that corrupted macro. Either
> semaphore_base.h needs to test for the corrupted macro, or libtsdc++
> configure needs to define HAVE_POSIX_SEMAPHORE without itself
> prepending _GLIBCXX_ so that the c++config.h rewriting works
> correctly and defines the correct macro for semaphore_base.h.
The include/Makefile.am sed is:
sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
-e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
-e 's/VERSION/_GLIBCXX_VERSION/g' \
-e 's/WORDS_/_GLIBCXX_WORDS_/g' \
-e 's/_DARWIN_USE_64_BIT_INODE/_GLIBCXX_DARWIN_USE_64_BIT_INODE/g' \
-e 's/_FILE_OFFSET_BITS/_GLIBCXX_FILE_OFFSET_BITS/g' \
-e 's/_LARGE_FILES/_GLIBCXX_LARGE_FILES/g' \
-e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
-e '/[ ]_GLIBCXX_LONG_DOUBLE_COMPAT[ ]/d' \
-e '/[ ]_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT[ ]/d' \
< ${CONFIG_HEADER} >> $@ ;\
so for many macros one needs _GLIBCXX_ prefixes already in configure,
as can be seen in grep AC_DEFINE.*_GLIBCXX configure.ac acinclude.m4
But _GLIBCXX_HAVE_POSIX_SEMAPHORE is the only one that shouldn't have
that prefix because the sed is adding that.
E.g. on i686-linux, I see
grep _GLIBCXX__GLIBCXX c++config.h
that proves it is the only broken one.
So this change fixes the acinclude.m4 side.
2021-04-21 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/100164
* acinclude.m4: For POSIX semaphores AC_DEFINE HAVE_POSIX_SEMAPHORE
rather than _GLIBCXX_HAVE_POSIX_SEMAPHORE.
* configure: Regenerated.
* config.h.in: Regenerated.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 2 | ||||
-rw-r--r-- | libstdc++-v3/config.h.in | 8 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index e4175ea..1c0a4c1 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4097,7 +4097,7 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [ [ac_have_posix_semaphore=no]) if test $ac_have_posix_semaphore = yes ; then - AC_DEFINE(_GLIBCXX_HAVE_POSIX_SEMAPHORE, + AC_DEFINE(HAVE_POSIX_SEMAPHORE, 1, [Define to 1 if POSIX Semaphores with sem_timedwait are available in <semaphore.h>.]) fi diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index d36ca26..37b56b8 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -291,6 +291,10 @@ /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN +/* Define to 1 if POSIX Semaphores with sem_timedwait are available in + <semaphore.h>. */ +#undef HAVE_POSIX_SEMAPHORE + /* Define to 1 if you have the `powf' function. */ #undef HAVE_POWF @@ -818,10 +822,6 @@ /* Define if gthreads library is available. */ #undef _GLIBCXX_HAS_GTHREADS -/* Define to 1 if POSIX Semaphores with sem_timedwait are available in - <semaphore.h>. */ -#undef _GLIBCXX_HAVE_POSIX_SEMAPHORE - /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #undef _GLIBCXX_HOSTED diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 13f2e69..326a279 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -75836,7 +75836,7 @@ fi if test $ac_have_posix_semaphore = yes ; then -$as_echo "#define _GLIBCXX_HAVE_POSIX_SEMAPHORE 1" >>confdefs.h +$as_echo "#define HAVE_POSIX_SEMAPHORE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_have_posix_semaphore" >&5 |