From: roucaries.bastien@gmail.com
To: bug-gnulib@gnu.org
Cc: "Bastien Roucariès" <rouca@debian.org>
Subject: [PATCH 2/2] Implement fallback for explicit_bzero using jump to volatile pointer
Date: Sat, 23 Jan 2021 11:22:11 +0000 [thread overview]
Message-ID: <20210123112211.198683-3-rouca@debian.org> (raw)
In-Reply-To: <20210123112211.198683-1-rouca@debian.org>
From: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Bastien Roucariès <rouca@debian.org>
---
lib/explicit_bzero.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index 71a1cca3b0..c39f20164b 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -54,11 +54,10 @@ explicit_bzero (void *s, size_t len)
explicit_memset (s, '\0', len);
#elif HAVE_MEMSET_S
(void) memset_s (s, len, '\0', len);
-#else
+#elif defined __GNUC__
memset (s, '\0', len);
-# if defined __GNUC__
/* Compiler barrier. */
-# if !defined __clang__
+# if !defined __clang__
asm volatile ("" ::: "memory");
# else
/* See https://bugs.llvm.org/show_bug.cgi?id=15495#c11
@@ -70,5 +69,8 @@ explicit_bzero (void *s, size_t len)
__asm__ volatile("" : : "g"(s) : "memory");
# endif
# endif
+#else
+ void * (* const volatile volatile_memset)(void *, int, size_t) = memset;
+ (void) volatile_memset (s, '\0', len);
#endif
}
--
2.29.2
next prev parent reply other threads:[~2021-01-23 11:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 11:22 [V5] explicit_bzero roucaries.bastien
2021-01-23 11:22 ` [PATCH 1/2] Support clang for explicit_bzero roucaries.bastien
2021-01-23 13:25 ` Bruno Haible
2021-01-23 11:22 ` roucaries.bastien [this message]
2021-01-23 13:33 ` [PATCH 2/2] Implement fallback for explicit_bzero using jump to volatile pointer Bruno Haible
-- strict thread matches above, loose matches on Subject: below --
2021-01-23 10:49 [V4][0/2] explicit_bzero roucaries.bastien
2021-01-23 10:49 ` [PATCH 2/2] Implement fallback for explicit_bzero using jump to volatile pointer roucaries.bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210123112211.198683-3-rouca@debian.org \
--to=roucaries.bastien@gmail.com \
--cc=bug-gnulib@gnu.org \
--cc=rouca@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).