[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mbrtowc: port to AIX 7.1 with xlc 12.1
From: |
Paul Eggert |
Subject: |
[PATCH] mbrtowc: port to AIX 7.1 with xlc 12.1 |
Date: |
Tue, 2 Mar 2021 16:28:55 -0800 |
Fix a problem with locks when building GNU Tar (Savannah commit
55f2a0772e08b9febac3ac0de5cb048d4c60d2f5) on AIX 7.1 with IBM XL
C/C++ V12.1 using ‘./configure CC=xlc’. The link fails due to
missing definitions of pthread_mutex_lock and
pthread_mutex_unlock. GNU Tar uses unlocked-io and so
should not need to worry about multithreading or locks.
* lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]:
Don’t bother with locks, since this app is single-threaded.
There may be similar linking problems with lib/nl_langinfo.c and
lib/setlocale_null.c but my GNU Tar build didn’t run into them, so
I left them alone for now.
---
ChangeLog | 15 +++++++++++++++
lib/mbtowc-lock.h | 10 +++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0304f6958..7ba436925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2021-03-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ mbrtowc: port to AIX 7.1 with xlc 12.1
+ Fix a problem with locks when building GNU Tar (Savannah commit
+ 55f2a0772e08b9febac3ac0de5cb048d4c60d2f5) on AIX 7.1 with IBM XL
+ C/C++ V12.1 using ‘./configure CC=xlc’. The link fails due to
+ missing definitions of pthread_mutex_lock and
+ pthread_mutex_unlock. GNU Tar uses unlocked-io and so
+ should not need to worry about multithreading or locks.
+ * lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]:
+ Don’t bother with locks, since this app is single-threaded.
+ There may be similar linking problems with lib/nl_langinfo.c and
+ lib/setlocale_null.c but my GNU Tar build didn’t run into them, so
+ I left them alone for now.
+
2021-03-01 Paul Eggert <eggert@cs.ucla.edu>
unlocked-io: do not redefine getc_unlocked etc.
diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h
index 696b12c58..b7c5ba8a0 100644
--- a/lib/mbtowc-lock.h
+++ b/lib/mbtowc-lock.h
@@ -32,7 +32,15 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
/* Prohibit renaming this symbol. */
#undef gl_get_mbtowc_lock
-#if defined _WIN32 && !defined __CYGWIN__
+#ifdef USE_UNLOCKED_IO
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif defined _WIN32 && !defined __CYGWIN__
extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);
--
2.29.2
- [PATCH] mbrtowc: port to AIX 7.1 with xlc 12.1,
Paul Eggert <=