Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/atomic libc __atomic_is_lock_free: Fix clang...



details:   https://anonhg.NetBSD.org/src/rev/8610276f628d
branches:  trunk
changeset: 374143:8610276f628d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Apr 03 08:00:28 2023 +0000

description:
libc __atomic_is_lock_free: Fix clang build with symbol hacks.

diffstat:

 common/lib/libc/atomic/atomic_is_lock_free.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 0cf35ac9f165 -r 8610276f628d common/lib/libc/atomic/atomic_is_lock_free.c
--- a/common/lib/libc/atomic/atomic_is_lock_free.c      Mon Apr 03 06:42:57 2023 +0000
+++ b/common/lib/libc/atomic/atomic_is_lock_free.c      Mon Apr 03 08:00:28 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $        */
+/*     $NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -27,12 +27,21 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.1 2023/03/30 15:03:36 riastradh Exp $");
+__RCSID("$NetBSD: atomic_is_lock_free.c,v 1.2 2023/04/03 08:00:28 riastradh Exp $");
 
 #include <sys/types.h>
 
 #include <sys/stdbool.h>
 
+/*
+ * XXX Work around clang's built-in __atomic_is_lock_free by having the
+ * C name be different but using an asm rename to define the right
+ * symbol.
+ */
+#define        __atomic_is_lock_free   __atomic_is_lock_free_hack
+bool __atomic_is_lock_free(size_t, const volatile void *)
+    __RENAME("__atomic_is_lock_free");
+
 bool
 __atomic_is_lock_free(size_t n, const volatile void *p __unused)
 {



Home | Main Index | Thread Index | Old Index