bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 3/5] Support clang for explicit_bzero


From: roucaries . bastien
Subject: [PATCH 3/5] Support clang for explicit_bzero
Date: Sat, 11 Apr 2020 23:20:33 +0200

From: Bastien Roucari├Ęs <address@hidden>

According to https://bugs.llvm.org/show_bug.cgi?id=15495#c11
llvm need g type constraint

Signed-off-by: Bastien Roucari├Ęs <address@hidden>
---
 lib/explicit_bzero.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index b355f9bdf..21bbd67e8 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -56,9 +56,15 @@ explicit_bzero (void *s, size_t len)
   (void) SecureZeroMemory(s,len);
 #else
   memset (s, '\0', len);
-# if defined __GNUC__ && !defined __clang__
-  /* Compiler barrier.  */
-  asm volatile ("" ::: "memory");
-# endif
+#if defined __GNUC__
+#   if !defined __clang__
+    /* Compiler barrier.  */
+    asm volatile ("" ::: "memory");
+#  else
+   /* https://bugs.llvm.org/show_bug.cgi?id=15495#c11 */
+  __asm__ volatile("" : : "g"(s) : "memory");
+#  endif
+#endif
+
 #endif
 }
-- 
2.25.1




reply via email to

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