summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog5
-rw-r--r--lib/asyncsafe-spin.c5
-rw-r--r--lib/simple-atomic.c5
3 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b915b7d..9f6818c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
2021-03-03 Bruno Haible <bruno@clisp.org>
+ asyncsafe-spin, simple-atomic: Add support for tcc/x86.
+ * lib/asyncsafe-spin.c (memory_barrier): With tcc/x86, don't use the
+ 'mfence' instruction.
+ * lib/simple-atomic.c (memory_barrier): Likewise.
+
asyncsafe-spin, simple-atomic: Add support for tcc.
* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): On
i386 and x86_64, treat tcc like older GCC or clang.
* lib/simple-atomic.c (memory_barrier, atomic_compare_and_swap,
atomic_compare_and_swap_ptr): Likewise.
diff --git a/lib/asyncsafe-spin.c b/lib/asyncsafe-spin.c
index cece623..d0cdb39 100644
--- a/lib/asyncsafe-spin.c
+++ b/lib/asyncsafe-spin.c
@@ -199,13 +199,18 @@ do_unlock (asyncsafe_spinlock_t *lock)
static void
memory_barrier (void)
{
# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
# if defined __i386 || defined __x86_64__
+# if defined __TINYC__ && defined __i386
+ /* Cannot use the SSE instruction "mfence" with this compiler. */
+ asm volatile ("lock orl $0,(%esp)");
+# else
asm volatile ("mfence");
+# endif
# endif
# if defined __sparc
asm volatile ("membar 2");
# endif
# else
# if defined __i386 || defined __x86_64__
diff --git a/lib/simple-atomic.c b/lib/simple-atomic.c
index 4d5a0d8..7c4f7e9 100644
--- a/lib/simple-atomic.c
+++ b/lib/simple-atomic.c
@@ -194,13 +194,18 @@ atomic_compare_and_swap_ptr (uintptr_t volatile *vp,
void
memory_barrier (void)
{
# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
# if defined __i386 || defined __x86_64__
+# if defined __TINYC__ && defined __i386
+ /* Cannot use the SSE instruction "mfence" with this compiler. */
+ asm volatile ("lock orl $0,(%esp)");
+# else
asm volatile ("mfence");
+# endif
# endif
# if defined __sparc
asm volatile ("membar 2");
# endif
# else
# if defined __i386 || defined __x86_64__

Return to:

Send suggestions and report system problems to the System administrator.